Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Wed Apr 19, 2023 11:17 pm

Hi Team,

A list element with <br> tag is not adding break line or a new line in the word document when converting HTML to Word.

Code: Select all
<div style="font-size:11pt">
    <div style="list-style-position:outside; margin-bottom:16px; text-align:center">
        <strong>Break line test</strong>
    </div>
    <div style="list-style-position:outside; margin-bottom:16px"><br></div>
    <div style="list-style-position:outside; margin-bottom:16px">
        <span style="background-color:#e74c3c">Below section will fail to add a line break when converting HTML to Word</span>
    </div>
    <ol start="1" style="list-style-type:lower-alpha">
        <li style="text-align: justify; margin-bottom: 16px; list-style-position: outside;">
            List with a break line element&nbsp;directly inside the list element
            <br>
            One
            <br>
            Two
            <br>
            Three
        </li>
    </ol>
    <div style="list-style-position:outside; margin-bottom:16px; text-align:justify"><br></div>
</div>


But when the content of list element is wrapped around a div element, html to word conversion adds a new line as expected.

Code: Select all
<div style="font-size:11pt">
    <div style="list-style-position:outside; margin-bottom:16px; text-align:justify"><span
            style="background-color:#2ecc71">Below section will convert HTML to Word with break line</span></div>
    <ol>
        <li style="list-style-position: outside; margin-bottom: 16px; text-align: justify;">
            <div>
                <u>List with break line element within a div element&nbsp;</u><br>
                <span>One:</span>
                <br>
                <span>Two;</span>
                <br>
                <span>Three;</span>
                <br>
                <span>Four.</span>
            </div>
        </li>
    </ol>
    <div style="list-style-position:outside; margin-bottom:16px; text-align:justify">
        Text wrapped in div tag with line break
        <br>
        One
        <br>
        Two
        <br>
        Three
    </div>
</div>


Above is how it should work without having to wrap contents of list element in a div. In HTML when you create a ordered or unordered list there is no necessity to wrap its lists content in another wrapper. Can you please check.

Please note that I am using the latest hotfix version of Spire doc and I use Windows 11 64-bit operating system and my region setting is United States and English.

Thanks for your support!
Jalpa

jalpaashara
 
Posts: 21
Joined: Wed Jun 22, 2022 8:12 pm

Thu Apr 20, 2023 3:38 am

Hi,

Thanks for your feedback.
I did reproduce your issue after testing your code. I have logged this issue into our tracking system with the ticket SPIREDOC-9310, our Dev team will do further investigation and fixing. Once there is any update, we will keep you informed. Sorry for the inconvenience caused.

Best Regards,
Herman
E-iceblue support team
User avatar

Herman.Yan
 
Posts: 115
Joined: Wed Mar 08, 2023 2:00 am

Thu Aug 17, 2023 9:43 am

Hello,

Glad to inform that we just released Spire.Doc Pack(hot fix) Version:11.8.9 which fixed the issue of SPIREDOC-9310, please download it from the following links to test.
Website link: https://www.e-iceblue.com/Download/down ... t-now.html
Nuget link: https://www.nuget.org/packages/Spire.Doc/11.8.9

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1534
Joined: Wed Apr 25, 2018 3:20 am

Return to Spire.Doc