Created attachment 32171 [details] The file used in my tests Same use case as in bug #57165. To keep only a selected sheet, I have to move it at first position, then delete the others. But if this sheet is the active one (or, perhaps, the selected one), Excel 2010 then complains about the file it opens. Looking at the file it points out, I found out that the reference to the active sheet has not been updated, so it points now to a non-existing sheet. French Excel error message is: Enregistrements supprimés: Affichage dans la partie /xl/workbook.xml (Classeur) which can be roughly translated to: Removed records: Display in the /xl/workbook.xml part (Workbook) When I open the pointed out file, I see: <?xml version="1.0" encoding="UTF-8"?> <workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><fileVersion appName="xl" lastEdited="5" lowestEdited="5" rupBuild="9303"/><workbookPr filterPrivacy="1" defaultThemeVersion="124226"/><bookViews><workbookView xWindow="120" yWindow="210" windowWidth="21075" windowHeight="7680" activeTab="5"/></bookViews><sheets><sheet name="Informative" sheetId="7" r:id="rId6"/></sheets><calcPr calcId="125725"/></workbook> Notice the activeTab="5" part. Also notice the sheetId="7" r:id="rId6" part, which might be part of the bug above mentioned.
Created attachment 32175 [details] Show bugs
Added a standalone class that loads the sample Excel file and reproduce the bugs (three bugs are shown, I numbered them with the Bugzilla id). You might need to adjust the path to the sample.
Created attachment 32199 [details] Proposed fix which adjusts the active sheet in setSheetOrder() and removeSheet() FYI, I have a proposed fix for this and bug 57163, but would like to postpone checkin until after release 3.11 as it runs a slight risk of breaking stuff.
Fixed this and Bug 57163 via r1647264