MarkupLevel

Inheritance: java.lang.Object

public class MarkupLevel

Specifies the level in the document tree where a particular StructuredDocumentTag can occur.

Examples:

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) tags) {
     Assert.assertEquals(StyleIdentifier.QUOTE, sdt.getStyle().getStyleIdentifier());
     Assert.assertEquals("Quote", sdt.getStyleName());
 }
 

Fields

FieldDescription
BLOCKThe element occurs at the block level (e.g.
CELLThe element occurs among cells in a row.
INLINEThe element occurs at the inline level (e.g.
ROWThe element occurs among rows in a table.
UNKNOWNSpecifies the unknown or invalid value.
length

Methods

MethodDescription
fromName(String markupLevelName)
getName(int markupLevel)
getValues()
toString(int markupLevel)

BLOCK

public static int BLOCK

The element occurs at the block level (e.g. among tables and paragraphs).

CELL

public static int CELL

The element occurs among cells in a row.

INLINE

public static int INLINE

The element occurs at the inline level (e.g. among as runs of text).

ROW

public static int ROW

The element occurs among rows in a table.

UNKNOWN

public static int UNKNOWN

Specifies the unknown or invalid value.

length

public static int length

fromName(String markupLevelName)

public static int fromName(String markupLevelName)

Parameters:

ParameterTypeDescription
markupLevelNamejava.lang.String

Returns: int

getName(int markupLevel)

public static String getName(int markupLevel)

Parameters:

ParameterTypeDescription
markupLevelint

Returns: java.lang.String

getValues()

public static int[] getValues()

Returns: int[]

toString(int markupLevel)

public static String toString(int markupLevel)

Parameters:

ParameterTypeDescription
markupLevelint

Returns: java.lang.String