RichText ) WTextRange textRange = new WTextRange ( document ) textRange. appendInlineContentControl ( ContentControlType. IInlineContentControl contentControl = ( InlineContentControl ) paragraph. " ) //Appends rich text content control to the paragraph. appendText ( "A new text is added to the paragraph. getLastParagraph () //Adds text to the paragraph. ensureMinimal () //Gets the last paragraph. WordDocument document = new WordDocument () //Adds one section and one paragraph to the document. The following code sample illustrates the content control properties usage. Example – Content Control Common properties It restricts to remove or delete the content control. It restricts to modify the contents of the content control. Locking the contents of the content control. This property defines whether to remove a content control from the Word document when you edit the contents of the content control. Hidden: Displays the contents of content control without any box or tags.ĭefines the color of the content control.Tags: Displays the contents of content control within tags.BoundingBox: Displays the contents of content control within a box.The appearance can be any one of the following: This property allows you to define the appearance of the content controls. The tag value to identify the content control. The following are the common properties of a content control. You can set formatting options for the content control in the Word document.
close () Ĭurrently, DocIO does not support RowContentControl and CellContentControl. add ( textRange ) //Saves and closes the Word document instance. setText ( "Inline content control " ) inlineContentControl.
RichText ) WTextRange textRange = new WTextRange ( document ) //Adds new text to the inline content control. InlineContentControl inlineContentControl = ( InlineContentControl ) paragraph. " ) //Appends inline content control to the paragraph. You can add text, pictures, fields or other paragraph items into the inline content control. You can add content control as a child to a paragraph using the inline content control. appendPicture ( new FileInputStream ( "Image.png" )) //Saves and closes the Word document instance. addParagraph () //Adds image to the paragraph. resetCells ( 2, 3 ) paragraph = ( WParagraph ) blockContentControl. addTable () //Specifies the total number of rows and columns. WTable table = ( WTable ) blockContentControl. appendText ( "Block content control" ) //Adds new table to the block content control. addParagraph () //Adds new text to the paragraph. WParagraph paragraph = ( WParagraph ) blockContentControl. RichText ) //Adds new paragraph in the block content control. addBlockContentControl ( ContentControlType. BlockContentControl blockContentControl = ( BlockContentControl ) textBody. getBody () //Adds block content control into Word document. addSection () WTextBody textBody = section. WordDocument document = new WordDocument () //Adds new section to the document.