Is it possible to set bookmark text with a portion of the text being superscript? I’m guessing not, but I’d love to be wrong in this instance.
On a similar note how do I merge superscript as part of a single field in a mail merge?
Hi Keith,
Keith:
Is it possible to set bookmark text with a portion of the text being superscript? I’m guessing not, but I’d love to be wrong in this instance.
builder.StartBookmark("bm");
builder.Write("Some text inside Bookmark");
builder.Font.Superscript=true;
builder.Write("superscripted text");
builder.Font.Superscript = false;
builder.Write(" again normal text");
builder.EndBookmark("bm");
builder.Document.Save(@"C:\Temp\out.docx");
Hi Keith,
Keith:
On a similar note how do I merge superscript as part of a single field in a mail merge?
Document(@“C:\Temp\in.docx”);
doc.MailMerge.FieldMergingCallback = new HandleMergeImageField();
doc.MailMerge.Execute(new string[] { "mf" }, new object[] { "Some field value superscripeted" });
doc.Save(@"C:\Temp\out.docx");
private class HandleMergeImageField : IFieldMergingCallback
{
void IFieldMergingCallback.FieldMerging(FieldMergingArgs args)
{
if (args.FieldName.Equals("mf"))
{
DocumentBuilder builder = new DocumentBuilder(args.Document);
builder.MoveToMergeField(args.DocumentFieldName);
builder.Write((string)args.FieldValue);
builder.Font.Superscript = true;
builder.Write("1");
args.Text = string.Empty;
}
}
void IFieldMergingCallback.ImageFieldMerging(ImageFieldMergingArgs e)
{
// Do nothing.
}
}
Awesome, thanks!!
Hi Keith,