Hi
Thanks for your inquiry. Please try using the following code:
builder.InsertField("MERGEFIELD TableStart:myTable", "«TableStart:myTable»");
string start = "INCLUDEPICTURE \"C:\\\\Temp\\\\";
string end = ".jpg\"";
string mergefield = "MERGEFIELD idprof";
builder.InsertField(start, string.Empty);
// Search for field separatop of Includepicture field
NodeCollection fieldSeps = builder.CurrentParagraph.GetChildNodes(NodeType.FieldSeparator, true);
Node picSep = null;
foreach (FieldSeparator sep in fieldSeps)
{
if (sep.FieldType == FieldType.FieldIncludePicture)
{
picSep = sep;
break;
}
}
// Move to field separator and insert mergefield
builder.MoveTo(picSep);
builder.InsertField(mergefield, string.Empty);
// Insert end of Includepicture
picSep.ParentNode.InsertBefore(new Run(doc, end), picSep);
// Search for field end
Node picEnd = picSep;
while (picEnd.NodeType != NodeType.FieldEnd)
{
picEnd = picEnd.NextSibling;
}
// Insert empty run after field end
Run empty = new Run(doc);
picEnd.ParentNode.InsertAfter(empty, picEnd);
// Move DocumentBuidler cursor to the empry run
builder.MoveTo(empty);
// Insert another mergefield
builder.InsertField("MERGEFIELD TableEnd:myTable", "«TableEnd:myTable»");
Hope this helps.
Best regards,