1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205
|
.. wxPython Phoenix documentation
This file was generated by Phoenix's sphinx generator and associated
tools, do not edit by hand.
Copyright: (c) 2011-2018 by Total Control Software
License: wxWindows License
.. include:: headings.inc
.. currentmodule:: wx.lib.agw.xlsgrid
.. highlight:: python
.. _wx.lib.agw.xlsgrid.XLSGrid:
==========================================================================================================================================
|phoenix_title| **wx.lib.agw.xlsgrid.XLSGrid**
==========================================================================================================================================
:class:`XLSGrid` is a class based on :class:`grid.Grid` that can be used to faithfully
reproduce the appearance of a Microsoft Excel spreadsheet (one worksheet per
every instance of :class:`XLSGrid`).
:class:`XLSGrid` is a completely owner-drawn control, and it relies on the power of
:class:`grid.PyGridTableBase` and :class:`grid.PyGridCellRenderer` to draw the cell
content. For this reasons (and for some others, see the TODOs section), it will
work efficiently only for relatively small Excel files.
|
|class_hierarchy| Class Hierarchy
=================================
.. raw:: html
<div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
<img id="toggleBlock-trigger" src="_static/images/closed.png"/>
Inheritance diagram for class <strong>XLSGrid</strong>:
</div>
<div id="toggleBlock-summary" style="display:block;"></div>
<div id="toggleBlock-content" style="display:none;">
<p class="graphviz">
<center><img src="_static/images/inheritance/wx.lib.agw.xlsgrid.XLSGrid_inheritance.png" alt="Inheritance diagram of XLSGrid" usemap="#dummy" class="inheritance"/></center>
</div>
<script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
<map id="dummy" name="dummy"> <area shape="rect" id="node8" href="wx.lib.agw.xlsgrid.XLSGrid.html" title="wx.lib.agw.xlsgrid.XLSGrid" alt="" coords="22,547,204,576"/> <area shape="rect" id="node2" href="wx.ScrolledWindow.html" title="wx.ScrolledWindow" alt="" coords="43,392,183,421"/> <area shape="rect" id="node3" href="wx.Trackable.html" title="wx.Trackable" alt="" coords="5,5,107,35"/> <area shape="rect" id="node4" href="wx.EvtHandler.html" title="wx.EvtHandler" alt="" coords="57,83,168,112"/> <area shape="rect" id="node6" href="wx.WindowBase.html" title="wx.WindowBase" alt="" coords="53,160,173,189"/> <area shape="rect" id="node5" href="wx.Object.html" title="wx.Object" alt="" coords="131,5,212,35"/> <area shape="rect" id="node7" href="wx.Window.html" title="wx.Window" alt="" coords="69,237,157,267"/> </map>
</p>
|
|appearance| Control Appearance
===============================
|
.. figure:: _static/images/widgets/fullsize/wxmsw/wx.lib.agw.xlsgrid.xlsgrid.png
:alt: wxMSW
:figclass: floatleft
**wxMSW**
.. figure:: _static/images/widgets/fullsize/wxmac/../no_appearance.png
:alt: wxMAC
:figclass: floatright
**wxMAC**
.. figure:: _static/images/widgets/fullsize/wxgtk/../no_appearance.png
:alt: wxGTK
:figclass: floatcenter
**wxGTK**
|
|super_classes| Known Superclasses
==================================
:class:`wx.grid.Grid`
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.lib.agw.xlsgrid.XLSGrid.__init__` Default class constructor.
:meth:`~wx.lib.agw.xlsgrid.XLSGrid.DestroyTip` If a comment window or a tooltip over a hyperlink have been created, this
:meth:`~wx.lib.agw.xlsgrid.XLSGrid.FormatCell` Processes the creation of a single cell (an instance of :class:`XLSCell`).
:meth:`~wx.lib.agw.xlsgrid.XLSGrid.GetDefaultFontData` Returns suitable width and height (in pixels) starting from Excel's own
:meth:`~wx.lib.agw.xlsgrid.XLSGrid.InstallGridHint` Auxiliary method used to bind a ``wx.EVT_MOTION`` event to :class:`XLSGrid`.
:meth:`~wx.lib.agw.xlsgrid.XLSGrid.PopulateGrid` This is the main method of this class, and it is used to actually create
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: XLSGrid(gridlib.Grid)
:class:`XLSGrid` is a class based on :class:`grid.Grid` that can be used to faithfully
reproduce the appearance of a Microsoft Excel spreadsheet (one worksheet per
every instance of :class:`XLSGrid`).
:class:`XLSGrid` is a completely owner-drawn control, and it relies on the power of
:class:`grid.PyGridTableBase` and :class:`grid.PyGridCellRenderer` to draw the cell
content. For this reasons (and for some others, see the TODOs section), it will
work efficiently only for relatively small Excel files.
.. method:: __init__(self, parent)
Default class constructor.
:param `parent`: the grid parent window. Must not be ``None``.
.. method:: DestroyTip(self)
If a comment window or a tooltip over a hyperlink have been created, this
method destroys them.
.. method:: FormatCell(self, book, sheet, row, col, display_texts, comments, hyperlink, rich_text, default_width, default_colour)
Processes the creation of a single cell (an instance of :class:`XLSCell`).
:param `book`: an instance of the `xlrd.Book` class;
:param `sheet`: an instance of the `xlrd.sheet` class;
:param `row`: the row in which this cell lives;
:param `col`: the column in which this cell lives;
: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;
:param `hyperlink`: if this cell contains a hyperlink, it will be displayed
accordingly;
:param `rich_text`: if this cell contains text in rich text format, :class:`XLSGrid`
will do its best to render the text as rich text;
:param `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);
:param `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 `display_texts`
and `comments` parameter will be two empty nested lists.
.. method:: GetDefaultFontData(self, book)
Returns suitable width and height (in pixels) starting from Excel's own
measurements (in characters, whatever that means).
:param `book`: an instance of the `xlrd.Book` class.
:returns: a `default_width` and `default_height` in pixels, based on 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).
.. method:: InstallGridHint(self)
Auxiliary method used to bind a ``wx.EVT_MOTION`` event to :class:`XLSGrid`.
.. method:: 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.
|