onizet / html2openxml

Html2OpenXml is a small .Net library that convert simple or advanced HTML to plain OpenXml components. This program has started in 2009, initially to convert user's comments into templated Word.
MIT License
321 stars 109 forks source link

Unordered list is converted in ordered list #63

Closed lacsyst closed 3 months ago

lacsyst commented 5 years ago

All is in the title

When my html contains an unordered list, this list is converted to ordered list.

` using (WordprocessingDocument package = WordprocessingDocument.Create(generatedDocument, WordprocessingDocumentType.Document)) { MainDocumentPart mainPart = package.MainDocumentPart; if (mainPart == null) { mainPart = package.AddMainDocumentPart(); new Document(new Body()).Save(mainPart); }

                HtmlConverter converter = new HtmlConverter(mainPart);
                converter.ParseHtml(html);

                mainPart.Document.Save();
                docMainPart = mainPart;
            }

`

lacsyst commented 5 years ago

In HtmlConverter.cs file the <ul> tag as the same Action element than <ol> tag (ProcessNumberingList)

{ "<ol>", ProcessNumberingList }, { "<p>", ProcessParagraph }, { "<pre>", ProcessPre }, { "<q>", ProcessQuote }, { "<span>", ProcessSpan }, { "<section>", ProcessDiv }, { "<s>", ProcessHtmlElement<Strike> }, { "<strike>", ProcessHtmlElement<Strike> }, { "<strong>", ProcessHtmlElement<Bold> }, { "<sub>", ProcessSubscript }, { "<sup>", ProcessSuperscript }, { "<table>", ProcessTable }, { "<tbody>", ProcessTablePart }, { "<td>", ProcessTableColumn }, { "<tfoot>", ProcessTablePart }, { "<th>", ProcessTableColumn }, { "<thead>", ProcessTablePart }, { "<tr>", ProcessTableRow }, { "<u>", ProcessUnderline }, { "<ul>", ProcessNumberingList },

ericadcg commented 4 years ago

Hi. I'm having this same issue and have yet to find a solution.

Do you mind sharing your solution if you have one?

Thanks, Érica.

ricardodemauro commented 2 years ago

I think this was solved already. I`m using the latest version and I can see differences between those two.

Archie-Miller commented 1 year ago

I know I'm still having this issue. If there is a known way to ensure this works, I'd sure like to know, otherwise I'm going to keep trying to get a ListBullet to work.

I have multilevel lists with both Ordered and Unordered.