In a nutshell consider the scenario:
- one creates a workbook in memory using POI and applies some cell styling (cell aligning and bold font)
- download the created workbook and workbook looks and behaves as it should in MS Excel
- instead of downloading the workbook we first build a vaadin Spreadsheet with said workbook in the constructor and display it in a page. Then without any modifications one requests the workbook object from the spreadsheet component and downloads it. Then MS Excel said that file has errors and after replying yes on trying to recover prompt you get the data without any formatting. Sample code follows:
[code]
XSSFWorkbook workbook = new XSSFWorkbook();
CellStyle dateStyle = workbook.createCellStyle();
DataFormat format = workbook.createDataFormat();
dateStyle.setDataFormat(format.getFormat("yyyy-MM-dd HH:mm"));
CellStyle boldAndCenteredCellStyle = workbook.createCellStyle();
boldAndCenteredCellStyle.setAlignment(HorizontalAlignment.CENTER);
Font font = workbook.createFont();
font.setBold(true);
boldAndCenteredCellStyle.setFont(font);
//filling the workbook here with data and apply only one cellstyle (the boldAndCenteredCesllStyle)
Spreadsheet vaadinSpreadsheet = new Spreadsheet(workbook);
XSSFWorkbook workbookFromVaadinSpreadsheet = vaadinSpreadsheet.getWorkbook();
[/code]workbook object works fine when downloaded and opened in excel.
workbookFromVaadinSpreadsheet is corrupt and ms excel can only open it after giving warning and strips all formatting out of it.
After looking into it it seems that what causes the issue is the font part
Font font = workbook.createFont();
font.setBold(true);
boldAndCenteredCellStyle.setFont(font);
if the font is not applie to the style everything works as it should. as soon as fonts are used then the whole thing breaks down.
I made sure that I use the latest Vaadin Spreadsheet for Vaadin 7 (1.3.1) and I use its own embedded POI (3.1.5) to avoid any conflicts.
I hope I am missing something and this is not a bug because this is one of the simplest tasks one should expect from the addon and even if that won’t work well what can one do with it?
It seems that we bump into some error in every single thing we use:
grid inline editing has issues so we use our own editing forms ( here https://github.com/vaadin/framework/issues/7882 ) here , lazyquerycontainer has issues with eclipselink and we only made it work properly with hibernate after modifying its code (instead of JPA compliant now its only hibernate compliant in our code but hey at least it works), google maps had scrolling issues (plus they don’t work with chinese version of the maps - and there was a bug with satellite view that got fixed) and we reimplemented our mapping needs with v-leaflet. Sorry for bringing all my dissapointment here but it seems that with most components we touch we stumble upon some serious issue that requires us going through the code and try to patch things up or find workarounds.
Regards,
George