File: wx.lib.agw.xlsgrid.XLSText.txt

package info (click to toggle)
wxpython4.0 4.0.4%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 211,112 kB
  • sloc: cpp: 888,355; python: 223,130; makefile: 52,087; ansic: 45,780; sh: 3,012; xml: 1,534; perl: 264
file content (219 lines) | stat: -rw-r--r-- 9,028 bytes parent folder | download
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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
.. 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.XLSText:

==========================================================================================================================================
|phoenix_title|  **wx.lib.agw.xlsgrid.XLSText**
==========================================================================================================================================

This is a class which holds information about the cell content, in terms
of actual cell value, font, text colour, alignment and formatting.



|

|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>XLSText</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.XLSText_inheritance.png" alt="Inheritance diagram of XLSText" usemap="#dummy" class="inheritance"/></center>
   </div>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.lib.agw.xlsgrid.XLSText.html" title="wx.lib.agw.xlsgrid.XLSText" alt="" coords="5,5,187,35"/> </map> 
   </p>

|


|sub_classes| Known Subclasses
==============================

:class:`wx.lib.agw.xlsgrid.XLSRichText`

|


|method_summary| Methods Summary
================================

================================================================================ ================================================================================
:meth:`~wx.lib.agw.xlsgrid.XLSText.__init__`                                     Default class constructor.
:meth:`~wx.lib.agw.xlsgrid.XLSText.CombineAttr`                                  Combines the input attribute `attr` with the features of the :class:`XLSText` class.
:meth:`~wx.lib.agw.xlsgrid.XLSText.CreateAlignment`                              Creates a suitable wxPython alignment flag for the text starting from a
:meth:`~wx.lib.agw.xlsgrid.XLSText.CreateFont`                                   Creates a suitable wxPython font starting from an Excel font.
:meth:`~wx.lib.agw.xlsgrid.XLSText.CreateFormat`                                 This method tries to guess the best format to apply to the current text
:meth:`~wx.lib.agw.xlsgrid.XLSText.CreateTextColour`                             Creates a suitable wxPython colour for the text starting from a `xlrd`
:meth:`~wx.lib.agw.xlsgrid.XLSText.Draw`                                         Actually draws the text value on a grid cell.
:meth:`~wx.lib.agw.xlsgrid.XLSText.FormatString`                                 This method tries to guess the best format to apply to the current text
:meth:`~wx.lib.agw.xlsgrid.XLSText.GetValue`                                     Returns the string representation of the cell text value.
:meth:`~wx.lib.agw.xlsgrid.XLSText.IsHyperLink`                                  Returns whether the cell text is representing a hyperlink.
:meth:`~wx.lib.agw.xlsgrid.XLSText.SetupHyperlink`                               Sets up the cell text value in case it represents a hyperlink.
================================================================================ ================================================================================


|


|api| Class API
===============


.. class:: XLSText(object)

   This is a class which holds information about the cell content, in terms
   of actual cell value, font, text colour, alignment and formatting.

   .. method:: __init__(self, book, cell, xf_index, display_text=None, hyperlink=None, default_width=10)

      Default class constructor.
      
      :param `book`: an instance of the `xlrd.Book` class;
      :param `cell`: an instance of `xlrd.sheet.Cell` class;
      :param `xf_index`: an index into `xlrd.Book.xf_list`, which holds a
       reference to the `xlrd.sheet.Cell` class (the actual cell for `xlrd`);
      :param `display_text`: if Mark Hammonds' `pywin32` package is available,
       this is the WYSIWYG cell content;
      :param `hyperlink`: if this cell contains a hyperlink, it will be displayed
       accordingly;
      :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).
      
      :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).


   .. method:: CombineAttr(self, attr)

      Combines the input attribute `attr` with the features of the :class:`XLSText` class.
      
      :param `attr`: an instance of :class:`grid.GridCellAttr`.


   .. method:: CreateAlignment(self, alignment, default_width)

      Creates a suitable wxPython alignment flag for the text starting from a
      `xlrd` class representing this alignment.
      
      :param `alignment`: an instance of `xlrd.formatting.XFAlignment` class;
      :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).


   .. method:: CreateFont(self, font)

      Creates a suitable wxPython font starting from an Excel font.
      
      :param `font`: an instance of `xlrd.formatting.Font` class.
      
      :note: There is currently no support for strikethrough fonts, although
       `xlrd` correctly reports this format. The issue is a bug in wxWidgets
       itself which doesn't allow the creation of strikethrough fonts. See
       (http://trac.wxwidgets.org/ticket/9907).


   .. method:: CreateFormat(self, format, cell, datemode)

      This method tries to guess the best format to apply to the current text
      value.
      
      :param `format`: an instance of `xlrd.formatting.Format` class;
      :param `cell`: an instance of `xlrd.sheet.Cell` class;
      :param `datemode`: the datemode associated with this Excel workbook.
      
      :note: This method is used only if Mark Hammonds' `pywin32` package is
       not available to try and format the cell text in an intelligent way.
      
      .. warning::
      
         The formatting applied by this method is severely limited; for
         instance, you won't probably get the exact WYSIWYG between the Excel
         spreadsheet and :class:`XLSGrid`.


   .. method:: CreateTextColour(self, text_colour)

      Creates a suitable wxPython colour for the text starting from a `xlrd`
      tuple representing this colour.
      
      :param `text_colour`: a tuple representing the RGB components of the
       colour. If `text_colour` is ``None``, use the default ``wx.SYS_COLOUR_WINDOWTEXT``.


   .. method:: Draw(self, dc, rect)

      Actually draws the text value on a grid cell.
      
      :param `dc`: an instance of :class:`wx.DC`;
      :param `rect`: an instance of :class:`wx.Rect`, representing the cell rectangle.


   .. method:: FormatString(self, value, isDate, format_str)

      This method tries to guess the best format to apply to the current text
      value.
      
      :param `value`: the actual raw cell text value;
      :param `isDate`: ``True`` if this value represents a `xlrd` date object,
       ``False`` otherwise;
      :param `format_str`: the actual formatting string as extracted from Excel.
      
      :note: This method is used only if Mark Hammonds' `pywin32` package is
       not available to try and format the cell text in an intelligent way.
      
      .. warning::
      
         The formatting applied by this method is severely limited; for
         instance, you won't probably get the exact WYSIWYG between the Excel
         spreadsheet and :class:`XLSGrid`.


   .. method:: GetValue(self)

      Returns the string representation of the cell text value. 


   .. method:: IsHyperLink(self)

      Returns whether the cell text is representing a hyperlink.
      
      :returns: ``True`` if the cell text represents a hyperlink, ``False``
       otherwise.


   .. method:: SetupHyperlink(self, hyperlink)

      Sets up the cell text value in case it represents a hyperlink.
      
      :param `hyperlink`: an instance of `xlrd.sheet.hyperlink`.
      
      :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).