DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41688>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41688

           Summary: DocumentSummaryInformation.getCustomProperties doesn't
                    read CodePage
           Product: POI
           Version: 3.0-dev
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P4
         Component: HPFS
        AssignedTo: poi-dev@jakarta.apache.org
        ReportedBy: [EMAIL PROTECTED]


MS Word 2003 XP2 (the only version I've tested so far) stores the CodePage 
value in the custom 
properties section as an untitled property.

When the custom properties are read in by 
DocumentSummaryInformation.getCustomProperties it 
ignores untitled properties.  Therefore the CodePage value isn't read in and 
getCodePage() returns -1.

This has the side effect of changing the CodePage when the data is written out 
to a file because it is set 
to the default value of CP_UNICODE.

To repeat the problem:
1.  Create a new document in Word with at least one custom property
2.  Check the CodePage value for the custom properties section (e.g. using the 
sample reader code).  In 
my case it was 65001.  As long as the value isn't 1200 the problem will occur.
3.  Using the sample code that updates a custom property, update a value and 
write out the data to a 
file
4.  Check the CodePage value for the newly written doc.  It will have changed 
to 1200 (CP_UNICODE).

The workaround is as follows:
* Firstly read in the document using the POIFSReaderListener interface (as per 
the sample code) and 
cache the codePage value.
* After re-reading the document for update purposes set the custom properties 
codePage value to the 
cached value by building a CustomProperty and using 
CustomProperties.set("PID_CODEPAGE", 
CustomProperty cp).

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

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/

Reply via email to