poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 47460] New: XFFSWorkbook Core Properties initialization
Date Tue, 30 Jun 2009 15:58:45 GMT

           Summary: XFFSWorkbook Core Properties initialization
           Product: POI
           Version: 3.5-dev
          Platform: PC
        OS/Version: Mac OS X 10.4
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
        AssignedTo: dev@poi.apache.org
        ReportedBy: roberto.manicardi@gmail.com

I'm trying to create a new Spreadsheet document and set come Core properties
(such the author and the title) but I have some problems. 

To show what I'm doing I've created a simple TestCase:

package org.apache.poi.xssf.usermodel;
import org.apache.poi.POIXMLProperties;
import junit.framework.TestCase;

public class TestXSSFProperties extends TestCase {

    public void testCreateWorkbookAndSetCoreProperties() throws Exception{
        XSSFWorkbook workbook = new XSSFWorkbook();
        POIXMLProperties properties = workbook.getProperties();


If I run the testcase (I'm using the trunk version of POI) I have the following

java.lang.IllegalArgumentException: A document must always have core properties
    at org.apache.poi.POIXMLProperties.<init>(POIXMLProperties.java:47)
    at org.apache.poi.POIXMLDocument.getProperties(POIXMLDocument.java:162)

I've tried to find a way to set  the Core properties object but I haven't found
any useful Java method. 

If I create a new Workbook by loading and existing xlsx file it all works fine
but If I create it from scratch the Core Propeties object is not create.

Is there a way to create the core properties or I have to patch the 
XSSFWorkbook constructor? In the second case, it's best to create the core
properties upon creation or to add a createProperties method?

Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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

View raw message