We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Import html keep list in parent paragraph (div)

Hi there;

I’m importing an HTML document, that will ultimately be re-saved as rtf.
I have a series of sections (DIVs), each has a colored background (see html below for a simple sample).
On import, I want to keep the list items in the second div to be maintained in the same colored box as the remainder of the content in the div. In other words, I want to generate an rtf, that renders much like this html renders in a browser.
From looking at other support posts, I realize that the Aspose is trying to model how Word would render this html. What I’m looking for is any approach (code, css, or html changes), that would allow me to get the combined “text and list in one colored box” that this html produces in the browser.
There are actually two things I’d like to resove:

  1. The list items showing up in their own colored “box”, instead of the same box as the text above it.
  2. The missing orange border around the second box.

Attached are two images. One shows the output of the html in the browser - what I I’m trying to replicate in rtf. The second image shows the current rtf output. RtfOutput.png (6.7 KB)
BrowserOutputDesiredOutput.png (16.4 KB)

Any ideas? Thank you so much.

    .CalloutBox {
        background-color: #E6FAFF !important;
        border: 10px solid #FFE38C !important;
<title>Exercise: Walking for Wellness</title>
<div class="CalloutBox">
    <h3>Call out without a list in it. </h3>
    <p>This is a basic callout box. What is going on here?</p>

<div class="CalloutBox">
    <h3>Call out with a list in it. Should not muck up call out box</h3>
    <p>This is a basic call out box. What is going on here?</p>

        <li>List item</li>
        <li>List item</li>
        <li>List item</li>


We tested the scenarios and have managed to reproduce the same problems on our end. For the sake of corrections, we have logged the following issues in our issue tracking system.

WORDSNET-20285: This is about “The list items showing up in their own colored “box”, instead of the same box as the text above it.”
WORDSNET-20284: This is about “The missing orange border around the second box.”

We will further look into the details of these issues and will keep you updated on the status. We apologize for your inconvenience.

@agoar We have completed analysis of WORDSNET-20285 and concluded to close it as Not a Bug.
We’ve introduced another block import mode to loading of HTML documents. You should specify HtmlLoadOptions.BlockImportMode = BlockImportMode.Preserve in order to get better conversion results. However, due to limitations of our document model there is no way to preserve shading (background color) of a <div> element that encloses paragraphs. As a workaround, tables could be used instead of <div> elements for drawing borders and shading.