Embed excel file with another excel and store it as .xls

Hi,

I am trying to embed an excel file inside another excel in my .net application.

I am able to achieve this with IOleObject Add(string fileName, Image image, OleLinkType linkType)

This embedded file is stored as binary object. Storage name = "oleObject4.bin"

I am looking to save this as an .xls, so it becomes easy to extract it in my app later. Extraction code looks for an embedded .xls file but only finds a .bin instead.

So far I have not found any answer to this question.

I would really rather save/embed it as an .xls to begin with, than change the extraction code to convert .bin into .xls

Any help is apriciated.

Thank You


4 Replies

KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team August 4, 2021 12:19 PM UTC

Hi Pushkar, 

Greetings from Syncfusion. 

We suggest you to use OleObjectType to select the required format. We have prepared a simple sample for you and the same can be downloaded from the below link. 


Kindly try the sample and let us know if this helps. If you still face the issue, kindly share us the issue reproducing sample and confirm us the Syncfusion XlsIO package and version you are using at your end, which will be helpful for us in investigating the query and provide prompt solution at the earliest. 

Regards, 
Keerthi. 



PU Pushkar August 5, 2021 09:23 AM UTC

Hi Keerthi,


Thank you for your reply.

The issue is that we are using legacy .Net app. (Framework 4.7.2)

The method used in sample code which uses OleObjectType seems to only supported in UWP, ASP.NET Core and Xamarin.


I tried searching anything similar for .net 4.7.2 but couldn't find anything.

Is it possible to convert this .bin file back to excel ?
I tried using filestream to extract the embedded excel from oleobject which is in .bin format. Then use MemoryStream to copy it out into a temp .xls. But, when I try to convert it back to .xls it does not work. I get the following exception:

Document
NameValueType
$exception{"Zip exception.Unable to read value at the specified position - end of stream was reached."}Syncfusion.Compression.Zip.ZipException

 

Is there a way to know how i can manually change this .bin back to .xls?

Or is there some methods I can use which are also available in .net 4.7.2?


Thank You,

Pushkar



KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team August 6, 2021 12:17 PM UTC

Hi Pushkar, 
 
Thanks for the update. 
 
We are analyzing feasibility to add OleObject with OleObjectType in .NET Framework. We will share the analysis details in 2 business days, on August 10th,2021. 
 
Regards, 
Keerthi.


KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team August 10, 2021 10:39 AM UTC

Hi Pushkar, 

We appreciate your patience. 

OleObjectType can be used in .NETFramework also. We have prepared a simple sample for your reference and the same can be downloaded from the below link. 


Kindly try the sample and let us know if this helps. 

Regards, 
Keerthi. 


Loader.
Up arrow icon