https://issues.apache.org/bugzilla/show_bug.cgi?id=47504

           Summary: xlsx files with hyperlinks to document locations gives
                    error: A segment shall not hold any characters other
                    than pchar characters. [M1.6]
           Product: POI
           Version: 3.5-dev
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
        AssignedTo: [email protected]
        ReportedBy: [email protected]


Created an attachment (id=23953)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=23953)
sample workbook that POI 3.5-beta6 cannot open

Problem:

I created a simple xlsx file (Tried using both Excel 2008/Mac and 2007/Windows)
by doing the following:
1) Create new workbook
2) Add a shape to workbook (Insert->Picture->Shape)
3) Right-click the shape, select Hyperlink...
4) Select "Document" (or "Place in this Document") as the link type
5) Click "Locate..." choose "Cell Reference", then select a cell on a sheet
6) Save file

(I will attach this workbook to the bug)

Try to read the xlsx file with POI (3.5-beta6), using the following code:

     XSSFWorkbook wb = new XSSFWorkbook("test-hyperlink.xlsx");

Get the following exception:

Exception in thread "main" org.apache.poi.POIXMLException:
org.apache.poi.openxml4j.exceptions.InvalidFormatException: A segment shall not
hold any characters other than pchar characters. [M1.6]
    at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:152)
    at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:163)
    at org.apache.poi.util.TestLoad.main(TestLoad.java:49)
Caused by: org.apache.poi.openxml4j.exceptions.InvalidFormatException: A
segment shall not hold any characters other than pchar characters. [M1.6]
    at
org.apache.poi.openxml4j.opc.PackagePartName.checkPCharCompliance(PackagePartName.java:370)
    at
org.apache.poi.openxml4j.opc.PackagePartName.throwExceptionIfPartNameHaveInvalidSegments(PackagePartName.java:270)
    at
org.apache.poi.openxml4j.opc.PackagePartName.throwExceptionIfInvalidPartUri(PackagePartName.java:185)
    at
org.apache.poi.openxml4j.opc.PackagePartName.<init>(PackagePartName.java:83)
    at
org.apache.poi.openxml4j.opc.PackagingURIHelper.createPartName(PackagingURIHelper.java:443)
    at org.apache.poi.POIXMLDocumentPart.read(POIXMLDocumentPart.java:234)
    at org.apache.poi.POIXMLDocumentPart.read(POIXMLDocumentPart.java:244)
    at org.apache.poi.POIXMLDocumentPart.read(POIXMLDocumentPart.java:244)
    at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:150)
    ... 2 more

-- 
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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to