I'm using the OpenXML Library (in C#) to pull data out of MS CRM 2013 and insert it into a word template using CustomDocumentProperty, everything works fine until I try inserting text from a multiline textbox, the text gets pulled in fine but the output in Word is all on one line. The string pulled out of CRM looks like "This\nIs\nA\nTest\n\Multiline\nComment", I've tried replacing \n with \r\n, and Environment.NewLine but I get same result. Does anybody know how it is possible to insert a new line in a CustomDocumentProperty? I'm constructing the new property like so:
var stringValue = "This\nIs\nA\nTest\n\Multiline\nComment";
if (stringValue != null && stringValue.Contains("\n"))
{
stringValue = stringValue.Replace("\n", "\r\n");
}
var newProp = new CustomDocumentProperty
{
VTLPWSTR = new VTLPWSTR(stringValue),
Name = ((CustomDocumentProperty)mergeField).Name,
FormatId = "{D5CDD505-2E9C-101B-9397-08002B2CF9AE}"
};
Thanks for any help.