I've encounterd a problem with following code.
When a .doc file - generated/updated by Aspose.Words - is downloaded, the complete file is received, and works fine (local and online). However, when a docx file - generated/updated by Aspose.Words - is downloaded, only 20kB (no matter how big it is) is downloaded, and Word2007 says that the document is corrupted when opening.
Extra problem is that testing this offline (Windows Vista, Visual Studio 2005 in debug or local IIS 6.0), this error does not occur. Online (same IIS 6.0, operating system Windows 2003), we have the problem.I use following code:
string FILE_NAME = (string)fileRef["name"];
string docExtension = FILE_NAME.Substring(fileAndPath.LastIndexOf('.') + 1);
Document doc = new Document(fileAndPath);
if (docExtension.ToLower() == "docx")
doc.Save(FILE_NAME, SaveFormat.Docx, Aspose.Words.SaveType.OpenInWord, Response);
doc.Save(FILE_NAME, SaveFormat.Doc, Aspose.Words.SaveType.OpenInWord, Response);
We also tried following code, and displayed the wordstream legth after the doc.save, to verify whether it was due to the transfer. The length displayed was also 20kB, which means that Aspose.Words seems to truncate the document.
MemoryStream wordStream = new MemoryStream();
...if (docExtension.ToLower() == "docx")
else if (docExtension.ToLower() == "doc")
doc.Save(wordStream, SaveFormat.Doc); wordStream.Flush();
int wordStreamLength = (int)wordStream.Length;
if (wordStream != null)
byte bytes = wordStream.GetBuffer();
Response.OutputStream.Write(bytes, 0, wordStreamLength);
Are there settings which might be different on my local system in comparison to the server?
Thanks for your help.
This message was posted using Aspose.Live 2 Forum