You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2011/11/05 21:06:31 UTC

DO NOT REPLY [Bug 52142] New: Unable to read excel 2007 with structure locked

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

             Bug #: 52142
           Summary: Unable to read excel 2007 with structure locked
           Product: POI
           Version: 3.8-dev
          Platform: PC
        OS/Version: Windows Vista
            Status: NEW
          Severity: blocker
          Priority: P2
         Component: XSSF
        AssignedTo: dev@poi.apache.org
        ReportedBy: suresh54145@gmail.com
    Classification: Unclassified


I am able to open the excel 2007 but when I protect it with structure
locking..I am not able to open it. I am using poi-3.8.beta4.

I dont think something is wrong with excel sheet.

Code:

 XSSFWorkbook workbook=null;
            InputStream inputStream = null;

                inputStream = new FileInputStream(new File("G:\\test.xlsx"));

            workbook=     new XSSFWorkbook(inputStream);


Error:


Exception in thread "main" org.apache.poi.POIXMLException:
org.apache.poi.openxml4j.exceptions.InvalidFormatException: Package should
contain a content type part [M1.13]
    at org.apache.poi.util.PackageHelper.open(PackageHelper.java:41)
    at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:178)
    at com.poi.xssf.XSSFWorkBook.main(XSSFWorkBook.java:97)
Caused by: org.apache.poi.openxml4j.exceptions.InvalidFormatException: Package
should contain a content type part [M1.13]
    at
org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:148)
    at org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:615)
    at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:229)
    at org.apache.poi.util.PackageHelper.open(PackageHelper.java:39)
    ... 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: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 52142] Unable to read excel 2007 with structure locked

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52142

--- Comment #2 from Yegor Kozlov <ye...@dinom.ru> 2011-11-07 07:19:14 UTC ---
It is hard to tell what is wrong without a sample file.

Please post the initial file (not locked), the locked file and detailed
instructions how you created it in Excel, i.e. what operations you did to
produce content that POI cannot read.

Yegor

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


[Bug 52142] Unable to read excel 2007 with structure locked

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52142

--- Comment #5 from Suyog <su...@gmail.com> ---
I am also getting same issue with file created/updated using Microsoft office
2007.

Please let me know if you find any solution

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


DO NOT REPLY [Bug 52142] Unable to read excel 2007 with structure locked

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52142

--- Comment #3 from suresh babu <su...@gmail.com> 2011-11-07 15:12:46 UTC ---
I have created test.xlsx sheet and added text 'test' in the first cell. I have
added the latest jar files of poi 3.8 beta 4 version on build path.

Below is the code used to read the sheet.

           XSSFWorkbook workbook=null;
                InputStream inputStream = null;

                    inputStream = new FileInputStream(new
File("G:\\test.xlsx"));

                workbook=     new XSSFWorkbook(inputStream);
                XSSFSheet sheet=workbook.getSheetAt(0);
                XSSFRow row=sheet.getRow(0);
                XSSFCell cell=row.getCell(0);
                System.out.println("cell value is--"+cell.toString());

output:

cell value is--test

I used the review-->protect workbook-->protect structure and windows..then gave
'suresh' as password and save the excel sheet as 'test_structure_locked.xlsx'.

then I tried to read this new file with the below code. It seems it is not able
to read the excel sheet whose structure is locked.

 XSSFWorkbook workbook=null;
                InputStream inputStream = null;

                    inputStream = new FileInputStream(new
File("G:\\test_structure_locked.xlsx"));

                workbook=     new XSSFWorkbook(inputStream);
                XSSFSheet sheet=workbook.getSheetAt(0);
                XSSFRow row=sheet.getRow(0);
                XSSFCell cell=row.getCell(0);
                System.out.println("cell value is--"+cell.toString());

Error:
Exception in thread "main" org.apache.poi.POIXMLException:
org.apache.poi.openxml4j.exceptions.InvalidFormatException: Package should
contain a content type part [M1.13]
    at org.apache.poi.util.PackageHelper.open(PackageHelper.java:41)
    at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:178)
    at com.poi.xssf.XSSFWorkBook.main(XSSFWorkBook.java:98)
Caused by: org.apache.poi.openxml4j.exceptions.InvalidFormatException: Package
should contain a content type part [M1.13]
    at
org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:148)
    at org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:615)
    at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:229)
    at org.apache.poi.util.PackageHelper.open(PackageHelper.java:39)
    ... 2 more





(In reply to comment #0)
> I am able to open the excel 2007 but when I protect it with structure
> locking..I am not able to open it. I am using poi-3.8.beta4.
> 
> I dont think something is wrong with excel sheet.
> 
> Code:
> 
>  XSSFWorkbook workbook=null;
>             InputStream inputStream = null;
> 
>                 inputStream = new FileInputStream(new File("G:\\test.xlsx"));
> 
>             workbook=     new XSSFWorkbook(inputStream);
> 
> 
> Error:
> 
> 
> Exception in thread "main" org.apache.poi.POIXMLException:
> org.apache.poi.openxml4j.exceptions.InvalidFormatException: Package should
> contain a content type part [M1.13]
>     at org.apache.poi.util.PackageHelper.open(PackageHelper.java:41)
>     at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:178)
>     at com.poi.xssf.XSSFWorkBook.main(XSSFWorkBook.java:97)
> Caused by: org.apache.poi.openxml4j.exceptions.InvalidFormatException: Package
> should contain a content type part [M1.13]
>     at
> org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:148)
>     at org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:615)
>     at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:229)
>     at org.apache.poi.util.PackageHelper.open(PackageHelper.java:39)
>     ... 2 more

(In reply to comment #0)
> I am able to open the excel 2007 but when I protect it with structure
> locking..I am not able to open it. I am using poi-3.8.beta4.
> 
> I dont think something is wrong with excel sheet.
> 
> Code:
> 
>  XSSFWorkbook workbook=null;
>             InputStream inputStream = null;
> 
>                 inputStream = new FileInputStream(new File("G:\\test.xlsx"));
> 
>             workbook=     new XSSFWorkbook(inputStream);
> 
> 
> Error:
> 
> 
> Exception in thread "main" org.apache.poi.POIXMLException:
> org.apache.poi.openxml4j.exceptions.InvalidFormatException: Package should
> contain a content type part [M1.13]
>     at org.apache.poi.util.PackageHelper.open(PackageHelper.java:41)
>     at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:178)
>     at com.poi.xssf.XSSFWorkBook.main(XSSFWorkBook.java:97)
> Caused by: org.apache.poi.openxml4j.exceptions.InvalidFormatException: Package
> should contain a content type part [M1.13]
>     at
> org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:148)
>     at org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:615)
>     at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:229)
>     at org.apache.poi.util.PackageHelper.open(PackageHelper.java:39)
>     ... 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: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 52142] Unable to read excel 2007 with structure locked

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52142

Yegor Kozlov <ye...@dinom.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO
           Severity|blocker                     |normal

--- Comment #1 from Yegor Kozlov <ye...@dinom.ru> 2011-11-07 07:18:14 UTC ---
It is hard to tell what is wrong without a sample file.

Please post the initial file (not locked), the locked file and detailed
instructions how you created it in Excel, i.e. what operations you did to
produce content that POI cannot read.

Yegor

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


DO NOT REPLY [Bug 52142] Unable to read excel 2007 with structure locked

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52142

--- Comment #4 from suresh babu <su...@gmail.com> 2011-11-08 16:12:07 UTC ---
Created attachment 27910
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=27910
excel used to check the funtionality

Hi,

I have added the excel sheets used to test the code mentioned in the previous
post.

Thanks,
Suresh A

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