Issue when try Export to Excel

Hi Guys,
I have a issue when use de default action to export grids to Excel.
The project is version 7.2.20
The error log is:
Caused by: java.lang.NoSuchMethodError: org.apache.poi.ss.usermodel.Font.getIndex()S
at com.haulmont.cuba.gui.export.ExcelAutoColumnSizer.getFontMetrics(ExcelAutoColumnSizer.java:50) ~[cuba-gui-7.2.20.jar:7.2.20]
at com.haulmont.cuba.gui.export.ExcelAutoColumnSizer.notifyCellValue(ExcelAutoColumnSizer.java:109) ~[cuba-gui-7.2.20.jar:7.2.20]
at com.haulmont.cuba.gui.export.ExcelExporter.exportTable(ExcelExporter.java:218) ~[cuba-gui-7.2.20.jar:7.2.20]
at com.haulmont.cuba.gui.actions.list.ExcelAction.export(ExcelAction.java:198) ~[cuba-gui-7.2.20.jar:7.2.20]
at com.haulmont.cuba.gui.actions.list.ExcelAction.execute(ExcelAction.java:112) ~[cuba-gui-7.2.20.jar:7.2.20]
at com.haulmont.cuba.gui.actions.list.ExcelAction.actionPerform(ExcelAction.java:96) ~[cuba-gui-7.2.20.jar:7.2.20]
at com.haulmont.cuba.web.gui.components.WebButton.buttonClicked(WebButton.java:67) ~[cuba-web-7.2.20.jar:7.2.20]
at com.haulmont.cuba.web.widgets.CubaButton.fireClick(CubaButton.java:76) ~[cuba-web-widgets-7.2.20.jar:na]
at com.vaadin.ui.Button$1.click(Button.java:57) ~[vaadin-server-8.14.3-1-cuba.jar:8.14.3-1-cuba]
… 43 common frames omitted
Thanks,
João Gomes

Hi,

Is this happening on your local machine or are you building a docker image?

Gleb

Hi, Gleb
happens when run from Studio and when deployed in TomCat installation.

Regards,
João Gomes

Unfortunately, I cannot reproduce the issue. CUBA 7.2.20 depends on apache poi 4.1 and the mentioned method is available in that version, but marked as for removal in version 4.2. Please check what version of apache poi is used in your project. Probably some dependency updates it.

Regards,
Gleb

Hi Gleb,
Thanks for your support.
I’m a quite noob, can you tell where I can check this versions.

Thanks,
João Gomes

IntelliJ IDEA provides Analyze Dependencies action in the Gradle panel:

In the opened tab, select web module and search for poi

You’ll find version and usages.

Hi,
Seems to me i have de same version of poi.
There is any way to clean all dependencies and re-import them?

Regards,
João Gomes

Could you please attach a demo project that reproduces the issue?

Gleb

Hi Gleb, I accidentally solved the issue. I used the Studio’s function to create a projet ZIP and then I test de Project from ZIP I verify the export is already work.
I don’t understood what cause this issue but is working.

Thanks for your support.
Have a nice weekend.

João Gomes

1 Like