This project has moved. For the latest updates, please go here.

Can not add image stream to word file.

Jan 28, 2013 at 9:41 AM

I try to add some images to a word file.

My code below:

using (MemoryStream smallStream = new MemoryStream())                                       

// CutForSquare is a function to get stream for thumbnail image.

ImageHelper.CutForSquare(stream, smallStream, 32, 2);                                           

byte[] bts = new byte[smallStream.Length];
smallStream.Position = 0;                                           

smallStream.Read(bts, 0, bts.Length); 


//I have test , and smallStream is not null.

templateDoc.AddImage(smallStream); 

 }

Sadly, I have see none image in my final word file.

It seems that AddImage function not work.

Any suggestion? Thanks in advance