Code Monkey home page Code Monkey logo

gridexporteraddon's Issues

Combine GridExporter and GridHelper toolbar components in one toolbar

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.

Cannot load from short array because "sun.awt.FontConfiguration.head" is null

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

Compilation error / Vaadin 24.0.0.beta1

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>

if (r.getValueProviders().size()>0) {
value = r.getValueProviders().values().iterator().next().apply(item);
} else if (r instanceof BasicRenderer) {

export to PDF it fails when you are using vaadin 24.0.5

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

POI exception when exporting for a second time after latest changes

After latest changes regarding excel formatting, it is throwing the following error when exporting a second time:

�[1mCaused by�[m: java.lang.IllegalArgumentException: �[1;31mThis Style does not belong to the supplied Workbook Styles Source. Are you trying to assign a style from one workbook to the cell of a different workbook?�[m
    �[1mat�[m org.apache.poi.xssf.usermodel.XSSFCellStyle.verifyBelongsToStylesSource (�[1mXSSFCellStyle.java:123�[m)
    �[1mat�[m org.apache.poi.xssf.usermodel.XSSFCell.setCellStyle (�[1mXSSFCell.java:626�[m)
    �[1mat�[m com.flowingcode.vaadin.addons.gridexporter.ExcelInputStreamFactory.applyExcelFormat (�[1mExcelInputStreamFactory.java:382�[m)

Component column headers are not exported

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)

Exporting columns that are defined by ComponentRenderer

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?

Large data throws exception for excel export

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]

Exception in docx-Export

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]

Error exporting large set of grid data

When I try to export the data of a grid containing ~7800 rows, the following message is shown in the browser's download manager:
image
("Site was not available")

And in the server console I get the following error logs:

2024-02-26 12:16:39.627  WARN 13492 --- [nio-8080-exec-5] o.a.poi.xssf.usermodel.XSSFWorkbook      : Cloning sheets with page setup is not yet supported.
2024-02-26 12:16:59.413 ERROR 13492 --- [nio-8080-exec-5] o.s.b.w.servlet.support.ErrorPageFilter  : Cannot forward to error page for request [/v/VAADIN/dynamic/resource/2/e635c38d-0dc9-4e9f-b66b-0c1059a43ba0/JNetReport_26-02-2024.xlsx] as the response has already been committed. As a result, the response may have the wrong status code. If your application is running on WebSphere Application Server you may be able to resolve this problem by setting com.ibm.ws.webcontainer.invokeFlushAfterService to false

Introduce Cell Format Provider for Preciser Styling

The current implementation allows for setting the cell format for entire columns, limiting customization to a broader scope. This issue aims to enhance the feature by introducing a "Cell Format Provider" that enables styling at the individual cell or row level, just like the setExportValue method, but for cell format instead of value.

Doesn’t work fine with frozen columns

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
frozen column 2

in the second video “fase" is frozen and exporter is activate, then none of the columns of the grid are scroll it
frozen column

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
frozen column 3

Inconsistent Styling of Footer Cell in Certain Cases

When using a custom NumberColumnFormatProvider, an inconsistency in styling occurs for footer cells when their styles match those of the rows. In those cases, the footer cell's style is erroneously set as if it were a data cell.

This issue is reproducible with the following simple grid and exporter example:

Grid<String> myGrid = new Grid<>();                                                                                    
Column<String> itemColumn = myGrid.addColumn( str -> str).setHeader("Item");                                           
Column<String> upperColumn = myGrid.addColumn( str -> String.valueOf(Math.random() * 100)).setHeader("Number");        
itemColumn.setFooter("Unformatted footer");                                                                            
upperColumn.setFooter("50.00");                                                                                        
                                                                                                                       
myGrid.setItems(new ArrayList<>(List.of("Item 1", "Item 2", "Item 3")));                                               
add(myGrid);                                                                                                           
                                                                                                                       
GridExporter<String> exporter = GridExporter.createFor(myGrid);                                                        
exporter.setNumberColumnFormatProvider(upperColumn, new DecimalFormat("#,##0.000"), item -> {                          
	if (item == null)                                                                                                  
	{                                                                                                                  
		return "$ #,##0.000";                                                                                            
	}                                                                                                                  
	return "#,##0.000";                                                                                                
});                                                                                                                    

When executing this example and exporting the grid to xlsx format, the output matches the expected styling:
image

However, after changing the format of the column for null items (the format for the footer) to match the formats of other items, we encounter an unexpected change in the footer's background color. Instead of using the footer's expected background color, it adopts the background color of the data cells:

exporter.setNumberColumnFormatProvider(upperColumn, new DecimalFormat("#,##0.000"), item -> {
    if (item == null) {
        // Changed to match the other rows' formats
        return "#,##0.000";
    }
    return "#,##0.000";
});

This inconsistency in footer cell styling is visually shown below:
image

Exception "Cannot join cells that are not adjacent" when navigating around

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]

Add column reordering

It would be very useful to have a method that allows to reorder the columns order before they are exported.

extractValueFromColumn throws Exception when no value can be obtained

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()");
}

Incorrect Text Alignment when exporting in XLSX file

I'm having an issue with text alignment, please see next example:

Grid<String> myGrid = new Grid<>();                                                                                    
Column<String> itemColumn = myGrid.addColumn( str -> str).setHeader("This is a long header");   
itemColumn.setTextAlign(ColumnTextAlign.START);

Column<String> upperColumn = myGrid.addColumn( str -> String.valueOf(Math.random() * 100)).setHeader("Number");        
upperColumn.setTextAlign(ColumnTextAlign.END);
upperColumn.setFooter("50.00");                                                                                        
                                                                                                                       
myGrid.setItems(new ArrayList<>(List.of("Item 1", "Item 2", "Item 3")));                                               
add(myGrid);                                                                                                           
                                                                                                                       
GridExporter<String> exporter = GridExporter.createFor(myGrid); 

In this simple example, the first column is set to have the text aligned to the start of the column. This is correctly configured in the grid. However, if I export this grid to xlsx, the items in the first column will appear aligned to the end of the column:

image

The exported XLSX file:
image

Cannot access state in VaadinSession or UI without locking the session.

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.

Exporter works unproperly with grids filtered by ListDataView

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:

  1. Import the project as a Maven project
  2. Run mvn install
  3. Run Application class
  4. Navigate to "/test".
  5. Add any filter, then export as xls or pdf.

[demos] Faker must be singleton

There is no point in initializing an instance of Faker for each row:

IntStream.range(0, 7000)
.asLongStream()
.mapToObj(
number -> {
Faker faker = new Faker();

IntStream.range(0, 100)
.asLongStream()
.mapToObj(
number -> {
Faker faker = new Faker();

IntStream.range(0, 100)
.asLongStream()
.mapToObj(
number -> {
Faker faker = new Faker();

IntStream.range(0, 100)
.asLongStream()
.mapToObj(
number -> {
Faker faker = new Faker();

Compare with:
https://github.com/FlowingCode/BadgeList/blob/a68d4325735790796736c99dd1a8d91405da08b4/src/test/java/com/flowingcode/vaadin/addons/badgelist/TestData.java#L30

https://github.com/FlowingCode/GridHelpers/blob/05fd5c9a95fa621de79d0f3d75de16b2b6dad307/src/test/java/com/flowingcode/vaadin/addons/gridhelpers/TestData.java#L30

Considering that the initialization of Faker is expensive
https://github.com/DiUS/java-faker/blob/a8b8ff0acc6fcc629d08a3a9952f83be56a9a3c3/src/main/java/com/github/javafaker/Faker.java#L131-L226

PDF/Docx Export with wrong sorting

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.

Upgrade grid-helpers to 1.1.0

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]

Bad Performance on huge grids

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.

ClassNotFoundException: org.apache.commons.io.output.UnsynchronizedByteArrayOutputStream

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]

PDF

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]

SAX Feature Unsupported

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]

Exporting LocalDateRenderer cells does not work

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)

ClassCastException when exporting to Xls

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

PDF/Doc Export

For PDF and Doc export, is it possible to change the page orientation from LETTER to LANDSCAPE?

Thank you

Exporter throw errors in browser using vaadin 24.1.0

When you are running in development mode each time you redraw a row that contains more than one grid child (separate in different tabs) it shows errors in console (see next videos and photos) If you disable the exporter then the errors disappear
change row generate errors

Captura de Pantalla 2023-06-20 a las 12 46 20 Captura de Pantalla 2023-06-19 a las 19 13 53

Apply number/date formats also to footers

Right now it is possible to specify a format patter to parse text columns to a given data type (only numbers and dates are supported right now) and then store the information as a number and also provide an excel format pattern so after the export those columns can be used in formulas.
This works fine, except that the footer are ignored. Usually footers are some calculations based on the other values, so they should be treated in the same way.

Vaadin 24.4.0.alpha15 shows browser error and exporter buttons are not showing

Testing the component version 2.2.1 in an application running with Vaadin 24.4.0.alpha15 shows the following error:

image

and links for export are not showing the icons, but exporting is working though:

image

I used this example (without the footer part) in an spring application with Vaadin 24.4.0.alpha (from vaadin starter).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.