Hello,
I'm printing some formattedText with migraDoc, but the bold effet is not rendered in my document.
here an example:
I have an html string generated with CKEditor like this:
Code:
<p><em><strong><span style="font-family:Arial,Helvetica,sans-serif"><span style="font-size:9pt">Bold and italic</span></span></strong></em></p>
I parse this string to convert each html node into migradoc formattedText.
Code:
private void FormerNoeudHtml(HtmlNode noeud, FormattedText texte)
{
switch (node.Name)
{
case "b":
case "strong":
texte.Font.Bold = true;
break;
case "i":
case "em":
texte.Font.Italic = true;
break;
case "u":
texte.Font.Underline = Underline.Single;
break;
case "br":
texte.AddLineBreak();
break;
case "span":
// span stuff
break;
case "img":
// img stuff
break;
default:
break;
}
foreach (HtmlNode enfant in node.ChildNodes)
{
if (enfant.Name.Substring(0, 1) == "#" && enfant.Name != "#document")
{
texte.AddText(noeud.InnerText);
}
else
{
FormerNoeudHtml(enfant, texte.AddFormattedText());
}
}
}
If i have italic or underline tag it's working, but bold textFormat doesn't apply on the document.
with this example, before printing I have an object like this:
paragraph.Elements[0](formattedText).Elements[0](formattedText).Elements[0](formattedText with italic == true).Elements[0](formattedText with bold == true).Elements[0](formattedText with fontName == "Arial,Helvetica,sans-serif").Elements[0](formattedText with size == {9}).Elements[0](Text with content == "Bold and italic")
what did I miss?
Thanks.