[reportlab-users] Spreadsheet Table
Tomasz Świderski
contact at tomaszswiderski.com
Thu Feb 18 10:43:57 EST 2010
Hello,
as promised in
http://two.pairlist.net/pipermail/reportlab-users/2010-February/009312.html
I am introducing Spreadsheet Table. It's based of platypus/tables.py and
have exacly the same properties. It passes all old_tables_tests.
In addition to reportlab 2.4 Table functionalities it can:
- repeat rows from below
- calculate formulas on runtime.
Each formula is subclass of Formula class. It has _evaluate method with
definition:
def _evaluate(self, data, repeat_rows, repeat_rows_b, active_rows,
cell_coord):
data - all data passed to Table on creation time
repeat_rows, repeat_rows_b - how many rows are repeated on top, bottom
of Table
active_rows - tuple containing range of visible rows
cell_coord - tuple containing col, row position of evaluated formula
This information is enough to calculate sum of column values from
current page, certain range of data (not necessarily one row or column) etc.
I didn't have much time so I implemented only two formulas for demo
needs. I believe it is possible to emulate all spreadsheet formulas with
it. It should be no problem to write formula for time addition etc.
Since Formula class have access to it's cell style - you can change
colors depending of cell value, for example black font for positive and
red for negative numbers.
I'm looking forward to any comments about this Spreadsheet implementation.
Best regards,
Tomasz Świderski
-------------- next part --------------
A non-text attachment was scrubbed...
Name: spreadsheettables.py
Type: text/x-python
Size: 67957 bytes
Desc: not available
Url : <http://two.pairlist.net/pipermail/reportlab-users/attachments/20100218/f6872d2f/attachment-0001.py>
More information about the reportlab-users
mailing list