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

Free Support Forum - aspose.com

Renaming of duplicate worksheet names when combining workbooks

Hi,


I realise this is not a bug but rather an enhancement request.

In Excel, if you move or copy a worksheet from one workbook to another and the destination already contains a worksheet with the same name, Excel renames the source sheet by adding a number in parenthesis after it. (i.e. if two workbooks contain the worksheet called ‘ABC’ and you copy that sheet from one workbook to another, it will be renamed to ‘ABC (2)’.

Using Aspose, the worksheets lose their original name completely. If you have two worksheets called ‘ABC’, copying them over will result it the source sheet being renamed to ‘Sheet2’.
This makes it very confusing when combining workbooks in order to find existing worksheets.

I have attached two example files and and some code:

var wb1 = new Workbook(“B1.xlsx”);
var wb2 = new Workbook(“B2.xlsx”);

wb1.Combine(wb2);

wb1.Save(“B3.xlsx”);

It would be nice for Aspose to mimic Excel in this regard or at least give us the option to have the sheets renamed the way Excel does it (or our own logic by sending in a Func<string, string>).

Best regards.

Hi John,

Thanks for your posting and using Aspose.Cells.

We were able to observe the Excel behavior of renaming worksheets as you described. We have therefore logged an enhancement request for this issue in our database.

We will look into it and fix this issue. Once, the issue is resolved or we have some other update for you, we will let you know asap.

This issue has been logged as

  • CELLSNET-43310 - Renaming of duplicate worksheet names when combining workbooks

Hi,

Thanks for your using Aspose.Cells.

Please download and try the latest fix: Aspose.Cells for .NET v8.3.1.7 and let us know your feedback.

Hi,


This works properly for the simple example I posted above, but in all other cases the algorithm is wrong.

I have attached, again, two files.
This time B2.xlsx contains “ABC” as well as “ABC (2)” as sheets.

Combining them with B1.xlsx (which contains “ABC”) should create a third sheet containing (this is what Excel does):

ABC
ABC (2)
ABC (3)

But instead of “ABC (3)” it creates “ABC (2) (3)”.


Best regards.

Hi John,


Thank you for your valuable feedback.

We have recorded your observations (along with samples) to the ticket (CELLSNET-43310) already associated with this thread for further analysis. Please spare us little time for proper investigation of your presented scenario. As soon as we receive more updates in this regard, we will post here for your kind reference.

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


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