XLS file corrupt after deleting sheets
Posted: Tue Apr 10, 2018 8:00 am
Hi,
After updating to the latest XLSRW6 for some bug fixes, we found a new issue with generated files sometimes being corrupt. I traced it to below code change in the following function.
This is in the latest version and it causes the generated file to be corrupt:
What happens is that N.LocalSheetId becomes negative (-2) after deleting a few sheets from the end . Then the saved file is corrupt.
This is in the previous version I used and it works:
After updating to the latest XLSRW6 for some bug fixes, we found a new issue with generated files sometimes being corrupt. I traced it to below code change in the following function.
Code: Select all
procedure TXLSNames_Int.AdjustSheetDelete(const ASheetIndex, ACount: integer);
Code: Select all
case N.SimpleName of
xsntNone: begin
FFormulas.AdjustSheetIndex(N.Ptgs,N.PtgsSz,ASheetIndex,-ACount);
N.LocalSheetId := N.LocalSheetId - ACount;
end;
This is in the previous version I used and it works:
Code: Select all
case N.SimpleName of
xsntNone: FFormulas.AdjustSheetIndex(N.Ptgs,N.PtgsSz,ASheetIndex,ACount);