ASF Bugzilla – Attachment 20308 Details for
Bug 23951
setSheetOrder(...) of HSSFWorkBook class doesn't set tab name correctly in Excel file
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
patch that fixes the tab order problem
patch (text/plain), 2.29 KB, created by
Andy Oliver
on 2007-06-04 06:51:24 UTC
(
hide
)
Description:
patch that fixes the tab order problem
Filename:
MIME Type:
Creator:
Andy Oliver
Created:
2007-06-04 06:51:24 UTC
Size:
2.29 KB
patch
obsolete
>Index: src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java >=================================================================== >--- src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java (revision 543521) >+++ src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java (working copy) >@@ -321,6 +321,7 @@ > */ > > public void setSheetOrder(String sheetname, int pos ) { >+ sheets.add(pos,sheets.remove(getSheetIndex(sheetname))); > workbook.setSheetOrder(sheetname, pos); > } > >Index: src/java/org/apache/poi/hssf/model/Workbook.java >=================================================================== >--- src/java/org/apache/poi/hssf/model/Workbook.java (revision 543521) >+++ src/java/org/apache/poi/hssf/model/Workbook.java (working copy) >@@ -738,6 +738,7 @@ > > SSTRecord sst = null; > int sstPos = 0; >+ boolean wroteBoundSheets = false; > for ( int k = 0; k < records.size(); k++ ) > { > >@@ -745,6 +746,7 @@ > // Let's skip RECALCID records, as they are only use for optimization > if ( record.getSid() != RecalcIdRecord.sid || ( (RecalcIdRecord) record ).isNeeded() ) > { >+ int len = 0; > if (record instanceof SSTRecord) > { > sst = (SSTRecord)record; >@@ -754,7 +756,17 @@ > { > record = sst.createExtSSTRecord(sstPos + offset); > } >- int len = record.serialize( pos + offset, data ); >+ if (record instanceof BoundSheetRecord) { >+ if(!wroteBoundSheets) { >+ for (int i = 0; i < boundsheets.size(); i++) { >+ len+= ((BoundSheetRecord)boundsheets.get(i)) >+ .serialize(pos+offset+len, data); >+ } >+ wroteBoundSheets = true; >+ } >+ } else { >+ len = record.serialize( pos + offset, data ); >+ } > ///// DEBUG BEGIN ///// > // if (len != record.getRecordSize()) > // throw new IllegalStateException("Record size does not match serialized bytes. Serialized size = " + len + " but getRecordSize() returns " + record.getRecordSize());
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 23951
: 20308