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

Free Support Forum - aspose.com

ASPOSE.Words Document preview

I am using A.Words to create a word document with merge fields. The final document is created perfectly as expected, but we also have a preview function. This preview will save the byte-doc as a bitmap. The whole contents of the document displays, but the collation sequence of the document sections are in wrong order (The document contains text boxes for each “paragraph” in the doc).
I’ve attached two images in a .zip, one of the finished document and one of the preview.
Here is how we do:

MemoryStream ms = new MemoryStream(template.Document);
Document doc = new Document(ms);
doc.MailMerge.Execute(fieldNames, fieldValues);//Maybe this is causing the error?

Any suggestions would be appreciated.

Thanks for your request. Do you use Aspose.Words.Viewer to generate preview images? Note that Aspose.Words.Viewer is currently in beta.
Also could you please attach your document here for testing? (Only you and Aspose staff can download it)
Best regards.

Here is the document, i.e. the Word Template.

Thanks for additional information. I managed to reproduce your problem. But as I said Aspose.Words.Viewer namespace is currently in beta and we provide limited technical support for it. As workaround you can try using table instead textboxes.
Best regards.

Thanks for following up.
The problem is not the Viewer, I guess. When I do a doc.Save( “name.html”, SaveFormat.HTML ), a html-file is saved, alas the collation sequence is deranged. But when I do a doc.Save( “name.doc”, SaveFormat.Doc ), the sequemce is in right order.
Strange! Is seems that every saveformat except from .Doc and RTF messes up the collation sequence. My task would basically be completed if I was able to save it in HTML for preview purposes.
This is not in the …Viewer namespace, so it should not be BETA, I presume.

Thank you for additional information. I tried to convert your document to HTML using MS Word and result was not properly too. Problem occurs because you are using floating textboxes in your document. As workaround you can use table instead textboxes ( for example see the attached document).
Best regards.