Free Support Forum -

PDF file cannot be opened after embedding it in Excel file in Azure function

Hi @leoluo,
Yes, it is resolved the “System.text.encoding.codepages” errors.
but pdf file is not opening. also if we set the property as fileformatetype.unknown then it is not showing the image icon for zip, jpeg, msg format types.

Please find the attached poc also excel sheet which has generated using 20.2 version.

Thanks, (897.7 KB)

2021-09-2– (867.9 KB)

We have observed the issue where embedded PDF file is not opening from the output Excel file. This issue is logged in our database for further investigation and you will be notified here once any update is ready for sharing.

This issue is logged as:
CELLSNETCORE-105 - PDF file cannot be opened after embedding it in Excel file in Azure function

Please explain it more and provide running solution for testing and reproducing this issue here.

Hi @ahsaniqbalsidiqui,

If I don’t set the property for FileFormatType, by default it is displaying the proper icons for docs, pdf and xlsx, but for msg, zip, jpeg, xlsm and few xlsx files are displaying with some unknown icons. attached the screenshot for the reference.

Please advise me, how to handle those icons.

Thanks,AttachmentDisplayIcons.PNG (44.5 KB)

We have noted the issue and logged it with the ticket.


Just to add to my previous post, xlsm files are opening in previous versions of aspose but using SetEmbeddedObject method -> xlsm files are not opening.


Thank you for more information. We have noted it for our reference.

Hi @ahsaniqbalsidiqui,

Please let me know if you have any update on below queries? i.e.

  1. PDF, xlsm format types are not opening.
  2. For unknown type formats icons are not showing.


We are gathering information about this issue and will share our feedback soon.


Could you share a template XLSX file (with embedded PDF file) which is created by MS Excel? Also, which PDF viewer is installed in your machine?

Please try the latest fix 21.2.4.
Aspose.Cells21.2.4 For .NetStandard20.Zip (5.5 MB)

Thanks @simon.zhao, I will try with this dll and let you know very soon.

Hi @simon.zhao/ @Amjad_Sahi,

I was using PDF - xchange editor, and now I have installed adobe reader and tried.
Now pdf’s are opening in adobe reader and still yet to check these extension’s ( * .xls,* .xlsm,* .xlt,* .xlts) types.

Also could you please let me know how to display the custom icons for unknown format types like jpeg, zip and msg …etc??



Good to know that PDF files are opening on your end now. Regarding other file formats, please do test and let us know your results.

For displaying the custom icons for unknown types, we will check and get back to you for further updates.

Hi @Amjad_Sahi,
Xlsm files are not opening and able to open xlt and xlsx files. Please find the attached generated file from code.

Also, kindly provide the solution to display the custom icons for unknown format types. (259.2 KB)


We have noted your feedback and will analyze it while working on this issue.


  1. The embedded XLSM file is corrupted, please share us your template XLSM file and sample code, we will check it soon.
  2. As we cannot add all icons of the files, so please add correct icons when calling OleObjectCollection.Add(, byte[]),then we can redraw the image with added image data if we could not find corresponding icon of the file.

Hi @Amjad_Sahi,

  1. I could able to open this file, but when I tried to open as a attachment then the issue is coming. Please find attached xlsm file.

  2. I am using below peace of code for zip file attachment, but still I could not able to see any icon other then default icon.
    byte[] binaryXlsx4;
    fullPath = Path.Combine(fullPath, “Images\zip.png”);

                     //converting display image into bytes
                     byte[] binaryImg4 = File.ReadAllBytes(fullPath);
                     int idxOle = worksheet.OleObjects.Add(row, col, 60, 60, binaryImg4);
                     OleObject objOle = worksheet.OleObjects[idxOle]; // worksheet.OleObjects[idxOle];
                     binaryXlsx4 = File.ReadAllBytes(filesPath + "\\AttachmentFiles\\");
                     objOle.SetEmbeddedObject(false, binaryXlsx4, "", true, "abcd");

Thanks, (93.2 KB)


Thanks for the template XLSM file and code segment.
We will evaluate and get back to you soon.