Free Support Forum - aspose.com

SOS: Upgrading from Aspose.Word 1.9.3 to 2.2.3 broke my code

Hi,

I upgraded the component just now from 1.9.3 to 2.2.3...Now I get an error trying to view the documents...my code , which worked fine before the upgrade is as follow:

byte[] content = (byte[]) ds.Tables[0].Rows[0][DocumentAssemblyUtils.COL_CONTENT];

Response.ContentType = "application/vnd.ms-word";

Response.Charset = "";

Aspose.Word.Word wd2 = new Word();
MemoryStream ms2 = new System.IO.MemoryStream();
ms2.Write(content,0,content.Length);
Aspose.Word.Document doc = wd2.Open(ms2);

doc.Save(templateFileName, SaveFormat.FormatDocument, SaveType.OpenInBrowser, this.Response) ;

On the line: Aspose.Word.Document doc = wd2.Open(ms2); I get the error: "Cannot access a closed Stream. "

Simply set ms2.Position to 0 before that line.