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 2012/07/27 14:45:17 UTC

[Bug 53611] New: Incorret dimension set in created workbook sheet xml file

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

          Priority: P2
            Bug ID: 53611
          Assignee: dev@poi.apache.org
           Summary: Incorret dimension set in created workbook sheet xml
                    file
          Severity: normal
    Classification: Unclassified
                OS: Linux
          Reporter: math2306@hotmail.com
          Hardware: PC
            Status: NEW
           Version: 3.8
         Component: XSSF
           Product: POI

Created attachment 29120
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=29120&action=edit
Small java project build with maven to create example .xlsx file having
incorrect dimension ref value set in workbook sheet xml file

After creating and writing an XSSFWorkbook with some rows and cells to a file
the sheet XML file included in .xlsx archive has an incorrect value for
attribute 'ref' of tag 'dimension':

<worksheet>
 <dimension ref="A1"/>
 <sheetViews>
  <sheetView ...


It's always set to 'A1' no matter how many rows and cells are actually in the
sheet. The dimension is only initialized on creation of worksheet in class
XSSFSheet:

XSSFSheetworksheet.newSheet(){
 ...
 worksheet.addNewDimension().setRef("A1");
 ...
}

I included a example java app showing the. Build it with maven:

cd poi-bug
mvn package
java -jar target/poi-bug-0.1-SNAPSHOT-jar-with-dependencies.jar

After successful execution the project folder contains the file 'poi-bug.xlsx'.
Unzip file and open 'xl/worksheets/sheet1.xml' containing the dimension tag.

-- 
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 53611] Incorret dimension set in created workbook sheet xml file

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

--- Comment #6 from Mahesh <mp...@gmail.com> ---
Thanks! Ryan for your reply,

I am getting this error even I remove this reference code. I have added it to
see if its work for this issue.

I am generating report and have kept all the columns names less than 31
character including sheet name.

Your help will be much appreciated!

-- 
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 53611] Incorret dimension set in created workbook sheet xml file

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

--- Comment #10 from Mathias Rühle <ma...@hotmail.com> ---
Thanks, Ryan for the workaround. Works. Now IBM SPSS Statistics imports all
columns and rows without manual help. Hope they will fix it soon in POI.
XSSFSheet.getCTWorksheet is annotated with @Internal marking this as possibly
being removed in future releases :(.

-- 
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 53611] Incorret dimension set in created workbook sheet xml file

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

--- Comment #8 from Ryan <Ry...@Teradata.com> ---
(In reply to comment #6)
> Thanks! Ryan for your reply,
> 
> I am getting this error even I remove this reference code. I have added it
> to see if its work for this issue.
> 
> I am generating report and have kept all the columns names less than 31
> character including sheet name.
> 
> Your help will be much appreciated!

Also, make sure you let your program finish writing.  If you don't check the
progress or notify the user when it is done, then the excel generation could
still be occurring.  I made this mistake by trying to open it too fast before
the program was finished.  You can use task manager to see when it stops using
CPU and then its done.  My program takes around 1 min 15 sec to write a .xlsx
file that is 200,000 rows by 41 columns

-- 
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 53611] Incorret dimension set in created workbook sheet xml file

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

Mahesh <mp...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ErrorMessage
           Priority|P2                          |P1
            Version|3.8                         |3.7
           Severity|normal                      |major

--- Comment #4 from Mahesh <mp...@gmail.com> ---
Getting following error for POI 3.7-
"Excel found unreadable content in 'out.xlsx'. Do you want to recover the
contents of this workbook ? If you trust the source of this workbook, click
Yes."

I have tried searching the fix for it, please paste the fix if anyone knows.

I have tried following remedy, but in vain-
XSSFWorkbook wb = new XSSFWorkbook();
XSSFSheet sheet = wb.createSheet("Q");            
sheet.getCTWorksheet().getDimension().setRef("A1:K47");

-- 
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 53611] Incorret dimension set in created workbook sheet xml file

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

--- Comment #7 from Ryan <Ry...@Teradata.com> ---
Then your problem has nothing to do with this bug, and you just have bad Excel
generation code.  This bug has nothing to do with unreadable content.

-- 
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 53611] Incorret dimension set in created workbook sheet xml file

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

--- Comment #1 from Mathias Rühle <ma...@hotmail.com> ---
copy and paste error in source code:

it's 

XSSFSheet.newSheet(){

not:
XSSFSheetworksheet.newSheet(){

-- 
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 53611] Incorret dimension set in created workbook sheet xml file

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

--- Comment #2 from Mathias Rühle <ma...@hotmail.com> ---
Same bug described here:

http://stackoverflow.com/questions/7204217/poi-creates-xlsx-files-incompletely-or-wronglythe-dimension-tag-in-the-xlsx-xml

-- 
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 53611] Incorret dimension set in created workbook sheet xml file

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

Ryan <Ry...@Teradata.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Ryan.Harris@Teradata.com

-- 
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 53611] Incorret dimension set in created workbook sheet xml file

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

--- Comment #5 from Ryan <Ry...@Teradata.com> ---
(In reply to comment #4)
> Getting following error for POI 3.7-
> "Excel found unreadable content in 'out.xlsx'. Do you want to recover the
> contents of this workbook ? If you trust the source of this workbook, click
> Yes."
> 
> I have tried searching the fix for it, please paste the fix if anyone knows.
> 
> I have tried following remedy, but in vain-
> XSSFWorkbook wb = new XSSFWorkbook();
> XSSFSheet sheet = wb.createSheet("Q");			
> sheet.getCTWorksheet().getDimension().setRef("A1:K47");

Mahesh - remove setting the reference from your code, generate an .xlsx file,
and make sure that the file is readable by Excel.  In other words, did your
file generation work until you added the reference change?  Incorrect
references will not cause the file to be unreadable.

-- 
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 53611] Incorret dimension set in created workbook sheet xml file

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

Mathias Rühle <ma...@hotmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |math2306@hotmail.com

-- 
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 53611] Incorret dimension set in created workbook sheet xml file

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

Mathias Rühle <ma...@hotmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|ErrorMessage                |

-- 
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 53611] Incorret dimension set in created workbook sheet xml file

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

Mathias Rühle <ma...@hotmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|3.7                         |3.9

--- Comment #9 from Mathias Rühle <ma...@hotmail.com> ---
Problem still exists for XSSFWorkbook in POI version 3.9 .

-- 
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 53611] Incorret dimension set in created workbook sheet xml file

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

--- Comment #3 from Ryan <Ry...@Teradata.com> ---
I have found a workaround to this bug.  You can set the dimension reference
yourself.  I am using SXSSF in my application, but the workaround is possible
for either SXSSF or XSSF.

It should also be an easy bug to fix for POI.

Here is the code snippet: (wb is a SXSSFWorkbook)

CTWorksheet ctSheet = wb.getXSSFWorkbook().getSheetAt(0).getCTWorksheet();
ctSheet.getDimension().setRef("A1:D47");

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