_FilterDatabase Naming Conflict error when opening Excel 2003 XLS file into Excel 2007

Steps of code:

  1. Starting with a version 2003 .XLS template file containing multiple sheets having autofilter enabled
  2. populate data into multiple sheets
  3. remove unused sheets from workbook using Worksheets.RemoveAt(“Pending Jobs”)
  4. save as version2003 using Save(FileName, FileFormatType.Excel2003)
Code completes and saves .XLS file without error. An error occurs when opening the workbook in Excel 2007 that had a sheet removed.

“Naming Conflict” error message pop-up from Excel 2007 forces user to rename “_FilterDatabase” to something else. “_FilterDatabase” appears to be the name of the range of autofiltered cells in the resulting workbook. But this name is not used in the source template workbook.

The .XLS workbook with removed sheet(s) may be opened in Excel 2003 without issue.

If I save as a .XLSX workbook (FileFormatType.Excel2007Xlsx) there is no error opening in Excel 2007 with the removed sheets.

Is there another method I should be using to remove these sheets?

Hi,

Thank you for considering Aspose.

Please share your template file and sample code to reproduce the issue and we will check it soon.

Also, I have attached the latest fix so you may test your scenario with it and let us know if it works fine for you.

Thank You & Best Regards,

Hi,

Thank you for considering Aspose.

You may try calling Worksheets.SortNames() before saving the workbook and see if it works fine for you.

Thank You & Best Regards,

Just wanted to post that the final resolution was a combination of moving and removing sheets based on index number rather than name

Dim last As Int32 = wbAspose.Worksheets.Count() - 1
sheet.Move(last)
wbAspose.Worksheets.RemoveAt(last)
plus the sorting prior to saving

wbAspose.Worksheets.SortNames().
wbAspose.Save(FileName, FileFormatType.Excel2003)

The .xls workbook then opens in Excel 2007 without the name conflict error.

Thank you for your help.