Bullets and Styles are not giving the proper output in html file

I am using licensed version of Gembox.Document.
i have a requirement of converting word to HTML.
some of the symbols like bullets, arrowmarks are giving wrong html code.
please look into attachment.
because of this i am not able to render it on webview of mobile native devices.
please let me know the fix asap.

Thanks

Hi,

What do you mean by “wrong html code”?

Anyway, it is possible that the reason why they are not rendered correctly on mobile native devices is that they don’t have Symbol font.

Can you try changing the font in your bullet style, for example:

bulletList.ListLevelFormats[0].NumberFormat = "•";
bulletList.ListLevelFormats[0].CharacterFormat.FontName = "Arial";

Does this solve your issue?

Regards,
Mario

Hi,
“wrong html code” == you can see some special character inside the squarebox in the previo
us attachment.
in Native device this is not readable (please check how it looks in screen shot attached)

Also,
bulletList.ListLevelFormats[0].NumberFormat = “•”;
bulletList.ListLevelFormats[0].CharacterFormat.FontName = “Arial”;
This doesnt work for my case

Sumary of what i am trying to do for your reference

  1. read word document
  2. convert it to html document
  3. read each blck from html document and save in the db
  4. this each blocks from db will be retrieved in the native android/ ios app.

Please suggest me

Hi,

Again, the reason why you get those squareboxes is because the device doesn’t have an appropriate font. It’s probably missing the Symbol font and thus it ends up using some other fallback font, but the problem is that this fallback font doesn’t have glyphs for this character that is being used.

Also, the code I sent you is for replacing characters for the bullet list.
Nevertheless, please send us your Word document so that I can investigate that content further.

Regards,
Mario

how can i attach a word file here?
i can only upload image files

You can send it via email or support ticket, see our Contact page.

This issue was resolved by changing the characters that are using the missing Symbol font, like this:

foreach (Run run in document.GetChildElements(true, ElementType.Run))
{
    if (run.CharacterFormat.FontName != "Symbol")
        continue;

    switch(run.Text)
    {
        case "\uF0BE":
            run.Text = "—"; // "EM DASH" character.
            run.CharacterFormat.FontName = "Arial";
            break;
        case "\uF0AE":
            run.Text = "→"; // "RIGHTWARDS ARROW" character.
            run.CharacterFormat.FontName = "Arial";
            break;
        case "\uF0BA":
            run.Text = "≡"; // "IDENTICAL TO" character.
            run.CharacterFormat.FontName = "Arial";
            break;
        default:
            string text = string.Concat(run.Text.Select(c => "\\u" + ((int)c).ToString("X4")));
            throw new NotImplementedException($"Missing replacement for \"{text}\" text in Symbol font.");
    }
}

foreach (Paragraph paragraph in document.GetChildElements(true, ElementType.Paragraph))
{
    if (!paragraph.ListFormat.IsList)
        continue;

    var listFormat = paragraph.ListFormat.ListLevelFormat;
    if (listFormat.NumberStyle != NumberStyle.Bullet)
        continue;

    listFormat.NumberFormat = "•";
    listFormat.CharacterFormat.FontName = "Arial";
}