parameters: (self, book, sheet, display_texts, comments)
docstring: This is the main method of this class, and it is used to actually create
          the cells, size the columns and rows, merging cells, etc...
  
          :param `book`: an instance of the `xlrd.Book` class;
          :param `sheet`: an instance of the `xlrd.sheet` class;
          :param `display_texts`: if Mark Hammonds' `pywin32` package is available,
           this is the WYSIWYG cell content for all the cells in the Excel worksheet;
          :param `comments`: if Mark Hammonds' `pywin32` package is available,
           this is a nested list of cell comments (notes) for all the cells in the
           Excel worksheet.
docstring_summary: This is the main method of this class, and it is used to actually create
          the cells, size the columns and rows, merging cells, etc...
docstring_tokens: This is the main method of this class and it is used to actually create the cells size the columns and rows merging cells etc ...
function: def PopulateGrid(self, book, sheet, display_texts, comments):
          """
          This is the main method of this class, and it is used to actually create
          the cells, size the columns and rows, merging cells, etc...
  
          :param `book`: an instance of the `xlrd.Book` class;
          :param `sheet`: an instance of the `xlrd.sheet` class;
          :param `display_texts`: if Mark Hammonds' `pywin32` package is available,
           this is the WYSIWYG cell content for all the cells in the Excel worksheet;
          :param `comments`: if Mark Hammonds' `pywin32` package is available,
           this is a nested list of cell comments (notes) for all the cells in the
           Excel worksheet.
          """
  
          self.BeginBatch()
      
          nrows = sheet.nrows
          ncols = sheet.ncols
  
          default_width, default_height = self.GetDefaultFontData(book)
          default_colour = self.GetGridLineColour()
          
          hyperlinks, rich_text_list = {}, {}
          if hasattr(sheet, "hyperlink_map"):
              # New in xlrd version 0.7.2 from SVN
              hyperlinks = sheet.hyperlink_map
  
          if hasattr(sheet, "rich_text_runlist_map"):
              # New in xlrd version 0.7.2 from SVN
              rich_text_list = sheet.rich_text_runlist_map
  
          self.cells = {}
  
          for i in xrange(nrows):
  
              for j in xrange(ncols):
  
                  hyperlink = rich_text = None
  
                  if (i, j) in hyperlinks:
                      hyperlink = hyperlinks[(i, j)]
                  if (i, j) in rich_text_list:
                      rich_text = rich_text_list[(i, j)]
                      
                  self.FormatCell(book, sheet, i, j, display_texts, comments, hyperlink, rich_text, default_width, default_colour)
  
          self.table = XLSTable(self, self.cells, nrows, ncols)
          self.SetTable(self.table)
  
          row_height = sheet.default_row_height
          col_width = sheet.defcolwidth 
          
          for i in xrange(nrows):
              if i in sheet.rowinfo_map:
                  current = sheet.rowinfo_map[i].height
              else:
                  current = sheet.default_row_height
  
              row_height = int(round(float(default_height)*current/256.0))
              self.SetRowSize(i, row_height)
  
          for j in xrange(ncols):
              if j in sheet.colinfo_map:
                  current = sheet.colinfo_map[j].width
              else:
                  current = sheet.defcolwidth 
  
              #col_width = int(round(float(default_width)*current/256.0))                
              if current is not None:
                  col_width = int (round (float (default_width) * current/256.0))
              else:
                  col_width = 20 # Set a fixed size for cell
              self.SetColSize(j, col_width)
  
          for merged in sheet.merged_cells:
              rlo, rhi, clo, chi = merged
              if rlo >= 0 and rlo < len(self.cells) and clo >= 0:
                  self.cells[(rlo, clo)].SetCellSize(rhi-rlo, chi-clo)
              
          self.EnableEditing(False)
          self.EnableGridLines(False)
          self.EndBatch()
          self.ForceRefresh()
          self.InstallGridHint()
function_tokens: def PopulateGrid ( self , book , sheet , display_texts , comments ) : self . BeginBatch ( ) nrows = sheet . nrows ncols = sheet . ncols default_width , default_height = self . GetDefaultFontData ( book ) default_colour = self . GetGridLineColour ( ) hyperlinks , rich_text_list = { } , { } if hasattr ( sheet , "hyperlink_map" ) : # New in xlrd version 0.7.2 from SVN hyperlinks = sheet . hyperlink_map if hasattr ( sheet , "rich_text_runlist_map" ) : # New in xlrd version 0.7.2 from SVN rich_text_list = sheet . rich_text_runlist_map self . cells = { } for i in xrange ( nrows ) : for j in xrange ( ncols ) : hyperlink = rich_text = None if ( i , j ) in hyperlinks : hyperlink = hyperlinks [ ( i , j ) ] if ( i , j ) in rich_text_list : rich_text = rich_text_list [ ( i , j ) ] self . FormatCell ( book , sheet , i , j , display_texts , comments , hyperlink , rich_text , default_width , default_colour ) self . table = XLSTable ( self , self . cells , nrows , ncols ) self . SetTable ( self . table ) row_height = sheet . default_row_height col_width = sheet . defcolwidth for i in xrange ( nrows ) : if i in sheet . rowinfo_map : current = sheet . rowinfo_map [ i ] . height else : current = sheet . default_row_height row_height = int ( round ( float ( default_height ) * current / 256.0 ) ) self . SetRowSize ( i , row_height ) for j in xrange ( ncols ) : if j in sheet . colinfo_map : current = sheet . colinfo_map [ j ] . width else : current = sheet . defcolwidth #col_width = int(round(float(default_width)*current/256.0))                 if current is not None : col_width = int ( round ( float ( default_width ) * current / 256.0 ) ) else : col_width = 20 # Set a fixed size for cell self . SetColSize ( j , col_width ) for merged in sheet . merged_cells : rlo , rhi , clo , chi = merged if rlo >= 0 and rlo < len ( self . cells ) and clo >= 0 : self . cells [ ( rlo , clo ) ] . SetCellSize ( rhi - rlo , chi - clo ) self . EnableEditing ( False ) self . EnableGridLines ( False ) self . EndBatch ( ) self . ForceRefresh ( ) self . InstallGridHint ( )