We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Inserting a Wav file as Ole-Object

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!

Hi,

Well, I 'm afraid, currently, Aspose.Cells for .NET does not support to embed WAV file types, we will check the feasibility if we can support this format type soon.

Thank you.

It's really unfortunate. We use Aspose to generate Audit Report in Excel file. Recently, our clients ask us to integrate voice memo in our report.

It will be very appreciate if you could support this features quickly.

Thanks you for your response.

Marc Lamontagne, Laubrass
Software Engineer

Do you have an idea when this feature could be integrate into your library?

Thanks

Hi,

We will update you soon.

Thanks for being patient!

Hi,
Please try the attached fix. We have supported to insert a WAV file as OleObject. And you have to set the OleObject.SourceFullName .See following sample codes:
Sample code:
//Define a string variable to store the image path.
string ImageUrl = @"f:\test\school.jpg";
//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 = @"f:\test\Blip.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();
int intIndex = 0;

//Instantiate a new Workbook.
Workbook workbook = new Workbook();
Worksheet sheet = workbook.Worksheets[0];
sheet.OleObjects.Add(14, 3, 200, 220, imageData);
workbook.Worksheets[0].OleObjects[intIndex].FileType = OleFileType.Unknown;
workbook.Worksheets[0].OleObjects[intIndex].ObjectData = objectData;
workbook.Worksheets[0].OleObjects[intIndex].SourceFullName = path;

//Save the excel file
workbook.Save(@"f:\test\tetWAV.xls");
Thank you.

Wow! Your service est very great.

I will try this.

Tanks a lot!

Hi Amjad,

I keep getting this error when I'm running my program with the dll you send me:

The subscription included in this license allows free upgrades until july 10, 2008, but this version of the product was released on feb 10, 2009. Please renew the subscription or use a previous version of the product.

What I can do?

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for considering Aspose.

This error occurs because your license has expired. Every Aspose license carries a one-year subscription for free upgrades to any new versions or fixes that come out during this time.

You can contact our purchas team to renew your license to use the latest fixes and updates of Aspose.Cells for a whole year.

Following is the link to Aspose.Purchase Forum,

http://www.aspose.com/community/forums/aspose.purchase/220/showforum.aspx

Thank You & Best Regards

Ok,

I've got a temporary license before renew my license. So I was able to test your update.


I seem to have a problem when I double-click the ole Object create by your new library into the excel file (look attached excel file)

Here is the behavior:

1)Show warning message about potential virus : Not desired
2)Launch an external program (Windows Media Player) : Not desired
3)Icon is changing after double-click : Not acceptable

When I insert manually sound object into excel, I get this behavior:

1)Play sound without launching external program: Desired
2)Icon is not changing after double-click: Desired

Thanks for your help.

Hi,

Thanks for providing us details with the template file.

We will look into it and get back to you soon.

Thank you.

Hi,

Please try the attached fix, we have supported the WAV file as an Ole Object. You will not get the warning any longer and the file will run directly.

Thank you.