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 2010/01/06 20:23:29 UTC
DO NOT REPLY [Bug 48495] New: Exception received after using
shiftRows and cloneSheet
https://issues.apache.org/bugzilla/show_bug.cgi?id=48495
Summary: Exception received after using shiftRows and
cloneSheet
Product: POI
Version: 3.6
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: XSSF
AssignedTo: dev@poi.apache.org
ReportedBy: bstox@yahoo.com
Created an attachment (id=24805)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=24805)
Test spreadsheet
I have an excel spreadsheet with one worksheet which I use as a template for
multiple worksheets. Prior to cloning the worksheet sometimes I need to insert
a row into the worksheet. When the program is trying to save the spreadsheet I
receive the following exception:
org.apache.xmlbeans.impl.values.XmlValueDisconnectedException
at
org.apache.xmlbeans.impl.values.XmlObjectBase.check_orphaned(XmlObjectBase.java:1213)
at
org.openxmlformats.schemas.spreadsheetml.x2006.main.impl.CTRowImpl.setCArray(Unknown
Source)
at org.apache.poi.xssf.usermodel.XSSFRow.onDocumentWrite(XSSFRow.java:392)
at org.apache.poi.xssf.usermodel.XSSFSheet.write(XSSFSheet.java:2362)
at org.apache.poi.xssf.usermodel.XSSFSheet.commit(XSSFSheet.java:2328)
at org.apache.poi.POIXMLDocumentPart.onSave(POIXMLDocumentPart.java:177)
at org.apache.poi.POIXMLDocumentPart.onSave(POIXMLDocumentPart.java:181)
at org.apache.poi.POIXMLDocument.write(POIXMLDocument.java:214)
at test.AATest.main(AATest.java:21)
I found this bug when converting from HSSF.
This is the test program that shows the error:
package test;
import java.io.*;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.*;
public class AATest {
/**
* @param args
*/
public static void main(String[] args) {
try {
Workbook wb = new XSSFWorkbook("AATest.xlsx");
Sheet sheet = wb.getSheetAt(0);
sheet.shiftRows(2, sheet.getLastRowNum(), 1, true, false);
Row newRow = sheet.getRow(2);
if (newRow == null) newRow = sheet.createRow(2);
newRow.createCell(0).setCellValue(" Another Header");
wb.cloneSheet(0);
FileOutputStream fileOut = new
FileOutputStream("newWorkbook.xlsx");
wb.write(fileOut);
fileOut.close();
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("Done");
}
}
It only happens when the worksheet is cloned.
I'll attach the spreadsheet.
--
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 48495] Exception received after using shiftRows and cloneSheet
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48495
Dominik Stadler <do...@gmx.at> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |WORKSFORME
--- Comment #1 from Dominik Stadler <do...@gmx.at> ---
I could not reproduce this any more with the latest version of POI, please try
with that version and reopen the bug with an updated testcase which reproduces
the problem.
--
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