Opened 2 years ago

Closed 2 years ago

#2160 closed task (fixed)

Table exporter should support exporting to Excel files

Reported by: Nicklas Nordborg Owned by: everyone
Priority: major Milestone: BASE 3.15
Component: web Version:
Keywords: Cc:

Description

This has been tested in Reggie http://baseplugins.thep.lu.se/ticket/1110 and it would be nice if the "Table exporter" also could create Excel files.

In principle it should not be very hard since the code is already written in a way that makes this possible. One issue is that the export is purely string-based (via implicit or explict Formatter:s). If we export to Excel we probably want to keep number as numbers, dates as dates, etc. Though in some cases we still want some kind of transformation. For example, plate coordinates are stored 0-based in BASE and are using a formatter when exporting. For example [0,0] (numeric) is exported as [A,1] (strings).

Change History (9)

comment:1 Changed 2 years ago by Nicklas Nordborg

In 7644:

References #2160: Table exporter should support exporting to Excel files

Added Apache POI and other requried JAR files to the project.

comment:2 Changed 2 years ago by Nicklas Nordborg

In 7645:

References #2160: Table exporter should support exporting to Excel files

Implemented exporter to Excel file. It will currently write all values as text values.

comment:3 Changed 2 years ago by Nicklas Nordborg

In 7646:

References #2160: Table exporter should support exporting to Excel files

Started to implement a way for regular formatters to apply their style to Excel cells as well.

It is based on the new interface ExcelFormatter which defines a single method that return a ExcelValue object. There are a currently a few static helper method for creating date cells (and string/empty cell but those are trivial). One issue is that there are some minor differences in the format templates between Java/Excel?, but there is a converter in Apache POI that I hope works.

It has been tested with the table exporter should work with regular property columns and single-valued annotations so far.

comment:4 Changed 2 years ago by Nicklas Nordborg

In 7647:

References #2160: Table exporter should support exporting to Excel files

Added support for numeric values.

comment:5 Changed 2 years ago by Nicklas Nordborg

In 7648:

References #2160: Table exporter should support exporting to Excel files

Added Excel support to well coordinates and string that are normally encoded for use with HTML that no longer need to be escaped for HTML-unsafe characters.

comment:6 Changed 2 years ago by Nicklas Nordborg

In 7649:

References #2160: Table exporter should support exporting to Excel files

Added support for Excel to the MultiFormatter and BooleanFormatter.

comment:7 Changed 2 years ago by Nicklas Nordborg

In 7650:

References #2160: Table exporter should support exporting to Excel files

Implemented possibility for table listings to specify a formatter for Excel that is independent of the regular formatter. Just as a regular formatter can be specified by setting the context variable ItemContext.setObject("export.formatter.<property>", formatter) an Excel formatter can be specificed by setting ItemContext?.setObject("export.excelFormatter.<property>", excelFormatter) where <property>` is the name of the exported property.

comment:8 Changed 2 years ago by Nicklas Nordborg

In 7651:

References #2160: Table exporter should support exporting to Excel files

Better handling of collections, multi-valued annotations and annotations with units.

comment:9 Changed 2 years ago by Nicklas Nordborg

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.