Issues while inserting attachments in excel worksheet

@srinivasaraju.b
Please try the latest fix
Aspose.Cells20.12.4 For .NetStandard20.Zip (5.4 MB)

@simon.zhao
I don’t see any change in this fix, it is not displaying the label names on attachments. it would be great if guys could provide one sample solution which will display the attachments in excel along with label names. Below is the method I’m using from this latest fix.

objOle.SetEmbeddedObject(false, binaryXlsx, info.DocumentName, true, “testfile”);

Thanks,

@srinivasaraju.b,
We have noted your response and will share our feedback soon.

Hello, I share a fix .sln, it contains:
1, ExcelAttachments-POC: this is your test project, but running with Aspose Cells 12.04, it will get a correct result in my environment.
2, TestDotNetCoreProject: a very simple test project.
Please try them, and tell us your result, thank you!ExcelAttachments-POC_fix.zip (5.9 MB)

@leoluo
Thank you for the POC and now it is displaying the labels for attachments. But when I click on the attachment it is not opening the file. Please see the attached screen shots.AttachmentOpenImage.PNG (22.4 KB)
AttachmentIcon.PNG (4.5 KB)

Thanks,

@srinivasaraju.b,
The POC project is displaying the labels as well as opening the attachments on my end. Result.zip (31.2 KB)

Could you run this once again without any changes and share your output file here.

Please try our latest version/fix: Aspose.Cells for .NET v20.12.5 (attached).

Let us know your feedback.
Aspose.Cells20.12.5 For .Net2_AuthenticodeSigned.Zip (5.5 MB)
Aspose.Cells20.12.5 For .Net4.0.Zip (5.5 MB)
Aspose.Cells20.12.5 For .NetStandard20.Zip (5.5 MB)

And in 20.12.5, we have updated the following versions of the NuGet reference package:
System.Drawing.Common 4.7.0 -> 5.0.0
System.Text.Encoding.CodePages 4.7.0 -> 5.0.0

About this method:

OleObject.SetEmbeddedObject(bool linkToFile, byte[] objectData, string sourceFileName, bool displayAsIcon, string label)

If linkToFile is true, then sourceFileName will work and objectData will be ignored.
If linkToFile is false, then objectData will work and sourceFileName will be ignored.
Only when displayAsIcon is true, the Label will work and the picture will be automatically redrawn,
In TestDotNetCoreProject, please make a change, call it like this:

objOle.SetEmbeddedObject(false, binaryXlsx, dir + “TestFile.xlsx”, true, “abcd”);

@ahsaniqbalsidiqui I could able to open attachments in your file, but if I run the solution in my local and open it is not opening. Attached the excel file. Please have a look.
dest.zip (9.3 KB)

@leoluo
Will this support multiple attachments in the same excel sheet? tried in my solution but every time it is attaching only the last one.
2) Will this code support pdf & jpeg as well?

@srinivasaraju.b,
I have tried the scenario again but could not observe any issue. Could you please share your latest sample solution which you are trying after incorporating the above mentioned options here. We will try the scenario and share our feedback accordingly.

Regarding the support for pdf and jpeg, we are gathering information about it and will share our feedback soon.

ExcelAttachments-POC_12-01-2021.zip (7.4 MB)

@ahsaniqbalsidiqui, please find attached zip file having the sample poc and let me know whether the attachment is opening or not?

@srinivasaraju.b
Please try the latest fix 20.12.6 Aspose.Cells20.12.6 For .NetStandard20.Zip (5.5 MB) with attached Program.csProgram.zip (1.3 KB)

The issues you have found earlier (filed as CELLSNETCORE-90) have been fixed in this update. This message was posted using Bugs notification tool by simon.zhao

@aspose.notifier: thank you for the update.
.NET 21.1 this version solved my issue finally, but only thing is there is no file format type for JPEG, ZIP, MSG. but if I set UnKnown the image is displaying like attached file.
Unknown.PNG (4.6 KB)

@srinivasaraju.b,
We have noted your concern and will share our feedback soon.

Also, this 21.1 version working in my POC but when I integrate this code in my real project getting the attached error, I have manually copied to bin folder of the solution but still getting the same issue…please find attached screen shot for reference.Aspose Error.PNG (21.3 KB)

@srinivasaraju.b,
Could you please try to add the System.Text.Encoding.CodePages manually and see if issue is resolved or not?

@ahsaniqbalsidiqui,
I have added the reference directly to the project instead of nuget, still having the same issue.

@srinivasaraju.b,
Please note, latest version of Aspose.Cells for NetStandard20 assembly (Aspose.Cells v21.1) also requires to install System.Drawing.Common (version >= 5.0.0) and System.Text.Encoding.CodePages (version >= 5.0.0) APIs to make it work. So, you should install these APIs manually (you may get these namespaces from nuget). Alternatively, try installing the new version (Aspose.Cells for .NET v21.1) from NuGet repos. (if possible) as when you get/install Aspose.Cells from nuget repos., these additional dependencies (APIs) will be installed automatically.

If this still does not work after you have installed/referenced System.Text.Encoding.CodePages in your .NetCore program, you may try to call the following method to register encoding Provider, see the line of code which you need to add the line at the start:
i.e.,
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
(we also provide “CellsHelper.InitForDotNetCore()” method, and you may also call it first for all .NetCore initializations).

Once all the above options are tried and issue is not resolved, share your sample solution with us for testing.