I created a Shared AddIn using Visual Studio 2008, C#. In the AddIn, I get data from a database, populate it into a Dictionary object, and use Word's builtin FindReplace to replace text inside a WordTemplate with the data from the database.
Dictionary<string, string> myDBData = new Dictionary<string, string>();
Some of the db fields need the newline character (i.e. multi-line data), so I insert a newline using Environment.NewLine in my code before passing the dictionary object to a find-replace routine.
The problem is, for fields that have the newline character in them, the text is getting replaced properly inside the world template only if the [replacemefieldname] placeholder is outside a Word Table like so.
These 12 lines are outside A MS WORD Table:
Firm
Firm
Fluid
Fluid
Fluid
Fluid
Fluid
Fluid
Fluid
Fluid
Fluid
Fluid
If the [replacemefieldname] placeholder is inside a MS Word Table, the the multiple text string is rendering in a single line like so.
Firm Firm Fluid Fluid Fluid Fluid Fluid Fluid Fluid Fluid Fluid Fluid
See following screenshot for both rendering (inside and outside table).
If I copy the table text and paste outside, then also the new lines render properly!!
So what other characters besides Environment.NewLine should I be placing in between the lines in the string before passing it on to Word to do find-replace for [replacemefieldname] placeholders that exist inside a MS Word Table ?
thank you
ps. The clever folks at StackOverflow are preventing me from posting screenshot since I'm deemed a "New User", so here is the screenshot that makes my question clearer.. :)