Skip to content

Incorrect Text Alignment when exporting in XLSX file #106

@brunoagretti

Description

@brunoagretti

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions