Xamarin.Android

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

    Show / Hide Table of Contents

    Class WIfField

    Represents the IF field in the document.

    Inheritance
    System.Object
    OwnerHolder
    XDLSSerializableBase
    Entity
    WidgetBase
    ParagraphItem
    WTextRange
    WField
    WIfField
    Implements
    IXDLSSerializable
    IOfficeRun
    IWField
    IWTextRange
    IParagraphItem
    IEntity
    Inherited Members
    WField.m_fieldType
    WField.m_bConvertedToText
    WField.m_paraItemType
    WField.m_formattingString
    WField.m_fieldValue
    WField.m_textFormat
    WField.ReadXmlAttributes(IXDLSAttributeReader)
    WField.WriteXmlAttributes(IXDLSAttributeWriter)
    WField.ConvertSwitchesToString()
    WField.Update()
    WField.RemoveText(String, String)
    WField.SplitIfArguments(String, List<Int32>, String)
    WField.UpdateCondition(String, List<Int32>, String)
    WField.RemoveMergeFormat(String)
    WField.Unlink()
    WField.UpdateTextForTextBodyItem(Entity, Boolean)
    WField.UpdateTextForParagraphItem(Entity, Boolean)
    WField.ParseField(String)
    WField.ParseFieldFormat(String[])
    WField.GetClonedTable(Entity)
    WField.RemovePreviousResult()
    WField.GetTextRange(String)
    WField.TextFormat
    WField.EntityType
    WField.FieldPattern
    WField.FieldValue
    WField.FieldType
    WField.FieldCode
    WField.Text
    WTextRange.ApplyCharacterFormat(WCharacterFormat)
    WTextRange.InitXDLSHolder()
    WTextRange.WriteXmlContent(IXDLSContentWriter)
    WTextRange.ReadXmlContent(IXDLSContentReader)
    WTextRange.CharacterFormat
    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.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 WIfField : WField, IXDLSSerializable, IWidget, IOfficeRun, IWField, IWTextRange, IParagraphItem, IEntity
    Examples

    The following code example demonstrates how to add an If field in Word document.

    private void Button1_Click(System.Object sender, System.EventArgs e)
    {
        WordDocument document = new WordDocument();
        IWSection section = document.AddSection();
        IWParagraph paragraph = section.AddParagraph();
        paragraph.AppendText("If field which uses string of characters in expression");
        paragraph = section.AddParagraph();
        //Create the new instance of IF field
        WIfField field = paragraph.AppendField("If", FieldType.FieldIf) as WIfField;
        //Specify the expression, true and false statement in field code
        field.FieldCode = "IF \"True\" = \"True\" \"The given statement is Correct\" \"The given statement is Wrong\"";
        paragraph = section.AddParagraph();
        paragraph.AppendText("If field which uses numbers in expression");
        paragraph = section.AddParagraph();
        //Create the new instance of IF field
        field = paragraph.AppendField("If", FieldType.FieldIf) as WIfField;
        //Specify the expression, true and false statement in field code
        field.FieldCode = "IF 100 >= 1000 \"The given statement is Correct\" \"The given statement is Wrong\"";
        //Update the document fields
        document.UpdateDocumentFields();
        document.Save("Sample.docx", FormatType.Docx);
        document.Close();
    }
    Private Sub button_Click(sender As Object, e As EventArgs)
        Dim document As New WordDocument()
        Dim section As IWSection = document.AddSection()
        Dim paragraph As IWParagraph = section.AddParagraph()
        paragraph.AppendText("If field which uses string of characters in expression")
        paragraph = section.AddParagraph()
        'Create the new instance of IF field
        Dim field As WIfField = TryCast(paragraph.AppendField("If", FieldType.FieldIf), WIfField)
        'Specify the expression, true and false statement in field code
        field.FieldCode = "IF ""True"" = ""True"" ""The given statement is Correct"" ""The given statement is Wrong"""
        paragraph = section.AddParagraph()
        paragraph.AppendText("If field which uses numbers in expression")
        paragraph = section.AddParagraph()
        'Create the new instance of IF field
        field = TryCast(paragraph.AppendField("If", FieldType.FieldIf), WIfField)
        'Specify the expression, true and false statement in field code
        field.FieldCode = "IF 100 >= 1000 ""The given statement is Correct"" ""The given statement is Wrong"""
        'Update the document fields
        document.UpdateDocumentFields()
        document.Save("Sample.docx", FormatType.Docx)
        document.Close()
    End Sub

    Constructors

    WIfField(IWordDocument)

    Initializes a new instance of the WIfField class with the specified IWordDocument instance.

    Declaration
    public WIfField(IWordDocument doc)
    Parameters
    Type Name Description
    IWordDocument doc

    The IWordDocument instance.

    Methods

    CloneImpl()

    Clones itself.

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

    Returns cloned object.

    Overrides
    WField.CloneImpl()

    ParseFieldCode(String)

    Declaration
    protected override void ParseFieldCode(string fieldCode)
    Parameters
    Type Name Description
    System.String fieldCode
    Overrides
    WField.ParseFieldCode(String)

    UpdateFieldCode(String)

    Updates field code

    Declaration
    protected override void UpdateFieldCode(string fieldCode)
    Parameters
    Type Name Description
    System.String fieldCode
    Overrides
    WField.UpdateFieldCode(String)

    Implements

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