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

Free Support Forum - aspose.com

Word 2007

We are looking at upgrading one of our products to Word 2007

We've downloaded the latest Aspose and are currently using a temporary licence.

We've found an issue. If we take one of our existing templates (word 2003 doc) and save it as a docx, our merge fields no longer work. The code generates the document with the basic template information, but it just hasn't merged anything in.

Do we have to make changes to the code to make our merging work again?

Martin McKee

Hi

Thanks for your inquiry. Could you please show me your code and attach your input document here for testing? I will investigate the problem on my side and provide you more information.

Best regards,

Here is a section of the code - I'm not overly familiar with it myself, so not sure if this is what you need to see

private Document GenerateProgressLogDocument(int caseMainID, Document sourceTemplate)
{
MethodStart("GenerateProgressLogDocument");
DateTime startTime = DateTime.Now;

using (new Tracer(_traceCategory))
{
Document finalDocument = new Document();

try
{
//Copy the template and clear the sections. This document
//will hold the completed document
finalDocument = sourceTemplate.Clone();

DataTable progressLogTable = GetProgressLog(caseMainID);

if (progressLogTable.Rows.Count > 0)
finalDocument.Sections.Clear();

foreach (DataRow progressLog in progressLogTable.Rows)
{

//Create new document instance for each parent
Document parentInstance = sourceTemplate.Clone();

//Merge the parent data into the document
parentInstance.MailMerge.Execute(progressLog);

//Merge the parent document instance into the final document
finalDocument = MergeDocumentSections(sourceTemplate, finalDocument, parentInstance);
}

finalDocument.MailMerge.DeleteFields();
}
catch (Exception ex)
{
if (ExceptionPolicy.HandleException(ex, _exceptionPolicy))
throw new Exception("An error occurred generating the Aspose document", ex);
}

DebugLog("GenerateProgressLogDocument", startTime);

return finalDocument;
}

How do I attach the document here

Hi

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

Thanks for your request. Please, click “Replay” button and on the bottom of page you will see File attachment “Add/Update” button.

Best regards,

Ok - heres the template - had to zip it

Hi

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

Thank you for additional information. I cannot reproduce the problem on my side using the latest version of Aspose.Words (8.1.0). You can download this version from here:

http://www.aspose.com/community/files/51/.net-components/aspose.words-for-.net/category1188.aspx

Best regards,

Is the error we're getting a known issue in a previous version that was fixed?

The version we have deployed is 7.0.0.0?

Hi

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

Thanks for your inquiry. Nobody reported this problem before, so I cannot tell whether this problem exists in old version.

Best regards,