It is highly likely that I am wrong but could the problem be that you are
pointing XSSF at a macro enabled workbook - an xlsm rather than an xlsx? You
could test this quite quickly by creating a 'normal' workbook with no
macros, not enable the macros so to speak, with an xlsx extension and
pointing the XSSF code at it.
navjamsster wrote:
>
> Hi,
>
> I am getting the following run time excception while crting a worksheet
> using XSSFWorkbook class:
>
> Exception in thread "main" org.apache.poi.POIXMLException:
> org.apache.poi.openxml4j.exceptions.InvalidOperationException: A part with
> the name '/xl/worksheets/sheet1.xml' already exists : Packages shall not
> contain equivalent part names and package implementers shall neither
> create nor recognize packages with equivalent part names. [M1.12]
> at
> org.apache.poi.POIXMLDocumentPart.createRelationship(POIXMLDocumentPart.java:216)
> at
> org.apache.poi.POIXMLDocumentPart.createRelationship(POIXMLDocumentPart.java:189)
> at
> org.apache.poi.xssf.usermodel.XSSFWorkbook.createSheet(XSSFWorkbook.java:467)
> at
> org.apache.poi.xssf.usermodel.XSSFWorkbook.createSheet(XSSFWorkbook.java:80)
> at
> com.ericsson.ccrtool.excel.impl.write.AbstractXmlToExcelMapper.initialize(AbstractXmlToExcelMapper.java:78)
> at
> com.ericsson.ccrtool.excel.impl.write.TableOfContentsMapper.map(TableOfContentsMapper.java:23)
> at
> com.ericsson.ccrtool.excel.impl.write.DefaultExcelExporter.exportToExcel(DefaultExcelExporter.java:116)
> at
> com.ericsson.ccrtool.excel.ExcelHelper.generateCcrForm(ExcelHelper.java:47)
> at
> com.ericsson.ccrtool.excel.ExcelHelper.generateCcrForm(ExcelHelper.java:40)
> at
> com.ericsson.ccrtool.excel.ExcelHelper.generateCcrForm(ExcelHelper.java:36)
> at
> com.ericsson.ccrtool.excel.impl.write.ExcelSheetComparer.main(ExcelSheetComparer.java:29)
> Caused by: org.apache.poi.openxml4j.exceptions.InvalidOperationException:
> A part with the name '/xl/worksheets/sheet1.xml' already exists : Packages
> shall not contain equivalent part names and package implementers shall
> neither create nor recognize packages with equivalent part names. [M1.12]
> at org.apache.poi.openxml4j.opc.Package.createPart(Package.java:692)
> at org.apache.poi.openxml4j.opc.Package.createPart(Package.java:656)
> at
> org.apache.poi.POIXMLDocumentPart.createRelationship(POIXMLDocumentPart.java:208)
> ... 10 more
>
>
>
> I am not able to unser stand, what went wrong.
>
> I used the following code to create a worksheet :
>
> Workbook wb = new XSSFWorkbook();
> Sheet sheet = wb.createSheet("1. Table of Contents");
>
> Please suggest me what i need to do to resolve the error.
>
>
>
--
View this message in context:
http://www.nabble.com/Getting-error-while-creating-a-worksheet-using-XSSFWorkbook-class%28APACHE-3.5-beta-4%29-tp22822952p22869994.html
Sent from the POI - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]