You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Paul Slootweg <ps...@edwtech.com> on 2016/03/18 20:09:45 UTC

Simple example doesn't open in Excel 2010

I am having a problem with POI 3.14 - downloaded today.

The following code creates a file which, unzipped, looks right, but Excel 
2010 will not open it.

    Workbook wb = new XSSFWorkbook();

    Sheet sh = wb.createSheet("Sheet1");

    Row r = sh.createRow(0);

    Cell c = r.createCell(0);
    c.setCellValue("Cell1");

    wb.write(new FileOutputStream("file.xlsx"));


It works fine with

wb = new HSSFWorkbook();

to create a .xls file.

Any ideas?

Paul
EDW Technology Limited is a company registered in England and Wales with company number 3112883 and VAT number 667767961. 
Registered office: EDW House, 3 Radian Court, Knowlhill, Milton Keynes, MK5 8PJ

Re: Simple example doesn't open in Excel 2010

Posted by Paul Slootweg <ps...@edwtech.com>.
I had a feeling it might be something like that.
Unfortunately the path has a LOT of jars - I'm trying to find out what 
other dependencies there might be.

The listed dependencies don't go much beyond xmlbeans...

I'm running in Eclipse - trying to upgrade from POI 3.6 but need to only 
update dependencies as required.

Paul



From:   Andreas Beeker <ki...@apache.org>
To:     POI Users List <us...@poi.apache.org>
Date:   18/03/2016 20:16
Subject:        Re: Simple example doesn't open in Excel 2010



The namespaces declarations are missing in several files, e.g. 
<Relationships> instead of <Relationships xmlns="
http://schemas.openxmlformats.org/package/2006/relationships">

This looks like there might be a xmlapis.jar or similar conflict.
Which JARs are in your path?
Where do you start it from? ... Eclipse, some Android plattform, web 
application ...

Andi


On 18.03.2016 21:03, Paul Slootweg wrote:
> Yes, I tried closing streams etc. makes no difference.
>
> No mixed POI
>
> Paul
>
>
>
> From:   Andreas Beeker <ki...@apache.org>
> To:     POI Users List <us...@poi.apache.org>
> Date:   18/03/2016 19:22
> Subject:        Re: Simple example doesn't open in Excel 2010
>
>
>
> Excel 2016 and Libre Office don't complain.
> Can you upload you generated file somewhere - so i can compare it 
against 
> mine?
> my first guess was, that I would close the FileOutputStream ... but at 
> least in my environment your code works.
> I assume you have read the FAQ and don't mix POI versions and use the 
> latest schemas ...
>
> Andi
>
> On 18.03.2016 20:09, Paul Slootweg wrote:
>>   Workbook wb = new XSSFWorkbook();
>>
>>     Sheet sh = wb.createSheet("Sheet1");
>>
>>     Row r = sh.createRow(0);
>>
>>     Cell c = r.createCell(0);
>>     c.setCellValue("Cell1");
>>
>>     wb.write(new FileOutputStream("file.xlsx"));
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
> [PP-Node-1]
>
> EDW Technology Limited is a company registered in England and Wales with 
company number 3112883 and VAT number 667767961. 
> Registered office: EDW House, 3 Radian Court, Knowlhill, Milton Keynes, 
MK5 8PJ
>




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org
[PP-Node-1]

EDW Technology Limited is a company registered in England and Wales with company number 3112883 and VAT number 667767961. 
Registered office: EDW House, 3 Radian Court, Knowlhill, Milton Keynes, MK5 8PJ

Re: Simple example doesn't open in Excel 2010

Posted by Andreas Beeker <ki...@apache.org>.
The namespaces declarations are missing in several files, e.g. <Relationships> instead of <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">

This looks like there might be a xmlapis.jar or similar conflict.
Which JARs are in your path?
Where do you start it from? ... Eclipse, some Android plattform, web application ...

Andi


On 18.03.2016 21:03, Paul Slootweg wrote:
> Yes, I tried closing streams etc. makes no difference.
>
> No mixed POI
>
> Paul
>
>
>
> From:   Andreas Beeker <ki...@apache.org>
> To:     POI Users List <us...@poi.apache.org>
> Date:   18/03/2016 19:22
> Subject:        Re: Simple example doesn't open in Excel 2010
>
>
>
> Excel 2016 and Libre Office don't complain.
> Can you upload you generated file somewhere - so i can compare it against 
> mine?
> my first guess was, that I would close the FileOutputStream ... but at 
> least in my environment your code works.
> I assume you have read the FAQ and don't mix POI versions and use the 
> latest schemas ...
>
> Andi
>
> On 18.03.2016 20:09, Paul Slootweg wrote:
>>   Workbook wb = new XSSFWorkbook();
>>
>>     Sheet sh = wb.createSheet("Sheet1");
>>
>>     Row r = sh.createRow(0);
>>
>>     Cell c = r.createCell(0);
>>     c.setCellValue("Cell1");
>>
>>     wb.write(new FileOutputStream("file.xlsx"));
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
> [PP-Node-1]
>
> EDW Technology Limited is a company registered in England and Wales with company number 3112883 and VAT number 667767961. 
> Registered office: EDW House, 3 Radian Court, Knowlhill, Milton Keynes, MK5 8PJ
>




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: Simple example doesn't open in Excel 2010

Posted by Paul Slootweg <ps...@edwtech.com>.
Yes, I tried closing streams etc. makes no difference.

No mixed POI

Paul



From:   Andreas Beeker <ki...@apache.org>
To:     POI Users List <us...@poi.apache.org>
Date:   18/03/2016 19:22
Subject:        Re: Simple example doesn't open in Excel 2010



Excel 2016 and Libre Office don't complain.
Can you upload you generated file somewhere - so i can compare it against 
mine?
my first guess was, that I would close the FileOutputStream ... but at 
least in my environment your code works.
I assume you have read the FAQ and don't mix POI versions and use the 
latest schemas ...

Andi

On 18.03.2016 20:09, Paul Slootweg wrote:
>   Workbook wb = new XSSFWorkbook();
>
>     Sheet sh = wb.createSheet("Sheet1");
>
>     Row r = sh.createRow(0);
>
>     Cell c = r.createCell(0);
>     c.setCellValue("Cell1");
>
>     wb.write(new FileOutputStream("file.xlsx"));



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org
[PP-Node-1]

EDW Technology Limited is a company registered in England and Wales with company number 3112883 and VAT number 667767961. 
Registered office: EDW House, 3 Radian Court, Knowlhill, Milton Keynes, MK5 8PJ

Re: Simple example doesn't open in Excel 2010

Posted by Andreas Beeker <ki...@apache.org>.
Excel 2016 and Libre Office don't complain.
Can you upload you generated file somewhere - so i can compare it against mine?
my first guess was, that I would close the FileOutputStream ... but at least in my environment your code works.
I assume you have read the FAQ and don't mix POI versions and use the latest schemas ...

Andi

On 18.03.2016 20:09, Paul Slootweg wrote:
>   Workbook wb = new XSSFWorkbook();
>
>     Sheet sh = wb.createSheet("Sheet1");
>
>     Row r = sh.createRow(0);
>
>     Cell c = r.createCell(0);
>     c.setCellValue("Cell1");
>
>     wb.write(new FileOutputStream("file.xlsx"));



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org