How to use oleobject


Hi,Laurence,I want to convert a xls file to a oleobject and insert it to an worksheet special in other xls file.

How to do it i should?


I had sent a new version and sample code to Timons. Do you work with him?

Following is a piece of sample code:

FileStream fs = File.OpenRead("d:\\logo.jpg");
byte[] imageData = new Byte[fs.Length];
fs.Read(imageData, 0, imageData.Length);
fs = File.OpenRead("d:\\test\\book1.xls");
byte[] objectData = new Byte[fs.Length];
fs.Read(objectData, 0, objectData.Length);

Excel excel = new Excel();
Worksheet sheet = excel.Worksheets[0];
sheet.OleObjects.Add(3, 3, 150, 150);

sheet.OleObjects[0].ImageData = imageData; // image shown in Excel
sheet.OleObjects[0].ObjectData = objectData; // embedded ole object data
sheet.OleObjects[0].Border.IsVisible = false;


Thank’s very much,i will test the sample!