java.lang.Object
com.aspose.words.MarkupLevel
public class MarkupLevel
- extends java.lang.Object
Utility class containing constants.
Specifies the level in the document tree where a particular StructuredDocumentTag can occur.
Example:
Shows how to work with styles for content control elements.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Get specific style from the document to apply it to an SDT
Style quoteStyle = doc.getStyles().getByStyleIdentifier(StyleIdentifier.QUOTE);
StructuredDocumentTag sdtPlainText = new StructuredDocumentTag(doc, SdtType.PLAIN_TEXT, MarkupLevel.INLINE);
sdtPlainText.setStyle(quoteStyle);
StructuredDocumentTag sdtRichText = new StructuredDocumentTag(doc, SdtType.RICH_TEXT, MarkupLevel.INLINE);
// Second method to apply specific style to an SDT control
sdtRichText.setStyleName("Quote");
// Insert content controls into the document
builder.insertNode(sdtPlainText);
builder.insertNode(sdtRichText);
ByteArrayOutputStream dstStream = new ByteArrayOutputStream();
doc.save(dstStream, SaveFormat.DOCX);
// We can get a collection of StructuredDocumentTags by looking for the document's child nodes of this NodeType
Assert.assertEquals(sdtPlainText.getNodeType(), NodeType.STRUCTURED_DOCUMENT_TAG);
NodeCollection tags = doc.getChildNodes(NodeType.STRUCTURED_DOCUMENT_TAG, true);
for (StructuredDocumentTag sdt : (Iterable<StructuredDocumentTag>) tags) {
// If style was not defined before, style should be "Default Paragraph Font"
Assert.assertEquals(StyleIdentifier.QUOTE, sdt.getStyle().getStyleIdentifier());
Assert.assertEquals("Quote", sdt.getStyleName());
}
Field Summary |
static final int | UNKNOWN = 0 | |
Specifies the unknown or invalid value.
|
static final int | INLINE = 1 | |
The element occurs at the inline level (e.g. among as runs of text).
|
static final int | BLOCK = 2 | |
The element occurs at the block level (e.g. among tables and paragraphs).
|
static final int | ROW = 3 | |
The element occurs among rows in a table.
|
static final int | CELL = 4 | |
The element occurs among cells in a row.
|
UNKNOWN = 0 | |
public static final int UNKNOWN |
-
Specifies the unknown or invalid value.
INLINE = 1 | |
public static final int INLINE |
-
The element occurs at the inline level (e.g. among as runs of text).
BLOCK = 2 | |
public static final int BLOCK |
-
The element occurs at the block level (e.g. among tables and paragraphs).
ROW = 3 | |
public static final int ROW |
-
The element occurs among rows in a table.
CELL = 4 | |
public static final int CELL |
-
The element occurs among cells in a row.
See Also:
Aspose.Words Documentation - the home page for the Aspose.Words Product Documentation.
Aspose.Words Support Forum - our preferred method of support.