XlsReadWrite throws an Accessviolation in TXLSDrawing.InsertImage if AFilename: AxUCString leads to file which is not an image or if the file is an image but has a wrong extension (e.g. renamed .png to .txt)
Could you please handle this exception (maybe allow renamed images / check if image is assigned etc.. and/or throw a meaningfull exception.).
Thank you for your help.
AccessViolation in TXLSDrawing.InsertImage
Re: AccessViolation in TXLSDrawing.InsertImage
Hello
Will fix this in the next update.
Will fix this in the next update.
Lars Arvidsson, Axolot Data
Re: AccessViolation in TXLSDrawing.InsertImage
Hello!
Thank you for the fix.
In the current version I still receive a similar problem if I use the InsertImage function with a bmp image which should be included in a xls file:
The function call FGrManager.Images.LoadFromFile(AFilename); in the InsertImage function changes the bmp file to png and also changes the path of the file.
This leads to s EFOpenError exception in the next line:
DoInsertImage(Image,Round(Image.Width * AScale),Round(Image.Heigh * AScale),ACol,ARow,AColOffset,ARowOffset);
since the path with the renamed extension is not found.
Thank you for the fix.
In the current version I still receive a similar problem if I use the InsertImage function with a bmp image which should be included in a xls file:
The function call FGrManager.Images.LoadFromFile(AFilename); in the InsertImage function changes the bmp file to png and also changes the path of the file.
This leads to s EFOpenError exception in the next line:
DoInsertImage(Image,Round(Image.Width * AScale),Round(Image.Heigh * AScale),ACol,ARow,AColOffset,ARowOffset);
since the path with the renamed extension is not found.
Re: AccessViolation in TXLSDrawing.InsertImage
Hello
I can't reproduce this
Which Delphi do you use?
I can't reproduce this
Which Delphi do you use?
Lars Arvidsson, Axolot Data
Re: AccessViolation in TXLSDrawing.InsertImage
Hi!
I use Delphi 10.1 Berlin.
Did you export to an xls file? It works for xlsx files but not for xls files.
I use Delphi 10.1 Berlin.
Did you export to an xls file? It works for xlsx files but not for xls files.
Re: AccessViolation in TXLSDrawing.InsertImage
Hello
Yes, I have tested with XLS files. It still works fine here.
Yes, I have tested with XLS files. It still works fine here.
Lars Arvidsson, Axolot Data
Re: AccessViolation in TXLSDrawing.InsertImage
You just need a bmp file (e.g. test.bmp) and use the example below in order to get an EAccessViolation or an error dialog 'Cannot open... text.png':
Code: Select all
var
lExcelFile : TXLSReadWriteII5;
begin
lExcelFile := TXLSReadWriteII5.Create(nil);
lExcelFile.Filename := 'D:\testfile.xls';
lExcelfile.Version := xvExcel97;
lExcelFile.Add;
lExcelFile[0].Drawing.InsertImage('D:\test.bmp', 1,1, 0, 0, 1);
lExcelfile.Write;
FreeAndNil(lExcelFile);
end;
Re: AccessViolation in TXLSDrawing.InsertImage
Hello
Still no luck. Your code works fine.
Still no luck. Your code works fine.
Lars Arvidsson, Axolot Data