Interface IBlockContentControl
Represents a block content control in the Word document.
Inherited Members
Namespace: Syncfusion.DocIO.DLS
Assembly: Syncfusion.DocIO.Base.dll
Syntax
public interface IBlockContentControl : ICompositeEntity, IEntity
Properties
BreakCharacterFormat
Gets the character format of the content control. Read-only.
Declaration
WCharacterFormat BreakCharacterFormat { get; }
Property Value
Type | Description |
---|---|
WCharacterFormat | The WCharacterFormat object that specifies the character format. |
ContentControlProperties
Gets the content control properties. Read-only.
Declaration
ContentControlProperties ContentControlProperties { get; }
Property Value
Type | Description |
---|---|
ContentControlProperties | The ContentControlProperties object that specifies the content control properties. |
Examples
The following example illustrates how to set the properties for content control.
WordDocument document = new WordDocument();
//Adds new section to the document
IWSection section = document.AddSection();
IBlockContentControl control = section.Body.AddBlockContentControl(ContentControlType.RichText);
//Adds new paragraph to the section.
WParagraph paragraph = new WParagraph(control.Document);
//Adds new text to the content control.
paragraph.AppendText("Block content control");
//Adds pagagraph into the Block content control.
control.TextBody.ChildEntities.Add(paragraph);
//Sets title of the block content control.
control.ContentControlProperties.Title = "Rich text content control";
//Adds content control into the document.
document.LastSection.Body.ChildEntities.Add(control);
//Save the Word document
document.Save("Sample.docx", FormatType.Docx);
//Close the document
document.Close();
Dim document As New WordDocument()
'Adds new section to the document
Dim section As IWSection = document.AddSection()
Dim control As New BlockContentControl(document, ContentControlType.RichText)
'Adds new paragraph to the section.
Dim paragraph As New WParagraph(control.Document)
'Adds new text to the content control.
paragraph.AppendText("Block content control")
'Adds pagagraph into the Block content control.
control.TextBody.ChildEntities.Add(paragraph)
'Sets title of the block content control.
control.ContentControlProperties.Title = "Rich text content control"
'Adds content control into the document.
document.LastSection.Body.ChildEntities.Add(control)
'Save the Word document
document.Save("Sample.docx", FormatType.Docx)
'Close the document
document.Close()
TextBody
Gets the block control text body. Read-only.
Declaration
WTextBody TextBody { get; }
Property Value
Type | Description |
---|---|
WTextBody |
Examples
The following example illustrates how to get the text body of the content control.
WordDocument document = new WordDocument();
//Adds new section to the document
IWSection section = document.AddSection();
IBlockContentControl control = section.Body.AddBlockContentControl(ContentControlType.RichText);
//Adds new paragraph to the section.
WParagraph paragraph = new WParagraph(control.Document);
//Adds new text to the content control.
paragraph.AppendText("Block content control");
//Adds pagagraph into the Block content control.
control.TextBody.ChildEntities.Add(paragraph);
//Adds content control into the document.
document.LastSection.Body.ChildEntities.Add(control);
//Save the Word document
document.Save("Sample.docx", FormatType.Docx);
//Close the document
document.Close();
Dim document As New WordDocument()
'Adds new section to the document
Dim section As IWSection = document.AddSection()
Dim control As New BlockContentControl(document, ContentControlType.RichText)
'Adds new paragraph to the section.
Dim paragraph As New WParagraph(control.Document)
'Adds new text to the content control.
paragraph.AppendText("Block content control")
'Adds pagagraph into the Block content control.
control.TextBody.ChildEntities.Add(paragraph)
'Adds content control into the document.
document.LastSection.Body.ChildEntities.Add(control)
'Save the Word document
document.Save("Sample.docx", FormatType.Docx)
'Close the document
document.Close()