FlowingCode / GridExporterAddon

Other
10 stars 8 forks source link

Incorrect Text Alignment when exporting in XLSX file #106

Closed brunoagretti closed 3 months ago

brunoagretti commented 3 months ago

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