I am trying to get around the word 255 character limit in merge fields and do not know how to change it in the code. We are storing the object path in the merge field, ie. TableStart:Policy.Claims[] to iterate through a policies claims. Only problem is when we have a really long one, with conditions, we hit the 255 character limit. I would like to change the definition before the merge starts. I will have a database table that has 2 columns, alias and definition. Alias is the PK, and definition will contain the text I want to change the merge field to be. For example:
// Now replace the guts of the merge field
NodeCollection starts = m_wordDoc.GetChildNodes(NodeType.FieldStart, true);for (int j = 0; j < starts.Count; j++)
{
FieldStart fStart = (FieldStart)starts[j];
if (fStart.FieldType == FieldType.FieldMergeField)
{
m_wordDocBuilder.MoveToField(fStart.GetField(), false);
FieldStart newStart = (FieldStart)m_wordDocBuilder.CurrentNode;<span style="color:#4ec9b0;">String</span>[] fieldcodes <span style="color:#b4b4b4;">=</span> fStart<span style="color:#b4b4b4;">.</span>GetField()<span style="color:#b4b4b4;">.</span>GetFieldCode()<span style="color:#b4b4b4;">.</span>Trim()<span style="color:#b4b4b4;">.</span>Split(<span style="color:#569cd6;">new</span> <span style="color:#4ec9b0;">Char</span>[] { <span style="color:#d69d85;">' '</span> }); <span style="color:#569cd6;">if</span> (fieldcodes[<span style="color:#b5cea8;">2</span>] <span style="color:#b4b4b4;">!=</span> <span style="color:#d69d85;">""</span> <span style="color:#b4b4b4;">&&</span> fieldcodes[<span style="color:#b5cea8;">2</span>]<span style="color:#b4b4b4;">.</span>IsEqualTo(originalField)) { fStart<span style="color:#b4b4b4;">.</span>GetField()<span style="color:#b4b4b4;">.</span>Result <span style="color:#b4b4b4;">=</span> <span style="color:#d69d85;">@"MERGEFIELD "</span> <span style="color:#b4b4b4;">+</span> field <span style="color:#b4b4b4;">+</span> <span style="color:#d69d85;">@" \* MERGEFORMAT"</span>; }
}
}