Item9132: Enhance to allow multiple tables
Priority: Enhancement
Current State: New
Released In:
Target Release: n/a
As reported
here (an email thread I guess), the plugin is hobbled by being able to work with only one table. The original reporter has enhanced the plugin (diffs in the thread) to support multiple tables.
Currently only a single table can be exported from within a topic: the
first one after the first '%TABLE2EXCEL{}%' macro.
If other '%TABLE2EXCEL{}%' macros are added they also export the same table.
I changed this to allow any number of tables within a topic to be
exported. To achieve this I added the new parameter 'number'.
This parameter provides the plugin with the information where to start
looking for the table: after macro number 'number'.
Currently it is just looked for the first occurence of the string
'table2excel' and then the next table is exported. In my patched version
the number of occurences of the 'table2excel' string is counted and only
when it matches 'number' the first table after that is exported. Default
number is '1'.
Example:
%TABLE2EXCEL{number="1"...}%
...table 1...
%TABLE2EXCEL{number="2"...}%
...table 2...
%TABLE2EXCEL{number="3"...}%
...table 3...
I added another parameter 'label' to customize the label of the export
button and set the default text to:
Export the table below in Excel format
I also added the same parameter 'label' to the 'excel2table' macro for
customizing the text describing the data source for the automatically
generated table. And I expanded the default text to the following to
assist non-expert wiki users:
The table above was generated automatically from the attached file
'example.xls' and cannot be edited directly.
Update the attached
file to update the table.
The filename can be added (several times) as the variable '${file}' into
the label text. (The braces are added to enhance parsing security,
adapted from Perl.)
All the credit should go to the original reporter. I'm just putting this here for tracking.
--
BigBaaadBob - 09 Jun 2010