--- views_bonus_export.module	2010-01-08 04:24:22.000000000 +0530
+++ views_bonus_export.module	2010-02-23 12:16:00.000000000 +0530
@@ -127,29 +127,42 @@ function template_preprocess_views_bonus
  * Shared helper function for export preprocess functions.
  */
 function _views_bonus_export_shared_preprocess(&$vars) {
-  $view     = $vars['view'];
-  $fields   = &$view->field;
+ $view = $vars['view'];
 
   $rows = $vars['rows'];
 
-  $vars['header'] = array();
-  foreach ($fields as $key => $field) {
-    if (empty($field->options['exclude'])) {
-      $vars['header'][$key] = check_plain($field->label());
+
+$vars['header'] = array();
+
+ foreach ($rows as $num => $row) {
+  foreach ($view->field as $id => $field) {
+    // render this even if set to exclude so it can be used elsewhere.
+    $field_output = $view->style_plugin->get_field($num, $id);
+    $empty = $field_output !== 0 && empty($field_output);
+    if (empty($field->options['exclude']) && (!$empty || empty($field->options['hide_empty']))) {
+     
+
+      $vars['header'][$id] = check_plain($view->field[$id]->label());
     }
   }
+}
 
-  $vars['themed_rows'] = array();
-  $keys = array_keys($fields);
+ $vars['themed_rows'] = array();
+ 
   foreach ($rows as $num => $row) {
     $vars['themed_rows'][$num] = array();
 
-    foreach ($keys as $id) {
-      if (empty($fields[$id]->options['exclude'])) {
-        $vars['themed_rows'][$num][$id] = $fields[$id]->theme($row);
-      }
+    foreach ($view->field as $id => $field) {
+    // render this even if set to exclude so it can be used elsewhere.
+    $field_output = $view->style_plugin->get_field($num, $id);
+    $empty = $field_output !== 0 && empty($field_output);
+    if (empty($field->options['exclude']) && (!$empty || empty($field->options['hide_empty']))) {
+      
+
+      $vars['themed_rows'][$num][$id] = $field_output;
     }
   }
+  }
 }
 

