Hello guys,
I'm using aspose.cells for .Net.
Is is possible to insert a WAV file as OLE-object into sheet.
I tried to insert a PDF and an XLS file and that's works fine but when I insert a wav file and double click on this object I keep getting an error that is unable to start source application for this object.
Here is my code:
//Define a string variable to store the image path.
string ImageUrl = @"D:\Mes Documents\Mes images\sound.gif";
//Get the picture into the streams.
FileStream fs = File.OpenRead(ImageUrl);
//Define a byte array.
byte[] imageData = new Byte[fs.Length];
//Obtain the picture into the array of bytes from streams.
fs.Read(imageData, 0, imageData.Length);
//Close the stream.
fs.Close();
//Get an excel file path in a variable.
string path = @"D:\Mes Documents\Ma musique\applaus8.wav";
//Get the file into the streams.
fs = File.OpenRead(path);
//Define an array of bytes.
byte[] objectData = new Byte[fs.Length];
//Store the file from streams.
fs.Read(objectData, 0, objectData.Length);
//Close the stream.
fs.Close();
//Add an Ole object into the worksheet with the image
Int32 intIndex = _workbook.Worksheets[0].OleObjects.Add(_intCurRow, 1, 50, 50,imageData);
//Set embedded ole object data.
_workbook.Worksheets[0].OleObjects[intIndex].FileType = OleFileType.Unknown;
_workbook.Worksheets[0].OleObjects[intIndex].ObjectData = objectData;
I want to play wav files into my sheet. Is there another way to do this?
Thanks for your help!