flowingcode / gridexporteraddon Goto Github PK
View Code? Open in Web Editor NEWLicense: Other
License: Other
Using the gridExporter (https://vaadin.com/directory/component/grid-exporter-add-on ) in V24 , when you try to export a PDF you get the following error:
Exception in thread "Thread-21" java.lang.NoClassDefFoundError: javax/xml/bind/ValidationEventHandler
at com.flowingcode.vaadin.addons.gridexporter.PdfInputStreamFactory$1.run(PdfInputStreamFactory.java:64)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.ValidationEventHandler
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
... 2 more
I have an application with several views, all of them containing a Grid. Navigating between the views gives the following exception when I navigate to a certain grid for the second time.
java.lang.IllegalArgumentException: Cannot join cells that are not adjacent
at com.vaadin.flow.component.grid.AbstractRow.lambda$join$6(AbstractRow.java:276) ~[vaadin-grid-flow-23.1.3.jar:na]
at java.base/java.util.stream.Streams$RangeIntSpliterator.forEachRemaining(Streams.java:104) ~[na:na]
at java.base/java.util.stream.IntPipeline$Head.forEach(IntPipeline.java:617) ~[na:na]
at com.vaadin.flow.component.grid.AbstractRow.join(AbstractRow.java:274) ~[vaadin-grid-flow-23.1.3.jar:na]
at com.vaadin.flow.component.grid.FooterRow.join(FooterRow.java:76) ~[vaadin-grid-flow-23.1.3.jar:na]
at com.vaadin.flow.component.grid.FooterRow.join(FooterRow.java:30) ~[vaadin-grid-flow-23.1.3.jar:na]
at com.vaadin.flow.component.grid.AbstractRow.join(AbstractRow.java:201) ~[vaadin-grid-flow-23.1.3.jar:na]
at com.vaadin.flow.component.grid.FooterRow.join(FooterRow.java:30) ~[vaadin-grid-flow-23.1.3.jar:na]
at com.flowingcode.vaadin.addons.gridhelpers.FooterToolbarGridHelper.setFooterToolbar(FooterToolbarGridHelper.java:24) ~[grid-helpers-0.2.0.jar:0.2.0]
at com.flowingcode.vaadin.addons.gridhelpers.GridHelper.addToolbarFooter(GridHelper.java:295) ~[grid-helpers-0.2.0.jar:0.2.0]
at com.flowingcode.vaadin.addons.gridexporter.GridExporter.lambda$createFor$afa35fd0$1(GridExporter.java:102) ~[grid-exporter-addon-1.0.1.jar:1.0.1]
It would be great to support auto width in excel columns
I would like to propose an enhancement.
It would be nice to have the export buttons combined with components in the toolbar generated by GridHelper.addToolbarFooter(). At the moment it is one or the other.
I think that would be easy if a third createFor static method on GridExporter is added that takes the Component provided to addToolbarFooter as an input, and adds the Anchors on that i.s.o the HorizontalLayout used now. After the createFor I can add the input Component (now with the export anchors) in the footer by calling GridHelper.addToolbarFooter() in my code.
Thanks in advance.
If the template does not contain the ${title} placeholder, a NPE is thrown here because the title cell is not found.
The users may want to configure the title directly in the template, instead via code.
As explained in https://stackoverflow.com/a/74380144/1297272, component headers are exported as empty strings (because GridHelpers only retrieves string headers)
Grid<String> grid = new Grid<>();
Column<String> col1 = grid.addColumn(x -> x).setHeader("Has text header");
Column<String> col2 = grid.addColumn(x -> x).setHeader(new Span("Text header"));
System.out.println(GridHelper.getHeader(grid, col1));
System.out.println(GridHelper.getHeader(grid, col2)); //prints an empty string
Implement a feature that allows setting custom headers/footers for GridExport.
Also, consider defaulting component headers to column.getHeaderComponent().getElement().getTextRecursively()
if Vaadin version is 23.2+ (for now, use reflection since 23.1 has to be supported)
Error: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project grid-exporter-addon: Compilation failure:
Error: /src/main/java/com/flowingcode/vaadin/addons/gridexporter/GridExporter.java:[196,12] cannot find symbol
Error: symbol: method getValueProviders()
Error: location: variable r of type com.vaadin.flow.data.renderer.Renderer<T>
Dependency error-window-vaadin must be upgraded to 3.4.0. See FlowingCode/ErrorWindowAddon#50.
Lines 175 to 180 in a0f9363
I've just upgraded the demos to 24.2.0.alpha2 and export fails with
(excel)
java.lang.ClassNotFoundException: org.apache.commons.io.output.UnsynchronizedByteArrayOutputStream
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445) ~[na:na]
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:587) ~[na:na]
at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:149) ~[app.jar:1.0.0-SNAPSHOT]
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[na:na]
at org.apache.poi.poifs.filesystem.FileMagic.valueOf(FileMagic.java:209) ~[poi-5.2.3.jar!/:5.2.3]
at org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:222) ~[poi-5.2.3.jar!/:5.2.3]
at org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:185) ~[poi-5.2.3.jar!/:5.2.3]
at com.flowingcode.vaadin.addons.gridexporter.ExcelInputStreamFactory.getBaseTemplateWorkbook(ExcelInputStreamFactory.java:289) ~[grid-exporter-addon-2.0.0-SNAPSHOT.jar!/:2.0.0-SNAPSHOT]
at com.flowingcode.vaadin.addons.gridexporter.ExcelInputStreamFactory.createInputStream(ExcelInputStreamFactory.java:79) ~[grid-exporter-addon-2.0.0-SNAPSHOT.jar!/:2.0.0-SNAPSHOT]
at com.vaadin.flow.server.StreamResource$Pipe.createInputStream(StreamResource.java:99) ~[flow-server-24.2.0.alpha2.jar!/:24.2.0.alpha2]
at com.vaadin.flow.server.StreamResource$Pipe.accept(StreamResource.java:83) ~[flow-server-24.2.0.alpha2.jar!/:24.2.0.alpha2]
at com.vaadin.flow.server.communication.StreamResourceHandler.handleRequest(StreamResourceHandler.java:86) ~[flow-server-24.2.0.alpha2.jar!/:24.2.0.alpha2]
at com.vaadin.flow.server.communication.StreamRequestHandler.handleRequest(StreamRequestHandler.java:110) ~[flow-server-24.2.0.alpha2.jar!/:24.2.0.alpha2]
at com.vaadin.flow.server.VaadinService.handleRequest(VaadinService.java:1529) ~[flow-server-24.2.0.alpha2.jar!/:24.2.0.alpha2]
at com.vaadin.flow.server.VaadinServlet.service(VaadinServlet.java:398) ~[flow-server-24.2.0.alpha2.jar!/:24.2.0.alpha2]
at com.vaadin.flow.spring.SpringServlet.service(SpringServlet.java:106) ~[vaadin-spring-24.2.0.alpha2.jar!/:na]
java.lang.ClassNotFoundException: org.apache.commons.io.output.UnsynchronizedByteArrayOutputStream
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445) ~[na:na]
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:587) ~[na:na]
at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:149) ~[app.jar:1.0.0-SNAPSHOT]
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[na:na]
at com.flowingcode.vaadin.addons.gridexporter.DocxInputStreamFactory.getBaseTemplateDoc(DocxInputStreamFactory.java:383) ~[grid-exporter-addon-2.0.0-SNAPSHOT.jar!/:2.0.0-SNAPSHOT]
at com.flowingcode.vaadin.addons.gridexporter.DocxInputStreamFactory.createDoc(DocxInputStreamFactory.java:106) ~[grid-exporter-addon-2.0.0-SNAPSHOT.jar!/:2.0.0-SNAPSHOT]
at com.flowingcode.vaadin.addons.gridexporter.PdfInputStreamFactory.createInputStream(PdfInputStreamFactory.java:53) ~[grid-exporter-addon-2.0.0-SNAPSHOT.jar!/:2.0.0-SNAPSHOT]
at com.vaadin.flow.server.StreamResource$Pipe.createInputStream(StreamResource.java:99) ~[flow-server-24.2.0.alpha2.jar!/:24.2.0.alpha2]
at com.vaadin.flow.server.StreamResource$Pipe.accept(StreamResource.java:83) ~[flow-server-24.2.0.alpha2.jar!/:24.2.0.alpha2]
at com.vaadin.flow.server.communication.StreamResourceHandler.handleRequest(StreamResourceHandler.java:86) ~[flow-server-24.2.0.alpha2.jar!/:24.2.0.alpha2]
at com.vaadin.flow.server.communication.StreamRequestHandler.handleRequest(StreamRequestHandler.java:110) ~[flow-server-24.2.0.alpha2.jar!/:24.2.0.alpha2]
at com.vaadin.flow.server.VaadinService.handleRequest(VaadinService.java:1529) ~[flow-server-24.2.0.alpha2.jar!/:24.2.0.alpha2]
at com.vaadin.flow.server.VaadinServlet.service(VaadinServlet.java:398) ~[flow-server-24.2.0.alpha2.jar!/:24.2.0.alpha2]
at com.vaadin.flow.spring.SpringServlet.service(SpringServlet.java:106) ~[vaadin-spring-24.2.0.alpha2.jar!/:na]
In Vaadin directory, Sezim Satybaldieva asked:
How to use utf-8 charset for csv?
Exporting to EXCEL produces the following error:
java.lang.IllegalArgumentException: Not supported: http://javax.xml.XMLConstants/property/accessExternalStylesheet at org.docx4j.org.apache.xalan.processor.TransformerFactoryImpl.setAttribute(TransformerFactoryImpl.java:571) ~[xalan-interpretive-8.0.0.jar:na] at org.apache.poi.util.XMLHelper.trySet(XMLHelper.java:283) ~[poi-5.2.2.jar:5.2.2] at org.apache.poi.util.XMLHelper.getTransformerFactory(XMLHelper.java:224) ~[poi-5.2.2.jar:5.2.2] at org.apache.poi.util.XMLHelper.newTransformer(XMLHelper.java:230) ~[poi-5.2.2.jar:5.2.2] at org.apache.poi.openxml4j.opc.StreamHelper.saveXmlInStream(StreamHelper.java:56) ~[poi-ooxml-5.2.2.jar:5.2.2] at org.apache.poi.openxml4j.opc.internal.ZipContentTypeManager.saveImpl(ZipContentTypeManager.java:68) ~[poi-ooxml-5.2.2.jar:5.2.2] at org.apache.poi.openxml4j.opc.internal.ContentTypeManager.save(ContentTypeManager.java:450) ~[poi-ooxml-5.2.2.jar:5.2.2] at org.apache.poi.openxml4j.opc.ZipPackage.saveImpl(ZipPackage.java:563) ~[poi-ooxml-5.2.2.jar:5.2.2] at org.apache.poi.openxml4j.opc.OPCPackage.save(OPCPackage.java:1490) ~[poi-ooxml-5.2.2.jar:5.2.2] at org.apache.poi.ooxml.POIXMLDocument.write(POIXMLDocument.java:227) ~[poi-ooxml-5.2.2.jar:5.2.2] at com.flowingcode.vaadin.addons.gridexporter.ExcelInputStreamFactory$1.run(ExcelInputStreamFactory.java:103) ~[grid-exporter-addon-1.2.1.jar:1.2.1] at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]
LocalDateRenderer does not extend LitRenderer.
The start of the stacktrace:
java.lang.IllegalStateException: It's not possible to obtain a value for column, please set a value provider by calling setExportValue()
at com.flowingcode.vaadin.addons.gridexporter.GridExporter.extractValueFromColumn(GridExporter.java:143)
at com.flowingcode.vaadin.addons.gridexporter.ExcelInputStreamFactory.lambda$buildRow$2(ExcelInputStreamFactory.java:163)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1510)
at com.flowingcode.vaadin.addons.gridexporter.ExcelInputStreamFactory.buildRow(ExcelInputStreamFactory.java:162)
at com.flowingcode.vaadin.addons.gridexporter.ExcelInputStreamFactory.lambda$fillData$1(ExcelInputStreamFactory.java:146)
at java.base/java.util.ArrayList$Itr.forEachRemaining(ArrayList.java:1002)
at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:658)
at com.flowingcode.vaadin.addons.gridexporter.ExcelInputStreamFactory.fillData(ExcelInputStreamFactory.java:137)
at com.flowingcode.vaadin.addons.gridexporter.ExcelInputStreamFactory.createInputStream(ExcelInputStreamFactory.java:71)
If you define a frozen column col.setFrozen(true)
then the scroll lateral doesn’t work fine, see next videos:
in the first video “fase" is frozen and exporter is not activate , all the other columns are scroll, but not export function is show
in the second video “fase" is frozen and exporter is activate, then none of the columns of the grid are scroll it
In the third video any column is frozen and exporter is activate, then works fine the columns in the grid are scroll it but only with out frozen
Version 1.5.0 uses grid helpers 0.3.3 and is compatible with Vaadin 23.1+ (I guess that means 23.1-23.3, given the other errors related to Vaadin 24)
Since we will release a new major version (#58) for Vaadin 24, and Vaadin 23.2 has reached EOL, version 1.x should remain compatible with Vaadin 23.3. That means that we can upgrade to grid-helpers 1.1.0 (particularly, in order to bring FlowingCode/GridHelpers#76)
[labelling as a bug, since there are bugs related to using an outdated version of grid-helpers]
It is a usual requirement that numbers should be right aligned and text left aligned, so it should be possible to customize that for excel, docx and pdf outputs.
After clicking the export to excel button, the following exception is thrown:
com.vaadin.flow.server.ServiceException: java.lang.ClassCastException: class com.vaadin.flow.component.orderedlayout.VerticalLayout cannot be cast to class com.vaadin.flow.dom.Element (com.vaadin.flow.component.orderedlayout.VerticalLayout and com.vaadin.flow.dom.Element are in unnamed module of loader org.apache.catalina.loader.ParallelWebappClassLoader @26dcd8c0)
at com.vaadin.flow.server.VaadinServlet.service(VaadinServlet.java:371) ~[flow-server-23.3.4.jar:23.3.4]
at com.vaadin.flow.spring.SpringServlet.service(SpringServlet.java:106) ~[vaadin-spring-23.3.4.jar:na]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) ~[servlet-api.jar:na]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[catalina.jar:9.0.34]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[catalina.jar:9.0.34]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-websocket.jar:9.0.34]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[catalina.jar:9.0.34]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[catalina.jar:9.0.34]
at vaadin.hibernate.CurrentServerContextFilter.doFilterInternal(CurrentServerContextFilter.java:115) ~[classes/:6.7.0-SNAPSHOT]
... 80 common frames omitted
Caused by: com.vaadin.flow.server.ServiceException: java.lang.ClassCastException: class com.vaadin.flow.component.orderedlayout.VerticalLayout cannot be cast to class com.vaadin.flow.dom.Element (com.vaadin.flow.component.orderedlayout.VerticalLayout and com.vaadin.flow.dom.Element are in unnamed module of loader org.apache.catalina.loader.ParallelWebappClassLoader @26dcd8c0)
at com.vaadin.flow.server.VaadinService.handleExceptionDuringRequest(VaadinService.java:1613) ~[flow-server-23.3.4.jar:23.3.4]
at com.vaadin.flow.server.VaadinService.handleRequest(VaadinService.java:1576) ~[flow-server-23.3.4.jar:23.3.4]
at com.vaadin.flow.server.VaadinServlet.service(VaadinServlet.java:369) ~[flow-server-23.3.4.jar:23.3.4]
... 88 common frames omitted
Caused by: java.lang.ClassCastException: class com.vaadin.flow.component.orderedlayout.VerticalLayout cannot be cast to class com.vaadin.flow.dom.Element (com.vaadin.flow.component.orderedlayout.VerticalLayout and com.vaadin.flow.dom.Element are in unnamed module of loader org.apache.catalina.loader.ParallelWebappClassLoader @26dcd8c0)
at com.flowingcode.vaadin.addons.gridexporter.BaseInputStreamFactory.renderCellTextContent(BaseInputStreamFactory.java:112) ~[grid-exporter-addon-1.4.1.jar:1.4.1]
at com.flowingcode.vaadin.addons.gridexporter.BaseInputStreamFactory.lambda$getGridHeaders$0(BaseInputStreamFactory.java:89) ~[grid-exporter-addon-1.4.1.jar:1.4.1]
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) ~[na:na]
at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625) ~[na:na]
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[na:na]
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[na:na]
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921) ~[na:na]
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na]
at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682) ~[na:na]
at com.flowingcode.vaadin.addons.gridexporter.BaseInputStreamFactory.getGridHeaders(BaseInputStreamFactory.java:90) ~[grid-exporter-addon-1.4.1.jar:1.4.1]
at com.flowingcode.vaadin.addons.gridexporter.ExcelInputStreamFactory.createInputStream(ExcelInputStreamFactory.java:89) ~[grid-exporter-addon-1.4.1.jar:1.4.1]
at com.vaadin.flow.server.StreamResource$Pipe.createInputStream(StreamResource.java:99) ~[flow-server-23.3.4.jar:23.3.4]
at com.vaadin.flow.server.StreamResource$Pipe.accept(StreamResource.java:83) ~[flow-server-23.3.4.jar:23.3.4]
at com.vaadin.flow.server.communication.StreamResourceHandler.handleRequest(StreamResourceHandler.java:91) ~[flow-server-23.3.4.jar:23.3.4]
at com.vaadin.flow.server.communication.StreamRequestHandler.handleRequest(StreamRequestHandler.java:103) ~[flow-server-23.3.4.jar:23.3.4]
at com.vaadin.flow.server.VaadinService.handleRequest(VaadinService.java:1564) ~[flow-server-23.3.4.jar:23.3.4]
... 89 common frames omitted
I'm using this addon's version 1.4.1 and Vaadin 23.3.7
Can you please just offer the possibility to return a null value in that case?
That would give the possibility to use your exporter for all grids without the risk that someone somewhere adds a non-exportable column and the user will get an exception.
You could probably add a "general null value handler" that generates the default-value for null-columns (if no custom column-value-provider-data is set).
if (value == null) {
throw new IllegalStateException("It's not possible to obtain a value for column, please set a value provider by calling setExportValue()");
}
If the columns provide a number but the method setNumberColumnFormat
was not called, then we get an NPE. We should throw an exception explaining the situation.
Hi,
Thanks for this plugin, it's very useful.
I want to use it to export to CSV with a custom export button, which works... until I try to hide the buttons generated by the plugin, by setting exporter.setAutoAttachExportButtons(false).
If I do that, when I click my export button I get an empty file, and this exception in the application log:
Exception in thread "Thread-23" java.lang.IllegalStateException: Cannot access state in VaadinSession or UI without locking the session.
at com.vaadin.flow.server.VaadinSession.checkHasLock(VaadinSession.java:576)
at com.vaadin.flow.server.VaadinSession.checkHasLock(VaadinSession.java:590)
at com.vaadin.flow.internal.StateTree.checkHasLock(StateTree.java:432)
at com.vaadin.flow.internal.StateTree.beforeClientResponse(StateTree.java:362)
at com.vaadin.flow.data.provider.DataCommunicator$FlushRequest.lambda$register$43f5e0c7$1(DataCommunicator.java:1515)
at com.vaadin.flow.internal.StateNode.runWhenAttached(StateNode.java:895)
at com.vaadin.flow.data.provider.DataCommunicator$FlushRequest.register(DataCommunicator.java:1511)
at com.vaadin.flow.data.provider.DataCommunicator.requestFlush(DataCommunicator.java:1107)
at com.vaadin.flow.data.provider.DataCommunicator.requestFlush(DataCommunicator.java:1093)
at com.vaadin.flow.data.provider.DataCommunicator.reset(DataCommunicator.java:378)
at com.vaadin.flow.component.grid.Grid.setClassNameGenerator(Grid.java:3933)
at com.flowingcode.vaadin.addons.gridhelpers.GridHelper.setClassNameGenerator(GridHelper.java:154)
at com.flowingcode.vaadin.addons.gridhelpers.GridHelper.<init>(GridHelper.java:77)
at com.flowingcode.vaadin.addons.gridhelpers.GridHelper.getHelper(GridHelper.java:91)
at com.flowingcode.vaadin.addons.gridhelpers.GridHelper.getHeader(GridHelper.java:327)
at com.flowingcode.vaadin.addons.gridexporter.BaseInputStreamFactory.renderCellTextContent(BaseInputStreamFactory.java:84)
at com.flowingcode.vaadin.addons.gridexporter.BaseInputStreamFactory.lambda$getGridHeaders$0(BaseInputStreamFactory.java:70)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
at com.flowingcode.vaadin.addons.gridexporter.BaseInputStreamFactory.getGridHeaders(BaseInputStreamFactory.java:71)
at com.flowingcode.vaadin.addons.gridexporter.CsvInputStreamFactory$1.run(CsvInputStreamFactory.java:46)
at java.base/java.lang.Thread.run(Thread.java:829)
The only difference is the AutoAttachExportButtons setting. Do you have any idea what could be causing this?
I'm using Vaadin 23.3.0 and addon version 1.4.0.
Right now setExportValue
allows to set the value to be exported supplying always a String. The problem is that if I want to specify that the value is a Number or a Date and I want that those are preserved as that data type in Excel, that cannot be done.
When exporting data more than 64,000 records, the following error is thrown.
java.lang.IllegalStateException: The maximum number of Cell Styles was exceeded. You can define up to 64000 style in a .xlsx Workbook
at org.apache.poi.xssf.model.StylesTable.createCellStyle(StylesTable.java:860) ~[poi-ooxml-5.2.3.jar:5.2.3]
at org.apache.poi.xssf.usermodel.XSSFWorkbook.createCellStyle(XSSFWorkbook.java:788) ~[poi-ooxml-5.2.3.jar:5.2.3]
at org.apache.poi.xssf.usermodel.XSSFWorkbook.createCellStyle(XSSFWorkbook.java:108) ~[poi-ooxml-5.2.3.jar:5.2.3]
at com.flowingcode.vaadin.addons.gridexporter.ExcelInputStreamFactory.lambda$buildRow$2(ExcelInputStreamFactory.java:277) ~[grid-exporter-addon-2.2.0.jar:2.2.0]
at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1708) ~[na:na]
at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762) ~[na:na]
at com.flowingcode.vaadin.addons.gridexporter.ExcelInputStreamFactory.buildRow(ExcelInputStreamFactory.java:270) ~[grid-exporter-addon-2.2.0.jar:2.2.0]
at com.flowingcode.vaadin.addons.gridexporter.ExcelInputStreamFactory.fillData(ExcelInputStreamFactory.java:251) ~[grid-exporter-addon-2.2.0.jar:2.2.0]
at com.flowingcode.vaadin.addons.gridexporter.ExcelInputStreamFactory.createInputStream(ExcelInputStreamFactory.java:112) ~[grid-exporter-addon-2.2.0.jar:2.2.0]
at com.vaadin.flow.server.StreamResource$Pipe.createInputStream(StreamResource.java:99) ~[flow-server-24.3.2.jar:24.3.2]
I'm facing this problem when deploying a demo application using the addon using docker:
Caused by: java.lang.NullPointerException: Cannot load from short array because "sun.awt.FontConfiguration.head" is null
at java.desktop/sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1264)
at java.desktop/sun.awt.FontConfiguration.readFontConfigFile(FontConfiguration.java:224)
at java.desktop/sun.awt.FontConfiguration.init(FontConfiguration.java:106)
at java.desktop/sun.awt.X11FontManager.createFontConfiguration(X11FontManager.java:706)
at java.desktop/sun.font.SunFontManager$2.run(SunFontManager.java:358)
at java.desktop/sun.font.SunFontManager$2.run(SunFontManager.java:315)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
at java.desktop/sun.font.SunFontManager.<init>(SunFontManager.java:315)
at java.desktop/sun.awt.FcFontManager.<init>(FcFontManager.java:35)
at java.desktop/sun.awt.X11FontManager.<init>(X11FontManager.java:56)
... 61 more
I suspect that it is related to a missing font in the OS
I have several grid columns that have custom renderers
Column myColumn = this.addColumn(new ComponentRenderer<>(this::createUserNumber))
These columns do not get included in the export. Is there a way to configure the exporter to include these values as part of the export?
It would be very useful to have a method that allows to reorder the columns order before they are exported.
When you export to PDF or Docx, the first row is exported correctly, but from the second onwards all rows are sorted in descending order. This can be seen in the online demo as well.
The release notes mention "Fix issues by @mlopezFC in #13", but that PR contains four features.
It would be great to add support to export numbers with formats and not strings to generated excel exports.
Exporting a grid to docx without template:
java.lang.NullPointerException: Cannot invoke "Object.getClass()" because "o" is null
at java.base/jdk.internal.reflect.UnsafeFieldAccessorImpl.ensureObj(UnsafeFieldAccessorImpl.java:57) ~[na:na]
at java.base/jdk.internal.reflect.UnsafeObjectFieldAccessorImpl.get(UnsafeObjectFieldAccessorImpl.java:36) ~[na:na]
at java.base/java.lang.reflect.Field.get(Field.java:425) ~[na:na]
at com.flowingcode.vaadin.addons.gridhelpers.HeaderFooterGridHelper.getTemplate(HeaderFooterGridHelper.java:22) ~[grid-helpers-0.2.0.jar:0.2.0]
at com.flowingcode.vaadin.addons.gridhelpers.HeaderFooterGridHelper.getFooter(HeaderFooterGridHelper.java:64) ~[grid-helpers-0.2.0.jar:0.2.0]
at com.flowingcode.vaadin.addons.gridhelpers.GridHelper.getFooter(GridHelper.java:308) ~[grid-helpers-0.2.0.jar:0.2.0]
at com.flowingcode.vaadin.addons.gridexporter.BaseInputStreamFactory.lambda$getGridFooters$1(BaseInputStreamFactory.java:61) ~[grid-exporter-addon-1.0.1.jar:1.0.1]
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) ~[na:na]
at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625) ~[na:na]
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[na:na]
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[na:na]
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921) ~[na:na]
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na]
at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682) ~[na:na]
For PDF and Doc export, is it possible to change the page orientation from LETTER to LANDSCAPE?
Thank you
GridExporter addon uses font-awesome-iron-iconset
v3.0.0, which is compatible with Vaadin 14-23.
Title basically, I don't know the exact circumstances but I seem to be getting it consistently on grids that don't have a footer row.
Vaadin version 23.3.2, addon version 1.4.0
An NPE is thrown if the grid to export does not contain a footer row
I use the grid exporter for my Vaadin 24 apps and it's really working well for nearly all use cases, except one grid with large data sets (3000 rows). Exporting this grid is unusable due to the bad performance (> 60s).
I profiled the execution with VisualVM and its turned out, that
ExcelInputStreamFactory.fillData
and there the call for
sheet.shiftRows
is responsible for the huge time needed.
Why is such a call neded and is there something I can fasten in order to make it work as for small data sets ?
kind regrads
Dominik
P.S.: as workaround, please provide a hook/callback/listener for a FINISHED event of generating the stream resource so one can show a progressBar or something in the meantime.
If a grid is filtered using grid.getListDataView().addFilter(...)
, the exported grid will show the correct ammount of items, but will not show the filtered items (the items that passed the filter), rather it will show the first n items (even if they don't match the filter) of the grid.
Example having the following rows:
row A
row B
row C
Applying a filter criteria that leaves out row B:
row A
row C
What ends up being exported (which is wrong) is:
row A
row B
To further show the behaviour of this issue, I attached a sample project in which I attempt something as shown above.
grid-exporter-test.zip
To test it, please:
After upgrading to 2.1.1, the last row in Excel is ignored, I believe it's related to #82 because this is not the case for 2.1.0
Also, as @dominik42 mentioned, showing a progressBar would be a bonus.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.