Interface IInlineContentControl
Represents a inline content control in the Word document.
Inherited Members
Namespace: Syncfusion.DocIO.DLS
Assembly: Syncfusion.DocIO.Portable.dll
Syntax
public interface IInlineContentControl : IParagraphItem, 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();
//Adds new paragraph to the section
IWParagraph paragraph = section.AddParagraph();
//Adds new rich text content control to the paragraph
paragraph.AppendInlineContentControl(ContentControlType.RichText);
//Adds new text to the content control
WTextRange textRange = new WTextRange(document);
textRange.Text = "Rich Text Content Control";
(paragraph.Items.LastItem as IInlineContentControl).ParagraphItems.Add(textRange);
IInlineContentControl richTextControl = paragraph.Items.LastItem as IInlineContentControl;
richTextControl.ParagraphItems.Add(textRange);
// Sets Title property of the content control.
richTextControl.ContentControlProperties.Title = "Rich text content 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()
'Adds new paragraph to the section
Dim paragraph As IWParagraph = section.AddParagraph()
'Adds new rich text content control to the paragraph
paragraph.AppendInlineContentControl(ContentControlType.RichText)
'Adds new text to the content control
Dim textRange As New WTextRange(document)
textRange.Text = "Rich Text Content Control"
TryCast(paragraph.Items.LastItem, IInlineContentControl).ParagraphItems.Add(textRange)
Dim richTextControl As IInlineContentControl = TryCast(paragraph.Items.LastItem, IInlineContentControl)
richTextControl.ParagraphItems.Add(textRange)
' Sets Title property of the content control.
richTextControl.ContentControlProperties.Title = "Rich text content control"
'Save the Word document
document.Save("Sample.docx", FormatType.Docx)
'Close the document
document.Close()
ParagraphItems
Gets the content control items. Read-only.
Declaration
ParagraphItemCollection ParagraphItems { get; }
Property Value
Type | Description |
---|---|
ParagraphItemCollection | The ParagraphItemCollection of the current control. |
Examples
The following example illustrates how to get the paragraph items of the current inline content control.
WordDocument document = new WordDocument();
//Adds new section to the document
IWSection section = document.AddSection();
//Adds new paragraph to the section
IWParagraph paragraph = section.AddParagraph();
//Adds new rich text content control to the paragraph
paragraph.AppendInlineContentControl(ContentControlType.RichText);
//Adds new text to the content control
WTextRange textRange = new WTextRange(document);
textRange.Text = "Rich Text Content Control";
(paragraph.Items.LastItem as IInlineContentControl).ParagraphItems.Add(textRange);
IInlineContentControl richTextControl = paragraph.Items.LastItem as IInlineContentControl;
richTextControl.ParagraphItems.Add(textRange);
// Sets Title property of the content control.
richTextControl.ContentControlProperties.Title = "Rich text content 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()
'Adds new paragraph to the section
Dim paragraph As IWParagraph = section.AddParagraph()
'Adds new rich text content control to the paragraph
paragraph.AppendInlineContentControl(ContentControlType.RichText)
'Adds new text to the content control
Dim textRange As New WTextRange(document)
textRange.Text = "Rich Text Content Control"
TryCast(paragraph.Items.LastItem, IInlineContentControl).ParagraphItems.Add(textRange)
Dim richTextControl As IInlineContentControl = TryCast(paragraph.Items.LastItem, IInlineContentControl)
richTextControl.ParagraphItems.Add(textRange)
' Sets Title property of the content control.
richTextControl.ContentControlProperties.Title = "Rich text content control"
'Save the Word document
document.Save("Sample.docx", FormatType.Docx)
'Close the document
document.Close()