Free Support Forum - aspose.com

Newbie Query - Simple Mail Merge into new window

Hi,

I have the simple mail merge working but ideally would like it to output to a new browser window. Is this possible?

Thanks

Francis

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

Thanks for your inquiry. I think you can achieve this using javascript. For example on the main page you should have html button like the following:

<input id="btnGenerateDoc" type="button" value="Generate Document" onclick="window.open('GenerateDoc.aspx','new','width=900,height=600,toolbar=1')" />

Then you should create GenereateDoc.aspx and generate the document on PageLoad of this page as shown in the following code:

protected void Page_Load(object sender, EventArgs e)

{

//Here you can generate your file

Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);

builder.Write("Hello world");

//Save document

doc.Save("out.doc", SaveFormat.Doc, SaveType.OpenInBrowser, Response);

}

Hope this helps.

Best regards.

… obvious once you stop banging your head, thanks