4

I am looking at a function that someone has written. The goal of the function to read html tags and format html tags appropriately for a pdf via MigraDoc.

This is the definition of the function.

private Boolean RecursiveFormattedParagraph(Document d, Paragraph para, HtmlNode currentNode, ListInfo listinfo, Boolean listFlag, TextFormat currentFormat) {

It is working for the tags that the program currently supports (i.e. <b>, <i>).

How can I add support for subscript and superscript? I have done some research and FormattedText seems to be the appropriate method here. But as a novice C# developer, I am not quite sure how to integrated it into the program.

TaW
  • 53,122
  • 8
  • 69
  • 111
user2771150
  • 722
  • 4
  • 10
  • 33

1 Answers1

5

MigraDoc has an element called FormattedText which supports what you are looking for. I dont know how did you search for it but just a simple google search and I found what you were looking for.

MigraDoc Sample: Hello MigraDoc is the documentation from MigraDoc. the following is from the sample provided by MigraDoc:

formattedText = paragraph.AddFormattedText("subscript");
formattedText.Subscript = true;

paragraph.AddText(" or ");

formattedText = paragraph.AddFormattedText("superscript");

formattedText.Superscript = true;
Mightee
  • 689
  • 7
  • 22