Xamarin.Android

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class InlineContentControl

    Show / Hide Table of Contents

    Class InlineContentControl

    Represents a inline content control in the Word document.

    Inheritance
    System.Object
    OwnerHolder
    XDLSSerializableBase
    Entity
    WidgetBase
    ParagraphItem
    InlineContentControl
    Implements
    IXDLSSerializable
    IOfficeRun
    IInlineContentControl
    IParagraphItem
    IEntity
    Inherited Members
    ParagraphItem.m_charFormat
    ParagraphItem.ApplyStyle(String)
    ParagraphItem.CloneRun()
    ParagraphItem.Dispose()
    ParagraphItem.OwnerParagraph
    ParagraphItem.IsInsertRevision
    ParagraphItem.IsDeleteRevision
    ParagraphItem.OwnerMathRunElement
    Entity.Clone()
    Entity.Owner
    Entity.NextSibling
    Entity.PreviousSibling
    Entity.IsComposite
    XDLSSerializableBase.IXDLSSerializable.WriteXmlAttributes(IXDLSAttributeWriter)
    XDLSSerializableBase.IXDLSSerializable.WriteXmlContent(IXDLSContentWriter)
    XDLSSerializableBase.IXDLSSerializable.ReadXmlAttributes(IXDLSAttributeReader)
    XDLSSerializableBase.IXDLSSerializable.ReadXmlContent(IXDLSContentReader)
    XDLSSerializableBase.IXDLSSerializable.RestoreReference(String, Int32)
    XDLSSerializableBase.WriteXmlAttributes(IXDLSAttributeWriter)
    XDLSSerializableBase.WriteXmlContent(IXDLSContentWriter)
    XDLSSerializableBase.ReadXmlAttributes(IXDLSAttributeReader)
    XDLSSerializableBase.ReadXmlContent(IXDLSContentReader)
    XDLSSerializableBase.InitXDLSHolder()
    XDLSSerializableBase.RestoreReference(String, Int32)
    XDLSSerializableBase.IXDLSSerializable.XDLSHolder
    XDLSSerializableBase.XDLSHolder
    OwnerHolder.m_doc
    OwnerHolder.Document
    Namespace: Syncfusion.DocIO.DLS
    Assembly: Syncfusion.DocIO.Portable.dll
    Syntax
    public class InlineContentControl : ParagraphItem, IXDLSSerializable, IWidget, IOfficeRun, IInlineContentControl, IParagraphItem, IEntity

    Constructors

    InlineContentControl(WordDocument, ContentControlType)

    Initializes a new instance of the InlineContentControl class.

    Declaration
    public InlineContentControl(WordDocument doc, ContentControlType controlType)
    Parameters
    Type Name Description
    WordDocument doc

    The Word document.

    ContentControlType controlType

    The content control type.

    Examples

    The following example illustrates how to initializes a new instance of the InlineContentControl.

        //Create a new Word document 
        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 InlineContentControl).ParagraphItems.Add(textRange);
        InlineContentControl richTextControl = paragraph.Items.LastItem as InlineContentControl;
        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();
        'Create a new Word document 
        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 last paragraph
        paragraph.AppendInlineContentControl(ContentControlType.RichText)
        Dim textRange As New WTextRange(document)
        textRange.Text = "Rich Text Content Control"
        Dim richTextControl As InlineContentControl = section.LastParagraph.LastItem
        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()

    Properties

    BreakCharacterFormat

    Gets the character format of the content control. Read-only.

    Declaration
    public 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
    public 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.

        //Create a new Word document 
        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 InlineContentControl).ParagraphItems.Add(textRange);
        InlineContentControl richTextControl = paragraph.Items.LastItem as InlineContentControl;
        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();
        'Create a new Word document 
        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 last paragraph
        paragraph.AppendInlineContentControl(ContentControlType.RichText)
        Dim textRange As New WTextRange(document)
        textRange.Text = "Rich Text Content Control"
        Dim richTextControl As InlineContentControl = section.LastParagraph.LastItem
        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()

    EntityType

    Gets the type of the entity.

    Declaration
    public override EntityType EntityType { get; }
    Property Value
    Type Description
    EntityType

    The EntityType of the current item.

    Overrides
    Entity.EntityType

    ParagraphItems

    Gets the content control paragraphitems. Read-only.

    Declaration
    public ParagraphItemCollection ParagraphItems { get; }
    Property Value
    Type Description
    ParagraphItemCollection

    The ParagraphItemCollection of the current control.

    Examples

    The following example illustrates how to set the properties for content control.

        //Create a new Word document 
        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 InlineContentControl).ParagraphItems.Add(textRange);
        InlineContentControl richTextControl = paragraph.Items.LastItem as InlineContentControl;
        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();
        'Create a new Word document 
        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 last paragraph
        paragraph.AppendInlineContentControl(ContentControlType.RichText)
        Dim textRange As New WTextRange(document)
        textRange.Text = "Rich Text Content Control"
        Dim richTextControl As InlineContentControl = section.LastParagraph.LastItem
        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()

    Methods

    CloneImpl()

    Creates a duplicate of the entity.

    Declaration
    protected override object CloneImpl()
    Returns
    Type Description
    System.Object
    Overrides
    ParagraphItem.CloneImpl()

    Implements

    IXDLSSerializable
    IOfficeRun
    IInlineContentControl
    IParagraphItem
    IEntity
    Back to top Generated by DocFX
    Copyright © 2001 - 2023 Syncfusion Inc. All Rights Reserved