LiveTableExcelExport Macro

Last modified by Anca Luca on 2023/01/30 00:16

page_white_excelAdd an Excel export button to a livetable.
TypeXAR
CategoryMacro
Developed by

Guillaume Delhumeau, Ludovic Dubost, Anca Luca, slauriere

Active Installs50
Rating
0 Votes
LicenseGNU Lesser General Public License 2.1

Installable with the Extension Manager

Description

This macro has been obsoleted by the livetable exporter macro.

Adds a button to the LiveTable as shown on the following screenshot:

Selection_024.png

Selection_025.png

Usage

Just write:

{{addExcelExportToLivetable livetable="my-livetable" /}}

Where my-livetable is your Livetable's name.

Currently, this macro does not work with livetables that use custom JSON results page, except for livetables generated by AppWithinMinutes.

Parameters

NameOptionalAllowed valuesDefault valueDescription
withPageNameyestrue/falsetrueadds a 'wiki page name' to the excel sheet
withPageURLyestrue/falsetrueadds a 'wiki page URL' to the excel sheet
withAllFieldsyestrue/falsefalseforces the display of all the fields of the class in the exported excel (regardless of the columns displayed in the livetable)
filenameyesany stringlivetableallows to configure the name of the exported filename

Note on the scalability

Note that this tool exports all the results from the livetable, while upon display on screen the results are paginated. Because of this, the time it takes will depend on the number of entries you have in total in your livetable. Depending on your application server settings, you might have a server (the servlet container or another http server in front - like apache) return an Internal server error before the export is done and thus the export will not work. However, the performance depends on so many factors related to the server setup and the data exported, that is is almost impossible to give generic number that would make sense.

Prerequisites & Installation Instructions

We recommend using the Extension Manager to install this extension (Make sure that the text "Installable with the Extension Manager" is displayed at the top right location on this page to know if this extension can be installed with the Extension Manager). Note that installing Extensions when being offline is currently not supported and you'd need to use some complex manual method.

You can also use the following manual method, which is useful if this extension cannot be installed with the Extension Manager or if you're using an old version of XWiki that doesn't have the Extension Manager:

  1. Log in the wiki with a user having Administration rights
  2. Go to the Administration page and select the Import category
  3. Follow the on-screen instructions to upload the downloaded XAR
  4. Click on the uploaded XAR and follow the instructions
  5. You'll also need to install all dependent Extensions that are not already installed in your wiki

You need the Excel Plugin to be installed. Make sure to add the Excel Plugin to "List of active plugins" from your WEB-INF/xwiki.cfg file. 

Make sure that pages Macros.AddExcelExportToLivetableMacro and Macros.AddExcelExportToLivetableMacroGroovy are saved with a user that have the Programming Rights.

Troubleshooting

For old wikis, the macro may not work. If you have the issue, please edit the page "Macros.AddExcelExportToLivetableMacro" with the object editor, find the object "WikiMacroClass 0: Add Excel export to Livetable", and remove the following line from the object content:
var livetable = window.livetable_$xcontext.macro.params.livetable;

Release Notes

v2.0

This release comes with a full revamping of the strategy to get the livetable results: it now uses the livetable macros to get the results and re-serializes as Excel.
The values sent in the excel are the display values from the livetable, and if the display value contains html the exported value will be the raw value.
Also, the minimum version was bumped to 5.4.7.

Full list under:

  • [XALTXLS-13] - Excel export button doesn't appear when the livetable name contains special chars
  • [XALTXLS-15] - Allow to control the exported file name with a parameter passed to the macro
  • [XALTXLS-12] - Refactor this extension to reuse the livetable macros instead of duplicating them
  • [XALTXLS-14] - On recent versions of XWiki (8.4.x) the export button is displayed in a confusing place in the livetable

v1.8.1

  • Now is is compatible with application created with AppWithinMinutes in XWiki >= 4.5.3 (See: XALTXLS-2).

v1.8

  • Use the same translations keys than the livetable for the columns names.
  • Export dates with the 'Date' excel format. This might be a regression.

v1.7.1

The dependencies are fixed.

v1.7

  • Added parameter to allow forcing the display of all the fields of the class in the export, regardless of the columns configured in the livetable (withAllFields)
  • Added required rights to the documents that need programming rights
  • Polished the formatting of the values for the export: in general they are exported as returned by the respective display functions for the respective fields, with the exception of boolean values which are exported as 1 or 0 and the textarea fields which are rendered as plain text when exported. This can be a backwards compatibility issue as some values are displayed differently now.

v1.6

  • Clean HTML tags for custom fields before display.
    • Now needs Programing Rights to install 

Dependencies

Dependencies for this extension (org.xwiki.contrib:xwiki-livetable-excel-export-macro 4.0.1):

Get Connected