com.aspose.words

Class MarkupLevel

  • 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);

// Below are two ways to apply a style from the document to a structured document tag.
// 1 -  Apply a style object from the document's style collection:
Style quoteStyle = doc.getStyles().getByStyleIdentifier(StyleIdentifier.QUOTE);
StructuredDocumentTag sdtPlainText = new StructuredDocumentTag(doc, SdtType.PLAIN_TEXT, MarkupLevel.INLINE);
sdtPlainText.setStyle(quoteStyle);

// 2 -  Reference a style in the document by name:
StructuredDocumentTag sdtRichText = new StructuredDocumentTag(doc, SdtType.RICH_TEXT, MarkupLevel.INLINE);
sdtRichText.setStyleName("Quote");

builder.insertNode(sdtPlainText);
builder.insertNode(sdtRichText);

Assert.assertEquals(NodeType.STRUCTURED_DOCUMENT_TAG, sdtPlainText.getNodeType());

NodeCollection tags = doc.getChildNodes(NodeType.STRUCTURED_DOCUMENT_TAG, true);

for (StructuredDocumentTag sdt : (Iterable<StructuredDocumentTag>) tags) {
    Assert.assertEquals(StyleIdentifier.QUOTE, sdt.getStyle().getStyleIdentifier());
    Assert.assertEquals("Quote", sdt.getStyleName());
}

Field Summary
static final intUNKNOWN = 0
Specifies the unknown or invalid value.
static final intINLINE = 1
The element occurs at the inline level (e.g. among as runs of text).
static final intBLOCK = 2
The element occurs at the block level (e.g. among tables and paragraphs).
static final intROW = 3
The element occurs among rows in a table.
static final intCELL = 4
The element occurs among cells in a row.
 

    • Field Detail

      • 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.