Free Support Forum - aspose.com

Aspose .NET .dot - GetFieldNames not parsing the whole doc

Hi,

We use Aspose to perform a mail merge operation on Word .dot templates. We have tags defined as MergeFields in the document.

Some templates are longer than others, up to around 5 or 6 pages. For one template we use in particular Aspose.Words.Document appears to stop reading the document part of the way through. At around 4 pages it stops reading the tags and returns the array- without throwing an exception.

If I move tags from the bottom to the top of the document it reads them, and then cuts out tags further down the document.

Using the following code:

List<string> tags = null;

Document doc = new Document(fileName);

tags = doc.MailMerge.GetFieldNames().ToList();

Is there something I am missing? It seems strange that the process would just cut out mid way through and not throw any kind of exception.

Cheers,

Jarrad

Hi Jarrad,

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

Thanks for your inquiry. Most likely, you use Aspose.Words in evaluation mode and document is truncated. There is evaluation limitation of maximum number of paragraphs in the document. You should see the following text in the output documents.

This document was truncated here because it was created using Aspose.Words in Evaluation Mode.

That is why doc.MailMerge.GetFieldNames(); returns only part of all merge fields in the document.

If you want to test Aspose.Words for without the evaluation version limitations, you can request a 30-day Temporary License. Please refer to

http://www.aspose.com/corporate/purchase/faqs/temporary-license.aspx

If this will not help, please attach your document here for testing.

Best regards.

Thanks, it was a licencing issue.

As it turns out we were programmatically configuring the licence correctly when generating the documents, but not when reading the documents (to get the list of merge fields). So there was no way to tell if it was in evaluation mode other than the fact it was truncating on read.

Regards,

Jarrad

Hi Jarad,

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

Thank you for additional information. The license should be applied on application start, in this case you will not have any licensing issues in the future. Please see the following link to leanr when to apply license:

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net-and-java/when-to-apply-a-license.html

Best regards.