blank.xlsx (8.3 KB) insert.xlsx (9.6 KB)
The following code raises an Invalid Pointer exception after InsertAndCopySheets is used with a Xlsx file that contains a invalid reference (insert.xlsx):
procedure TForm1.Button1Click(Sender: TObject);
var
xls, insertxls: TXlsFile;
begin
xls := TXlsFile.Create(true);
try
insertxls := TXlsFile.Create(true);
try
insertxls.Open('insert.xlsx');
xls.Open('blank.xlsx');
xls.InsertAndCopySheets(1, {xls.SheetCount + } 1, 1, insertxls);
finally
insertxls.Free;
end;
xls.Save('result.xls');
finally
// the following statement raises an Invalid Pointer operation:
xls.Free; // Boom
end
end;
Hi,
Thanks for reporting this, and for the detailed reproducible case. But I couldn't reproduce it here, even using Full debug mode in FASTMM, which is very fast to find this kind of stuff.
Can you confirm that you are using the latest version of FlexCel? (7.22) And if you are, that this exact code with the exact files produces this?
We are about to release 7.23 today, if we can find out quickly what is happening we might be able to put the fix into it.