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

Free Support Forum - aspose.com

Field Date is slow

Hy,

I create a Template (Dotx) where i put 3 Mergefield.

MailMerge with 3 rows take 1500 ms.

If i put a {Page} Field, it take 3500 ms (idem if i have only 1 row).

Why is it so slow ?

Thanks

Hi,


Thanks for your inquiry. Well, the bottom line is that the processing time fully depends on your documents and their complexity. Rendering a Word document to PDF/XPS formats is slower than simple saving to flow formats e.g. DOCX/RTF.

Please create a simple application (for example a Console Application Project) that helps us reproduce the same problem on our end and attach it here for testing. Please also attach the template Word document you’re getting this problem with. I will investigate the issue on my side and provide you more information.

Best regards,

i don't know why you talk about PDF/XPS.

I create a simple Template with nothing else 2 word fields {DATE} {PAGE} and 1 MERGEFIELD {NAME} and execute mailmerge with a XML file containing 3 lines with "Name" field.

My Template (a DOTX) is not complicated and action to save is not concerned : it's the execute command that take 3500 ms, nothing else.

And i try with several templates, several database...it's always the same.

Thanks

Hi,


Thanks for the additional information.

The MailMerge.Execute method internally calls UpdateFields method which in turn updates all the fields in the mail-merged document including the PAGE field. However, please note that Aspose.Words needs to format a document into pages to be able to calculate the values for page number related fields. The process of rebuilding the page layout of the document takes an additional amount of time. (Also, note that Aspose.Words uses the same layout engine before converting document to PDF/XPS formats)

Secondly, I have attached a template Word document here for your reference. The document contains two MERGEFIELDs and a PAGE field. The following code took just under 1200 milliseconds on my side. Please try run the following code and share your results with us along with the environmental details (e.g. OS, .NET Framework version, version of Aspose.Words for .NET library etc) of the machine you’re getting this problem on.

Stopwatch sw = new
Stopwatch();

sw.Reset();

sw.Start();

Document doc = new Document(@"C:\Temp\template.docx");

doc.MailMerge.Execute(new string[] { "mf1", "mf2" }, new Object[] { 1, 2 });

doc.Save(@"C:\Temp\out.docx");

sw.Stop();

Console.WriteLine(string.Format("Elpased time: {0} ms", sw.ElapsedMilliseconds));

Console.WriteLine(string.Format("Peak memory: {0} Mb", Process.GetCurrentProcess().PeakWorkingSet64 / (1024f * 1024f)));


Moreover, in case you're using an older version of Aspose.Words, I would suggest you please upgrade to the latest version of Aspose.Words (13.5.0). You can download it from the following link:
http://www.aspose.com/community/files/51/.net-components/aspose.words-for-.net/default.aspx

I hope, this improves the performance on your side.

Best regards,