We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Worksheet codeName changes with sheet rename

Excel has a property associated with worksheets called the “code name”. http://msdn.microsoft.com/en-us/library/office/ff837552.aspx

Aspose has an API (Worksheet.getCodeName() -http://www.aspose.com/docs/display/cellsjava/Worksheet) to return this and we want to use it. However the API doesn’t seem to work - it always returns the user-visible name of the worksheet instead of the code name. We can tell it’s not working because when we rename a sheet in Excel’s UI the code name returned by Aspose changes too.

See attached files for an example. The sheet named “modified” in 3sheets-before.xlsx was renamed to “changed” in 3sheets-after.xlsx. Calling Worksheet.getCodeName() on those two sheets returns “modified” and “changed” respectively - it should return an equivalent String.

If you look at the Excel source (.xlsx files are zips, unzip them and look at /xl/workbook.xml) it appears that the sheet code name is saved in the “sheetId” attribute of the “sheet” tag. They look like simple integers but they are consistent between the before and after versions. I don’t think “sheetId” is just a numbering of the sheets because there’s no sheetId=“3” in the after version, but there is sheetId=“4”. This is expected because the sheet with sheetId=“3” in the before version was deleted and a new sheet was added.


I have opened your second file into MS Excel’s visual basic editor and confirmed the code name is “changed”, so Aspose.Cells does return it ok.
Sample code:
Workbook workbook = new Workbook(“3sheets-after.xlsx”);

And, see the screen shot attached taken in MS Excel here.

Thank you.


Thanks for the quick response, but you’re not reading your screenshot correctly. The worksheet codeName is the property named “(name)”. This is what Worksheet.getCodeName() should be returning. The value of this property does not change when the worksheet is renamed or moved.

The property named “name” that you have circled in red is the worksheet name, which is returned by Worksheet.getName(). This value is shown to the user in the Excel tab UI.



Thanks for pointing it out.

Now, I understand your issue a bit, The Worksheet.getCodeName() should return “Sheet2” instead.

I have logged a ticket with an id “CELLSJAVA-40492” for your issue. We will look into your issue soon.

Once we sort it out, we will let you know here.

Thank you.


Thanks for your posting and using Aspose.Cells for Java

We have attached the java version.

Please download and try this fix: Aspose.Cells for Java v7.4.3.1 and let us know your feedback.

The issues you have found earlier (filed as CELLSJAVA-40492) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.