Assigning styles which apply horizontal alignment appears correctly in Excel, but not in Safari for IOS. Test code below produces output which has a left and right alignment applied to different cells, but they render as left alignment in both cases when viewed in Safari for IOS: ... public void test(){ XSSFWorkbook wb = new XSSFWorkbook(); XSSFSheet sheetA = wb.createSheet("sheet_a"); Row row0 = sheetA.createRow(0); XSSFCellStyle styleA = wb.createCellStyle(); styleA.setAlignment(HorizontalAlignment.LEFT); XSSFCellStyle styleB = wb.createCellStyle(); styleB.setAlignment(HorizontalAlignment.RIGHT); Cell cellA0 = row0.createCell(0); cellA0.setCellStyle(styleA); cellA0.setCellValue("asdf"); Cell cellB0 = row0.createCell(1); cellB0.setCellStyle(styleB); cellB0.setCellValue("qwerty"); try{ FileOutputStream fileOut = new FileOutputStream("exampleFile.xlsx"); wb.write(fileOut); fileOut.close(); } catch (IOException ioe){ ioe.printStackTrace(); } } ...
How does the XML compare between what's generated by POI and what's generated by Excel, LibreOffice, or OpenOffice? How does a file that is created in Excel, with horizontally aligned cells look in Safari for iOS? I don't have an iOS device, so I can't test this to determine if this is a bug in Safari or POI. Can Safari natively display OpenXML files? That's cool. Firefox and Chrome can't.
Created attachment 33338 [details] Original test file which displays improperly in Safari
Created attachment 33339 [details] Original example file opened in Excel, then saved with a different name
I ran a recursive diff between the contents of the two files; I notice that the MS version has theme assets but the overall structure looks similar otherwise. When viewing the file level diffs, they have numerous deltas but I'm not sure which ones are meaningful. Please let me know if you want me to zip up the delta reports and attach it to this bug. I attached the original test file as well as a version of that file saved by MS Excel. The differences in behavior are: --Original test file created via test program in initial description (exampleFile.xlsx): - displays correctly in MS Excel (one cell left aligned, other cell right aligned) - displays correctly in Google Drive viewer - on download request, renders *incorrectly* in Safari with both cells left aligned. --Test file created from MS Excel by saving original test XSLX file(exampleFile_Excel_saved.xlsx): - displays correctly in MS Excel (one cell left aligned, other cell right aligned) - displays correctly in Google Drive viewer - on download request, renders in Safari *correctly* with one cell left aligned, other cell right aligned. It appears Safari can display this content; with the exception of this issue, more complex content appears to be rendering correctly. I'm checking the functionality by uploading the XLSX file to a google drive location. Selecting the file displays the content in Google's browser renderer, but choosing to download the file is when Safari appears to take over to render the file.