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

            Bug ID: 54907
           Summary: Unreadable content error when reading .xlsx with
                    external links containing U+3000('IDEOGRAPHIC SPACE')
                    character.
           Product: POI
           Version: 3.9
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSLF
          Assignee: [email protected]
          Reporter: [email protected]
    Classification: Unclassified

Created attachment 30241
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=30241&action=edit
The attached excel file for these issue has a external links

Just as simple test, I used POI to read the xlsx file and then immediately
write it out without any modification.  
After writing with POI the xlsx file is unreadable by MS Excel 2010: 
Excel found unreadable content in 'xxx.xlsx'. Do you want to recover the
contents of this workbook?

This is most likely happening because that the external links in workbook
contain U+3000 "IDEOGRAPHIC SPACE" character (commonly called a 'full-width
space').

※ how to create external links in excel
 Define a name by using the New Name dialog box
 1.On the Formulas tab, in the Defined Names group, click Define Name.
 2.In the New Name dialog box, in the Name box, type the name.
 3.To specify the scope of the name, select Workbook.
 4.In the Refers to box, type the cell reference of External Excel file.
   ex)='D:\[1 test.xlsx]Sheet1'!$A$2

This is the code I used: 

/////////////////////////////////
import java.io.FileInputStream;
import java.io.FileOutputStream;

import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;

public class ExternalLinkTest {

    public static void main(String[] args) {

        Workbook workBook = null;
        try {
            workBook = WorkbookFactory
                .create(new FileInputStream("externalLink.xlsx"));

            FileOutputStream fileOut;
            fileOut = new FileOutputStream("output_externalLink.xlsx");
            workBook.write(fileOut);
            fileOut.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
/////////////////////////////////

-- 
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