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

Free Support Forum - aspose.com

Cannot write to document


Just playing with Words and I can get it produce a new document or a document from an existing document but I cannot get it to actually write content into the new document.

When I use the template code, it creates the document and adds the Trial version ‘watermark’ across the top. When I use the new document code, it creates an empty document (without the ‘watermark’).

I am using VS2008 and have tried running it with the development server and a locally installed IIS server to no avail. Do you think it is permissions related?

Any assistance would be appreciated.



protected void Page_Load(object sender, EventArgs e)
    // Stream stream = File.OpenRead("c:\temp\template.doc");
    // Document doc = new Document(stream);
    // stream.Close();
    // DocumentBuilder builder = new DocumentBuilder();
    Document doc = new Document();
    DocumentBuilder builder = new DocumentBuilder();
    builder.Write("Hello World!");
    doc.Save("testing1.doc", SaveFormat.Doc, SaveType.OpenInBrowser, Response);

Figured it out

DocumentBuilder builder = new DocumentBuilder();

Should be

DocumentBuilder builder = new DocumentBuilder(doc);

Works well now!