Phoenix Logo

phoenix_title wx.lib.agw.xlsgrid.XLSCell

This is a class which holds information about a single cell in XLSGrid. It stores (via auxiliary classes), all details about cell background, text, font, colours and borders.


class_hierarchy Class Hierarchy

Inheritance diagram for class XLSCell:


method_summary Methods Summary

__init__ Default class constructor.
GetAttr Returns the attribute to use for this specific cell.
GetComment Returns the cell comment, if any.
GetValue Returns the actual WYSIWYG representation of the cell value.
SetCellSize Sets the size of the cell.
SetupCell Actually sets up the XLSCell class. This is an auxiliary method to
SetValue Sets the actual WYSIWYG representation of the cell value.

api Class API



class XLSCell(object)

This is a class which holds information about a single cell in XLSGrid. It stores (via auxiliary classes), all details about cell background, text, font, colours and borders.


Methods



__init__(self, book, cell, xf_index, xls_text, xls_comment, hyperlink, rich_text, default_width, default_colour)

Default class constructor.

Parameters:
  • book – an instance of the xlrd.Book class;
  • cell – an instance of xlrd.sheet.Cell class;
  • xf_index – an index into xlrd.Book.xf_list, which holds a reference to the xlrd.sheet.Cell class (the actual cell for xlrd);
  • xls_text – the actual WYSIWYG cell text, if available;
  • xls_comment – the cell comment (note), if any;
  • hyperlink – an instance of xlrd.sheet.hyperlink;
  • rich_text – if this cell contains text in rich text format, XLSGrid will do its best to render the text as rich text;
  • default_width – this is the default width of the text in 1/256 of the width of the zero character, using default Excel font (first FONT record in the Excel file);
  • default_colour – the “magic” colour used by Excel to draw non-custom border lines.

Note

If you are using version 0.7.1 or lower for xlrd, the hyperlink parameter will always be None as this feature is available only in xlrd 0.7.2 (SVN).

Note

If you are using version 0.7.1 or lower for xlrd, the rich_text parameter will always be None as this feature is available only in xlrd 0.7.2 (SVN).

Note

if Mark Hammonds’ pywin32 package is not available, the xls_text parameter will almost surely not be the WYSIWYG representation of the cell text.

Note

If Mark Hammonds’ pywin32 package is not available, the xls_comment parameter will always be None.



GetAttr(self)

Returns the attribute to use for this specific cell.

Returns:an instance of grid.GridCellAttr.


GetComment(self)

Returns the cell comment, if any.

Returns:an instance of XLSComment.

Note

If Mark Hammonds’ pywin32 package is not available, this method always returns None.



GetValue(self)

Returns the actual WYSIWYG representation of the cell value.



SetCellSize(self, rows, cols)

Sets the size of the cell.

Specifying a value of more than 1 in rows or cols will make the cell at (row, col) span the block of the specified size, covering the other cells which would be normally shown in it. Passing 1 for both arguments resets the cell to normal appearance.

Parameters:
  • rows – number of rows to be occupied by this cell, must be >= 1;
  • cols – number of columns to be occupied by this cell, must be >= 1.


SetupCell(self, book, cell, xf_index, xls_text, xls_comment, hyperlink, rich_text, default_width, default_colour)

Actually sets up the XLSCell class. This is an auxiliary method to avoid cluttering the __init__ method.

Parameters:
  • book – an instance of the xlrd.Book class;
  • cell – an instance of xlrd.sheet.Cell class;
  • xf_index – an index into xlrd.Book.xf_list, which holds a reference to the xlrd.sheet.Cell class (the actual cell for xlrd);
  • xls_text – the actual WYSIWYG cell text, if available;
  • xls_comment – the cell comment (note), if any;
  • hyperlink – an instance of xlrd.sheet.hyperlink;
  • rich_text – if this cell contains text in rich text format, XLSGrid will do its best to render the text as rich text;
  • default_width – this is the default width of the text in 1/256 of the width of the zero character, using default Excel font (first FONT record in the Excel file);
  • default_colour – the “magic” colour used by Excel to draw non-custom border lines.

Note

If you are using version 0.7.1 or lower for xlrd, the hyperlink parameter will always be None as this feature is available only in xlrd 0.7.2 (SVN).

Note

If you are using version 0.7.1 or lower for xlrd, the rich_text parameter will always be None as this feature is available only in xlrd 0.7.2 (SVN).

Note

if Mark Hammonds’ pywin32 package is not available, the xls_text parameter will almost surely not be the WYSIWYG representation of the cell text.

Note

If Mark Hammonds’ pywin32 package is not available, the xls_comment parameter will always be None.



SetValue(self, value)

Sets the actual WYSIWYG representation of the cell value.

Parameters:value – the current text value to insert in the cell.

Note

This method is currently unused as everything is handled inside the XLSText class.

See also

GetValue