Hi,
I want to use Aspose.cells for java (free trial for the moment) to test embed different types of files in excel (.pdf, .docx, .png, .jpeg, .txt, .xls, .xlsm …)
My excel result file can be .xls, .xlsx or .xlsm.
At first I test with .xls result file, and some embedded files seems to have problems.
When I click on embedded file .pdf, .docx, .xls, .xlsx, the embedded file is opened, but when I click on embedded file as .txt, .png, .jpeg, .xml, .html … there is an error message "Cannot start the source application for this object"
Is there a restriction on the possible type of embedded file in excel with Aspose.cells for java ?
Thanks
Hi Joëlle,
Hi Raza,
As you suggested, I tried with version Aspose-cells-8.6.2.4.jar, but I still have the same problem : if I embed a text file and then, try to open it (by click on the associated image), I have the following popup error : ‘Cannot start the source application for this object’.
Joëlle
Hi Joëlle,
Thanks for your feedback and reporting the bug nicely and using Aspose.Cells.
We have tested this issue with the following sample code using the latest version 8.6.2.4 and found the issue as described by you.
We have therefore logged this issue in our database for investigation. We will look into it and fix this issue. Once the issue is resolved or we have some other update for you, we will let you know asap.
This issue has been logged as
- CELLSJAVA-41637 - Inserting Ole Objects cause popup error - Cannot start the source application for this object
I have also attached the source excel file used in this code, the output excel file generated by it as well as the image and text file used inside it. Also attached the screenshot showing the popup error for a reference.
**Java**
Workbook wb = new Workbook(“D:\Downloads\sample.xlsx”);
Worksheet ws = wb.getWorksheets().get(0);
String imgFile = “D:\Downloads\sample.png”;
String objFile = “D:\Downloads\sample.txt”;
File file = new File(imgFile);
byte[] binaryImg = new byte[(int)file.length()];
FileInputStream fis = new FileInputStream(file);
fis.read(binaryImg);
file = new File(objFile);
byte[] binaryObj = new byte[(int)file.length()];
fis = new FileInputStream(file);
fis.read(binaryObj);
int idx = ws.getOleObjects().add(4, 4, 200, 200, binaryImg);
OleObject o = ws.getOleObjects().get(idx);
o.setDisplayAsIcon(false);
o.setFileFormatType(FileFormatType.OLE_10_NATIVE);
o.setAutoSize(true);
o.setLink(false);
o.setObjectSourceFullName(“sample.txt”);
o.setProgID(“Packager Shell Object”);
o.setObjectData(binaryObj);
wb.save(“output.xlsx”);
**C#**
Workbook wb = new Workbook(“sample.xlsx”);
Worksheet ws = wb.Worksheets[0];
string imgFile = @“D:\Downloads\sample.png”;
string objFile = @“D:\Downloads\sample.txt”;
byte[] binaryImg = File.ReadAllBytes(imgFile);
byte[] binaryObj = File.ReadAllBytes(objFile);
int idx = ws.OleObjects.Add(4, 4, 200, 200, binaryImg);
OleObject o = ws.OleObjects[idx];
o.DisplayAsIcon = false;
o.FileFormatType = FileFormatType.Ole10Native;
o.IsAutoSize = true;
o.IsLink = false;
o.ObjectSourceFullName = “sample.txt”;
o.ProgID = “Packager Shell Object”;
o.ObjectData = binaryObj;
wb.Save(“output.xlsx”);
Hi,
The issues you have found earlier (filed as CELLSJAVA-41637) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.
Hi,
I reproduce the problem with Aspose 8.6.3.
Error message ‘Cannot start the source application for this object’ is always present for embedded files as xxx.txt.
Hi Joelle,
Workbook wb = new Workbook(dir + “book1.xlsx”);
Worksheet ws = wb.getWorksheets().get(0);
String imgFile = dir + “sample.png”;
String objFile = dir + “sample.txt”;
File file = new File(imgFile);
byte[] binaryImg = new byte[(int)file.length()];
FileInputStream fis = new FileInputStream(file);
fis.read(binaryImg);
file = new File(objFile);
byte[] binaryObj = new byte[(int)file.length()];
fis = new FileInputStream(file);
fis.read(binaryObj);
int idx = ws.getOleObjects().add(4, 4, 200, 200, binaryImg);
OleObject o = ws.getOleObjects().get(idx);
o.setDisplayAsIcon(false);
o.setFileFormatType(FileFormatType.OLE_10_NATIVE);
o.setAutoSize(true);
o.setLink(false);
o.setObjectSourceFullName(“sample.txt”);
o.setProgID(“Packager Shell Object”);
o.setObjectData(binaryObj);
wb.save(dir + “output.xlsx”);