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 2007/03/27 21:44:42 UTC
DO NOT REPLY [Bug 23951] - setSheetOrder(...) of HSSFWorkBook class doesn't set tab name correctly in Excel file
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=23951>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=23951
lingjiao.chen@tcg.com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |lingjiao.chen@tcg.com
------- Additional Comments From lingjiao.chen@tcg.com 2007-03-27 12:44 -------
Here's a better workaround for using setSheetOrder() without using cloneSheet()
method. The current open-source version will not
support sheet cloning if the sheet has any embedded images or objects. As
you've probably found out, setSheetOrder() only swaps
the actual sheet content -- not the sheet's name. So you'll need to manually
set that on your own.
As regards to the contents not swapping properly, try not to think about it
as 'sheet 3 BEFORE sheet 1', but rather the opposite
direction. So if you write the code as:
workbook.setSheetName(sheetNameWhereIndexIsZero, 3); //this will work.
Anyways, here's my arbitrary positioned workaround:
//sheetName buffer.
int intTotalSheet = workbbook.getNumberOfSheets();
String[] straSheetName = new String[intTotalSheet];
for (int b=0; b<intTotalSheet; b++)
straSheetName[b] = workbook.getSheetName(b);
workbook.setSheetName(intTotalSheet-1, "newSheet");
workbook.setSheetName(0, SHEET_NAME);
for(int a = 1; a < intTotalSheet; a++)
{
workbook.setSheetName(a, straSheetName[a-1]);
}
workbook.setSheetOrder(wb.getSheetName(0), intTotalSheet-1);
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
Mailing List: http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/