java.lang.Object
com.aspose.words.HtmlInsertOptions
public class HtmlInsertOptions
Example:
final String HTML = "\n <html>\n <div style='border:dotted'>\n <div style='border:solid'>\n <p>paragraph 1</p>\n <p>paragraph 2</p>\n </div>\n </div>\n </html>";
// Set the new mode of import HTML block-level elements.
int insertOptions = HtmlInsertOptions.PRESERVE_BLOCKS;
DocumentBuilder builder = new DocumentBuilder();
builder.insertHtml(HTML, insertOptions);
builder.getDocument().save(getArtifactsDir() + "DocumentBuilder.PreserveBlocks.docx");
| Field Summary | ||
|---|---|---|
static final int | NONE | |
| Use the default options when inserting HTML. | ||
static final int | USE_BUILDER_FORMATTING | |
|
Use font and paragraph formatting specified in |
||
static final int | REMOVE_LAST_EMPTY_PARAGRAPH | |
| Remove the empty paragraph that is normally inserted after HTML that ends with a block-level element. | ||
static final int | PRESERVE_BLOCKS | |
| Preserve properties of block-level elements. | ||
| Field Detail |
|---|
NONE = 0 | |
public static final int NONE | |
USE_BUILDER_FORMATTING = 1 | |
public static final int USE_BUILDER_FORMATTING | |
If this option is not specified, formatting of
If this option is specified, formatting of inserted text is based on formatting specified in
REMOVE_LAST_EMPTY_PARAGRAPH = 2 | |
public static final int REMOVE_LAST_EMPTY_PARAGRAPH | |
PRESERVE_BLOCKS = 4 | |
public static final int PRESERVE_BLOCKS | |
By default, properties of parent blocks are merged and stored on their child elements (i.e. paragraphs or tables). If this option is specified, properties of each block are stored separately in a special logical structure. As a result, this option allows to better preserve individual borders and margins seen in the HTML document and get better conversion results. The downside is that the resulting document gets harder to modify, since borders and margins stored in the logical structure are not available for editing.
Only margins and borders of 'body', 'div', and 'blockquote' HTML elements are preserved. Properties of each HTML element are stored separately.
If this option is specified, Aspose.Words mimics MS Word's behavior regarding import of block properties.