Hi,
I have written a code to attach the text file in excel file generated using Aspose.cells. Below is the code that I have written. When I click on the object in Excel file after file generation it gives me "cannot start the source application for this project" error in excel file. Now using the same code I am able to open the excel file. Is there a different way to open txt file attached OLE object ?
Workbook oWB = new Workbook();
Worksheet oSheet = oWB.Worksheets[0];
Cells oCells = oSheet.Cells;
string sAttachFilePath = sFileDIR + "text.txt"; //"test.xls";
string sImageFilePath = sFileDIR + "IconImage.JPG";
FileStream fs = File.OpenRead(sImageFilePath);
byte[] imageData = new Byte[fs.Length];
fs.Read(imageData, 0, imageData.Length);
fs.Close();
fs = File.OpenRead(sAttachFilePath);
byte[] objectData = new Byte[fs.Length];
fs.Read(objectData, 0, objectData.Length);
fs.Close();
oSheet.OleObjects.Add(2, 2, 100, 100, imageData);
//oSheet.OleObjects[0].DisplayAsIcon = true;
//oSheet.OleObjects[0].SourceFullName = "Source Full Name";
//oSheet.OleObjects[0].Name = "Name";
//oSheet.OleObjects[0].Text = "Text";
oSheet.OleObjects[0].ObjectData = objectData;
oWB.Save(sFileDIR + "TestAttachment1.xls");
Can you pls help me resolving this problem?
Thanks,
Hetal Sheth