https://issues.apache.org/bugzilla/show_bug.cgi?id=54750
Bug ID: 54750
Summary: [PATCH] Modify SXSSFWorkbook to allow modification of
existing cells
Product: POI
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P2
Component: SXSSF
Assignee: [email protected]
Reporter: [email protected]
Classification: Unclassified
Created attachment 30101
--> https://issues.apache.org/bugzilla/attachment.cgi?id=30101&action=edit
Contains a patch for SXSSFWorkbook and SXSSFSheet to allow template sheet cells
to be modified.
The attached patch allows SXSSFWorkbook users to transparantly access and
modify rows and cells in a template workbook. Newly created rows are added
through a sliding window as before. This means the following limitations as
documented in SXSSFWorkbook are removed:
* Access initial cells and rows in the template. After constructing
SXSSFWorkbook(XSSFWorkbook) all internal windows are empty and
SXSSFSheet@getRow and SXSSFRow#getCell return null.
* Override existing cells and rows. The API silently allows
that but the output file is invalid and Excel cannot read it.
With this patch applied, SXSSF workbooks with existing cells that have been
modified can be opened in Excel 2007 and earlier without producing an error
message like this:
"Excel found unreadable content in 'NewBook.xlsx'."
I created this patch back in January but as of last week the affected files
hadn't changed in the trunk. We've used this in production since then without
any problems. There's no new test cases included with this patch. The existing
tests pass (or passed, back in January).
Here's a description of the modifications made by the patch.
Modified file: src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFSheet.java
Modified methods:
removeRow
Removes the row from the template if it originated in the template worksheet.
getRow
Returns the row from the template if the row number exists in the template
worksheet.
getPhysicalNumberOfRows
Includes the number of rows from the template in the total.
getFirstRowNum
Returns the number of the first row of the template if that number is lower
than the first row number of the sliding window (which should be the case
unless the template is empty).
getLastRowNum
Returns the number of the last row of the template unless the row number of
the last
row in the sliding window is higher.
rowIterator
JavaDoc change only. This still only iterates over rows in the sliding window
and not
over rows in the template.
groupRow
Also increases the group level of rows in the template, if applicable.
Modified file: src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook
Removed a JavaDoc segment that describes the limitation that has been removed
by the patch to SXSSFSheet.
Thanks,
Omer van der Horst Jansen
--
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]