Free Support Forum - aspose.com

Issues while inserting attachments in excel worksheet

Aspose-Multiple-Attachments-Issues.zip (199.9 KB)

@srinivasaraju.b,

Please create a standalone VS.NET console application including all the resource files using latest version of Aspose.Cells APIs, zip the project and attach it here (please do not include Aspose.Cells.Dll to minimize the size of the application), we will check it soon. Also, attach a sample file containing your desired ole objects intact, this will help us to evaluate your issue precisely to figure it out soon.

@Amjad_Sahi,
PFA, for the standalone VS.NET console application, also in real time we will get the documents from blob storage in a stream format, but for testing purpose I have changed the code bit to attach the file’s from physical folder from the solution. Also you can find the file containing ole objects in the solution folder (Result File folder) it self.

Thank you.ExcelAttachments-POC.zip (6.1 MB)

@srinivasaraju.b,
We have observed the issues mentioned in the Word document and logged in our database for further investigation. We will notify you here once any update is ready for sharing.

This issue is logged as:
CELLSNETCORE-90 - Issues while inserting attachments in excel worksheet

@srinivasaraju.b,

For 1,2 and 4
Please check “Dispay as icon” in MS Excel or set OleObject.DisplayAsIcon as true in Aspose.Cells.

For 3.
We will look into it later on.

AttachmentPOC.PNG (8.2 KB)

Hi @Amjad_Sahi,
Thanks for the update. As you mentioned setting true to “Display as icon” property resolved me the 1,2 issues, but 4 is not working and even I am not sure how to handle this with out adding the binary image manually.

            int idxOle = worksheet.OleObjects.Add(row, col, 60, 60, binaryImg);
            OleObject objOle = worksheet.OleObjects[idxOle];
            objOle.DisplayAsIcon = true;
            objOle.FileFormatType = FileFormatType.Xlsx;
            objOle.ObjectData = binaryXlsx;

if you can see the above code, hear first we are adding the binary image to the oleobject and then we are assigning the the object data, so my question hear, is there any way to get the oldobject image automatically with out adding our own image?

also it would be great if you could get me the solution for #question no 3 also, since it is a blocker to our development.

Thanks,

The very basic is to select your device where you want to upload the attachements.
Select the insert option.
Find the text group and tap on “object” .
Choose the text" create from files".
Give path to your file.
“Display as icon” is there tap on it.
Press ok

@rashmitabaliyarsingh
Our discussion is on inserting the attachments in excel sheet via .Net code and aspose library not from excel sheet directly.

@srinivasaraju.b,

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

Please note, the image will be updated when OleObject.Label is set…

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

@Amjad_Sahi,

We are running our solution in .Net core 3.1, looks like these dll’s are not compatible to it. Getting the below error while saving the workbook.

’‘IBM437’ is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method. (Parameter ‘name’)'

Thanks,

@srinivasaraju.b,

Please try using Aspose.Cells.Dll from Aspose.Cells20.11.10 For .NetStandard20.Zip archive.

AttachmentIssue.PNG (38.1 KB)
@Amjad_Sahi,
Thank you for the prompt response and below are my observation’s.

I have gone through all the properties in the xml file in .NetStandard20.Zip file.

  1. I observed that, attachments icons will not display with out adding image icons manually (like getting auto icons in excel work sheet directly). correct me if I am wrong.
  2. I have tried all the properties in the xml file (like Lable, Name, objectsourcefullname, native source full name, image source full name) but I didn’t see attachment icon label is displaying (pfa for the reference).

Kindly share the code sample to display the attachment icon name in excel sheet. also confirm on point number 1.

Thanks,

@srinivasaraju.b,

  1. Yes, true.
  2. Could you create a sample application (runnable) using Aspose.Cells 20.11.10 for .Net Standard2.0, zip the project and post us with all the files, we will check it soon.

ExcelAttachments-POC.zip (6.4 MB)

@Amjad_Sahi,
Please find attached zip file used Aspose.Cells 20.11.10 for .Net Standard2.0 dll.

Thanks,

@srinivasaraju.b,
We have observed that icon label is not displayed. We are looking into this issue and will share our feedback soon.

@srinivasaraju.b,
If OleObject.IsLink is true, please do not set the OleObject.ObjectData.
And please use the OleObject.SetEmbeddedObject() method to set data of the OleObject in the next fix. See the following definition:

/// <summary>
/// Sets embedded object data.
/// </summary>
/// <param name="linkToFile">Indicates whether the object links to the file. If true, the parameter objectData is ignored.</param>
/// <param name="objectData">The embedded object data. </param>
/// <param name="sourceFileName">The file name.</param>
/// <param name="displayAsIcon">Indicates whether diplaying object as an icon.
/// If true, the orginal image data will be covered by icon.
/// </param>
/// <param name="label">The icon label. Only works when displayAsIcon as true.</param>
public void SetEmbeddedObject(bool linkToFile, byte[] objectData, string sourceFileName, bool displayAsIcon, string label)

@ahsaniqbalsidiqui,
When this (OleObject.SetEmbeddedObject()) method will be available? When would be the fix release date, looks like as of now it is not available right?.

Thanks,

@srinivasaraju.b,
We are gathering information about the next fix containing this method. We will write back here once any update is ready for sharing.

Hope this will fix attachment label issue (displaying attachment file name as label on excel sheet) !!

@srinivasaraju.b,

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

Your issue should be fixed in it.

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