ExcelExporter with ZK 8.6.0

asked 2018-12-12 16:05:16 +0800

Ignis11 gravatar image Ignis11
11 1


I try to use ExcelExporter from leeyt github project based on samchuang github project. (It is the most updated excelexporter that I found on the forum) After compile exporter with zkcommons updated to 8.6 and zpoi to 3.9.7. To fix several issues..

I tried to export a listbox to excel.

With a paging listbox I suffered and exception: java.lang.IllegalArgumentException: <meshelement$internalpaging i9ovr7=""> cannot find tagret (MeshElement) at org.zkoss.exporter.util.Utils.getTarget(Utils.java:39) at org.zkoss.exporter.excel.ExcelExporter.exportCells(ExcelExporter.java:240) at org.zkoss.exporter.excel.ExcelExporter.exportCells(ExcelExporter.java:1) at org.zkoss.exporter.AbstractExporter.exportRows(AbstractExporter.java:207) at org.zkoss.exporter.excel.ExcelExporter.exportTabularComponent(ExcelExporter.java:142) at org.zkoss.exporter.AbstractExporter.export(AbstractExporter.java:237) When I disabled paging mold I can export to excel but only Listhead is export to excel.

What is the best way to export zk grid, listbox or tree to excel in ZK 8.6??

Anybody can help me to update exporter to 8.6?

Thanks in advance.

delete flag offensive retag edit

1 Answer

Sort by » oldest newest most voted

answered 2018-12-13 15:54:19 +0800

MDuchemin gravatar image MDuchemin
2490 1 6
ZK Team

Hi Ignis11,

Some components structures have changed since the original exporter example. Since it's not an official ZK tool, it's not actively upgraded with the mainline releases.

It's possible to get it running under ZK 8.6, but it requires rewriting some of the export crawl logic.

For example, the org.zkoss.exporter.util.Utils.getHeaderSize(Component) is outdated and will return 0 if you don't have header (since the structure is grid > rows > row, not grid > row). That's not the only place to update, but it should give you an idea of the kind of changes required.

Most methods in the original exporter that are based on component structures need to be updated to match the current component hierarchy.

There is also other factors to consider (such as paging, render on demand, etc...). Since the exporter is based on the mesh component structure (the displayed grid or listbox), it doesn't account for entries in the model that are not currently displayed. There are also ways around this using event sequences, but it's too long for a forum thread.

Bottom line: the actual update to make the exporter run on 8.6 will heavily depends on your project setup and on the use case for the exporter. I'd recommend you contact ZK support for easier communication

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools




Asked: 2018-12-12 16:05:16 +0800

Seen: 23 times

Last updated: Dec 13 '18

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More