This project has moved. For the latest updates, please go here.

ReplaceText with formatted text?

Jul 30, 2012 at 2:37 PM

Firstly, thanks for a great library; proving very useful here!

I have been using the DocX.ReplaceText() function to insert text to a pre-existing .docx in a sort-of 'mail-merge' manner; that is I am replacing 'tags' with text loaded from a database. This is fine where the text needs to be a basic paragraph, but I am at a brick wall where the text is a list of items.

I have a list of issues with actions taken against them which need to be formatted as-below:

You said: [this is the first issue]
We did: [this is the action taken against the first issue]

You said: [this is the second issue]
We did: [this is the action taken against the second issue]

... and so on

The list needs to replace a single tag in the document [#issuesandactions], but I cannot get my head around formatting each item to have one line of bold text and one line not.

An additional possible restriction is that the pre-existing .docx is effectively a structured template, made up of text boxes and images; unfortunately this I have no control over.

Is this possible with DocX? Or am I stretching it's legs too far?

Any help will be greatly appreciated.

Aug 7, 2012 at 3:32 PM

Update:

I have tried 'escape characters' and OpenXML markup, to no avail.

Is there something I'm missing that DocX already does to allow this?