You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Alexander Philippi <al...@googlemail.com> on 2012/01/09 15:18:04 UTC

Issues working with xlsx files

Hi,
i created a workbook out of a given Excel 2007 file (the file was created
with Excel 2010; but this shouldnt matter).

The given file looks like this:
<a target='_blank'
href='http://imageshack.us/photo/my-images/833/bugim.png/'><img
src='http://img833.imageshack.us/img833/8971/bugim.th.png' border='0'/></a>

I have to add some informations to this excel file, but if I run this test
case, the "Spalte 1 - X" are removed ( I know the asserts are ugly but its
only to show my issue):
[code=java]
@Test
    public void testTemplateData2007() throws Exception {
        final InputStream fs = new FileInputStream("a xlsx file created
with excel 2010");
        final Workbook workbook = WorkbookFactory.create(fs);


assertThat(workbook.getSheet("Tabelle1").getRow(5).getCell(0).getStringCellValue(),
is(equalTo("Spalte 1")));

assertThat(workbook.getSheet("Tabelle1").getRow(5).getCell(1).getStringCellValue(),
is(equalTo("Spalte 2")));

assertThat(workbook.getSheet("Tabelle1").getRow(5).getCell(2).getStringCellValue(),
is(equalTo("Spalte 3")));

assertThat(workbook.getSheet("Tabelle1").getRow(5).getCell(3).getStringCellValue(),
is(equalTo("Spalte 4")));
    }
[/code]

I got no issues when I run the test with an Excel 2003 file. Does anybody
know why these columns were removed?

The written workbook looks like this:
<a target='_blank' href='
http://imageshack.us/photo/my-images/534/bug2jy.png/'><img src='
http://img534.imageshack.us/img534/6550/bug2jy.th.png' border='0'/></a>

I hope anyone could give me a hint why the written workbook doesnt look
like the original excel 2007 document.

Thanks
Alex