Last post Jan 28, 2015 06:06 AM by Sabina Dukatova
Jan 09, 2015 12:42 AM|tonylck|LINK
I developed a program which can replace texts in Word document by using Microsoft Word Interop.
For example, a word document template is shown as below:
It replace empty string if no data is found. For example, No data is found on this person's post and Post field is blank on the document after replacement
Replaced document is shown as below:
How to solve the problem?
Jan 17, 2015 09:53 AM|IbrahimIslam|LINK
I did it once in WebForms but cannot find the project. Following are the links I had followed and saved in my note for such task:
Jan 28, 2015 06:06 AM|Sabina Dukatova|LINK
Why don't you try:
1) adding a space after [Post] so that the line won't be empty, or
2) put each line in a new Paragraph, or
3) replace the placeholder text with a single space instead of empty string.
BTW, you should also check Docentric Toolkit which is a document generation toolkit for .NET and already supports all the features that you are trying to implement. It also features Add-In for Word that allows you to
import a data schema and you can easily insert various placeholders and associate them with schema fields/properties.