I’m currently doing a really simple mergeField substitution in a DOC file and then saving it as a DOCX file. I find that when I perform a substitution for the given merge field (in C#), the LeftMargin property of the ‘CurrentParagraph’ (after the jump to the field but before the insertion) has a LeftMargin property value of 0. Within my original template, the LeftMargin is not equal to zero. As a result, the saved file now has the LeftMargin set to zero and the original indendentation is lost for subsequent paragraphs. If I set the LeftMargin property of the current paragraph to a number programmatically, it saves the change and the indentation results. I would much rather it correctly identify and maintain the original LeftMargin properties set in the template.
How do I maintain the original LeftMargins set in the template for a given paragraph text when doing a jump to mergeField and an insert of static text.
Thanks in advance for your help!
Thanks for your inquiry. As I see you discussed this problem with our team leader. Could you please attach your document here for additional testing? (Only you and Aspose staff can download it)
I have attached a sanitised version of the document that reproduces the
problem I see. The team leader I
chatted with suspected that it had to do with the fact that I was
creating the document in Office 2007 and saving it as a DOC document.
Within my code, I’m inserting dynamic text at the given merge fields.
I notice that when I jump to the given merge fields and investigate the
properties associated with that merge field’s paragraph, the leftMargin
properties are set to zero before any text insertion occurs. Within
the template document, the leftMargin proerty is not set to zero. It
appears to be getting cleared upon loading of the document. Can you
recreate the problem?
Thanks for your inquiry. Excuse me, I missed to notify you. This problem was fixed in the latest version of Aspose.words.
This version of Aspose.Words is available for download from here.
Great; that has addressed my original problem. I was previously using 188.8.131.52 of the assembly.