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

Free Support Forum - aspose.com

Cloning font/styles of mail merge fields to paragraphs of other document

I have a word document with certain Mail merge field with styles of the field i.e. font name, size, weight.
I need to get those style and apply to other document paragraphs.
Kindly suggest the possible solution for it.

I am using aspose words for java.


Thanks for your inquiry. Please note that formatting is applied on a few different levels. For example, let’s consider formatting of simple text. Text in documents is represented by Run element and a Run can only be a child of a Paragraph. You can apply formatting

  1. to Run nodes by using Character Styles e.g. a Glyph Style.
  2. to the parent of those Run nodes i.e. a Paragraph node (possibly via paragraph Styles).
  3. you can also apply direct formatting to Run nodes by using Run attributes (Font). In this case the Run will inherit formatting of Paragraph Style, a Glyph Style and then direct formatting.

In your case, we suggest you please get the style of mail merge field using FieldStart.Font.Style property. You can apply this style to any paragraph using Paragraph.ParagraphFormat.Style property.

Thanks, It worked for me now.


Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.