Index: sansguiframe/src/sans/guiframe/data_processor.py
===================================================================
--- sansguiframe/src/sans/guiframe/data_processor.py	(revision c71d042dd6b23f680067d40f58fb6d8e71fc2f0f)
+++ sansguiframe/src/sans/guiframe/data_processor.py	(revision 86a9e6c0e7494d96dee88094bc74af113a0e322b)
@@ -126,4 +126,7 @@
         self.SetNumberRows(self._rows)
         self.SetNumberCols(self._cols)
+        color = self.parent.GetBackgroundColour()
+        for col in range(self._cols):
+            self.SetCellBackgroundColour(0, col, color)
         self.AutoSize()
         self.list_plot_panels = {}
@@ -216,5 +219,5 @@
             if cell_row > 0 and cell_row < self.max_row_touse:
                 self.axis_value.append(self.GetCellValue(cell_row, cell_col))
-     
+
     def on_left_click(self, event):
         """
@@ -226,4 +229,5 @@
         col = event.GetCol()
         row = event.GetRow()
+
         if not (flag):
             self.selected_cols = []
@@ -422,4 +426,6 @@
         if width < self.default_col_width:
            self.SetColSize(col, self.default_col_width)
+        color = self.parent.GetBackgroundColour()
+        self.SetCellBackgroundColour(0, col, color)
         self.ForceRefresh()
         
@@ -529,4 +535,10 @@
         return grid_view
     
+    def get_nofrows(self):
+        """
+        Return number of total rows
+        """
+        return self._rows
+    
 class Notebook(nb, PanelBase):
     """
@@ -546,4 +558,5 @@
                     wx.CLIP_CHILDREN)
         PanelBase.__init__(self, parent)
+        self.gpage_num = 1
         self.enable_close_button()
         self.parent = parent
@@ -552,6 +565,6 @@
         #add empty page
         self.add_empty_page()
-        
-        self.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CLOSE, self.on_close_page)
+        self.pageClosedEvent = wx.aui.EVT_AUINOTEBOOK_PAGE_CLOSE
+        self.Bind(self.pageClosedEvent, self.on_close_page)    
     
     def add_empty_page(self):
@@ -561,7 +574,9 @@
         self.AddPage(grid, "", True)
         pos = self.GetPageIndex(grid)
-        title = "Grid" + str(self.GetPageCount())
+        title = "Grid" + str(self.gpage_num)
         self.SetPageText(pos, title)
         self.SetSelection(pos)
+        self.enable_close_button()
+        self.gpage_num += 1
         return grid , pos
         
@@ -605,12 +620,31 @@
                     msg += "Please select elements of the same col.\n"
                     raise ValueError, msg
+                
+            # Finally check the highlighted cell if any cells missing
+            self.get_highlighted_row()
         else:
             msg = "No item selected.\n"
             msg += "Please select only one column or one cell"
             raise ValueError, msg
-       
         return grid.selected_cells
        
-    
+    def get_highlighted_row(self):
+        """
+        Add highlight rows
+        """
+        pos = self.GetSelection()
+        grid = self.GetPage(pos)
+        col = grid.selected_cols[0]
+        # Finally check the highlighted cell if any cells missing
+        for row in range(grid.get_nofrows()):
+            if grid.IsInSelection(row, col):
+                cel = (row, col)
+                if row < 1:
+                    continue
+                if not grid.GetCellValue(row, col):
+                    continue
+                if cel not in grid.selected_cells:
+                    grid.selected_cells.append(cel)
+                        
     def get_column_labels(self):
         """
@@ -655,9 +689,10 @@
         if len(cell_list) > 0:
             if len(cell_list) == 1:
-                 row_min, col  = cell_list[0]    
-                 col_name =  grid.GetColLabelValue(int(col))#grid.GetCellValue(0, col)
-                 col_title = grid.GetCellValue(0, col)
-                 label = create_label(col_name, row_min+1 , row_min+1)
-                 return  label,  col_title
+                row_min, col  = cell_list[0]    
+                col_name =  grid.GetColLabelValue(int(col))
+                 
+                col_title = grid.GetCellValue(0, col)
+                label = create_label(col_name, row_min+1 , row_min+1)
+                return  label,  col_title
             else:
                 temp_list = copy.deepcopy(cell_list)
@@ -666,8 +701,9 @@
                 row_min, col  = temp_list[0]    
                 row_max, _  = temp_list[length-1]
-                col_name =  grid.GetColLabelValue(int(col))#grid.GetCellValue(0, col)
+                col_name = grid.GetColLabelValue(int(col))
                 col_title = grid.GetCellValue(0, col)
+
                 index = 0
-                for row in xrange(row_min, row_max +1):
+                for row in xrange(row_min, row_max + 1):
                     if index > 0 and index < len(temp_list):
                         new_row, _ = temp_list[index]
@@ -676,6 +712,7 @@
                             if index -1 >= 0:
                                 new_row, _ = temp_list[index-1]
-                                if not new_row==None and new_row!=' ' :
-                                    label += create_label(col_name, None, int(new_row) +1)
+                                if not new_row == None and new_row != ' ' :
+                                    label += create_label(col_name, None, 
+                                                          int(new_row) +1)
                                 else:
                                     label += "]"
@@ -684,15 +721,18 @@
                                 new_row, _ = temp_list[index + 1]
                                 if not new_row==None:
-                                    label += create_label(col_name, int(new_row)+1, None)
+                                    label += create_label(col_name, 
+                                                          int(new_row)+1, None)
                     if row_min != None and row_max != None:
                         if index == 0:
-                            label += create_label(col_name,  int(row_min)+1, None)
+                            label += create_label(col_name,  
+                                                  int(row_min)+1, None)
                         elif index == len(temp_list)-1:
-                            label += create_label(col_name, None, int(row_max)+1)
+                            label += create_label(col_name, None, 
+                                                  int(row_max)+1)
                     index += 1
                 # clean up the list
                 label_out = ''
                 for item in label.split(','):
-                    if item.split(":")[1]=="]":
+                    if item.split(":")[1] == "]":
                         continue
                     else:
@@ -707,5 +747,5 @@
         if self.GetPageCount() == 1:
             event.Veto()
-        self.enable_close_button()
+        wx.CallAfter(self.enable_close_button)
         
     def set_data(self, data_inputs, data_outputs, details="", file_name=None):
@@ -806,4 +846,5 @@
         self.plot_button = None
         self.notebook = None
+        self.plot_num = 1
        
         self.layout_grid()
@@ -869,4 +910,5 @@
         grid = self.notebook.GetPage(pos)
         title = self.notebook.GetPageText(pos)
+        self.notebook.get_highlighted_row()
         if len(grid.selected_cells) == 0:
             msg = "Highlight a Data or Chi2 column first..."
@@ -937,11 +979,5 @@
                                     #time.sleep(0.5) 
                                     return
-                                    #continue  
-                        """
-                        wx.PostEvent(self.parent.parent, 
-                                     NewPlotEvent(action="clear",
-                                                  group_id=str(group_id),
-                                                  title=title)) 
-                        """ 
+
                         wx.PostEvent(self.parent.parent, 
                                      NewPlotEvent(plot=new_plot, 
@@ -963,7 +999,4 @@
                     #continue
     
-        
-     
-    
     def on_plot(self, event):
         """
@@ -982,11 +1015,12 @@
                 raise ValueError, msg
         except:
-             wx.PostEvent(self.parent.parent, 
-                             StatusEvent(status=msg, info="error")) 
-             return
-
+            msg = "X axis value error."
+            wx.PostEvent(self.parent.parent, 
+                            StatusEvent(status=msg, info="error")) 
+            return
         dict = parse_string(sentence, column_names.keys())
-        sentence = self.get_sentence(dict, sentence, column_names)
+        
         try:
+            sentence = self.get_sentence(dict, sentence, column_names)
             x = eval(sentence)
         except:
@@ -997,10 +1031,16 @@
         #evaluate y
         sentence = self.y_axis_label.GetValue()
-        if sentence.strip() == "":
-            msg = "select value for y axis"
-            raise ValueError, msg
+        try:
+            if sentence.strip() == "":
+                msg = "select value for y axis"
+                raise ValueError, msg
+        except:
+            msg = "Y axis value error."
+            wx.PostEvent(self.parent.parent, 
+                            StatusEvent(status=msg, info="error")) 
+            return
         dict = parse_string(sentence, column_names.keys())
-        sentence = self.get_sentence(dict, sentence, column_names)
         try:
+            sentence = self.get_sentence(dict, sentence, column_names)
             y = eval(sentence)
         except:
@@ -1052,5 +1092,8 @@
         try:
             title = y_title.strip()
-            title += self.notebook.GetPageText(pos)
+            
+            title += "_" + self.notebook.GetPageText(pos)
+            title += "_" + str(self.plot_num)
+            self.plot_num += 1
             new_plot.name = title
             new_plot.xtransform = "x"
@@ -1346,5 +1389,5 @@
         """
         if self.parent is not None:
-            self.parent.on_read_batch_tofile(event)
+            self.parent.on_read_batch_tofile(self)
             
     def open_with_excel(self, event):
Index: sansguiframe/src/sans/guiframe/gui_manager.py
===================================================================
--- sansguiframe/src/sans/guiframe/gui_manager.py	(revision d560a37b0f82cb84d86416b8bc5238c1dc3fc159)
+++ sansguiframe/src/sans/guiframe/gui_manager.py	(revision 86a9e6c0e7494d96dee88094bc74af113a0e322b)
@@ -374,5 +374,5 @@
         self.show_batch_frame(None)
         
-    def on_read_batch_tofile(self, event):
+    def on_read_batch_tofile(self, base):
         """
         Open a file dialog , extract the file to read and display values
@@ -382,9 +382,9 @@
         if self._default_save_location == None:
             self._default_save_location = os.getcwd()
-        
-        dlg = wx.FileDialog(self, 
+        wildcard = "(*.csv; *.txt)|*.csv; *.txt"
+        dlg = wx.FileDialog(base, 
                             "Choose a file", 
                             self._default_save_location, "",
-                             "(*.csv)|*.csv| Text Files (*.txt)|*.txt")
+                             wildcard)
         if dlg.ShowModal() == wx.ID_OK:
             path = dlg.GetPath()
@@ -392,6 +392,12 @@
                 self._default_save_location = os.path.dirname(path)
         dlg.Destroy()
-        self.read_batch_tofile(file_name=path)
-        
+        try:
+            self.read_batch_tofile(file_name=path)
+        except:
+            msg = "Error occurred when reading the file; %s\n"% path
+            msg += "%s\n"% sys.exc_value
+            wx.PostEvent(self, StatusEvent(status=msg,
+                                             info="error"))
+            
     def read_batch_tofile(self, file_name):
         """
@@ -446,6 +452,14 @@
             c_name = col_name_toks[col_index]
             if c_name.strip() != "":
-                data[c_name] = [ lines[row].split(separator)[c_index]
-                                for row in range(index + 1, len(lines)-1)]
+                # distinguish between column name and value
+                try:
+                    float(c_name)
+                    col_name = "Column %s"% str(col_index + 1)
+                    index_min = index
+                except:
+                    col_name = c_name
+                    index_min = index + 1
+                data[col_name] = [ lines[row].split(separator)[c_index]
+                                for row in range(index_min, len(lines)-1)]
                 c_index += 1
                 
