Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix this bullet issue

In my website, admin uploads a .docx file. I convert the file into xml using OpenXmlPowerTools Api.

The issue is the document has some bullets in it.

• This is my bullet 1 in the document.
• This is my bullet 2 in the document.

XElement html = OpenXmlPowerTools.HtmlConverter.ConvertToHtml(wDoc, settings);
var htmlString = html.ToString();
File.WriteAllText(destFileName.FullName, htmlString, Encoding.UTF8);

Now when I open the xml file, it renders the bullets as below:-

XML Rendering

I need to read each node of XML & save in the database & reconsturct html from nodes.

Please don't ask me why so, as I am not the boss of the system.

How do I get the bullets render correctly in xml so that I can save the right html in the database?

like image 826
Kgn-web Avatar asked Dec 23 '16 15:12

Kgn-web


1 Answers

I have fixed same issue for my requirement and this working without issue so far.

In case like this you'll always have to try workaround i.e. copy this character and compare it within your input/read strings etc. if found then replace it with equivalent html encoded character. In your case it will be bullet list character "ampersandbull;" or "ampersand#8226;" .

Code should look like

listItem == "Compare with your copied character like one in your pic" ? "•" : listItem

you can find more equivalent characters at this link:

http://www.zytrax.com/tech/web/entities.html

like image 84
kumar chandraketu Avatar answered Sep 18 '22 15:09

kumar chandraketu