FieldSymbol Class
Implements a SYMBOL field.
Inheritance Hierarchy
SystemObject
  Aspose.Words.FieldsField
    Aspose.Words.FieldsFieldSymbol

Namespace: Aspose.Words.Fields
Assembly: Aspose.Words (in Aspose.Words.dll) Version: 19.11
Syntax
public class FieldSymbol : Field

The FieldSymbol type exposes the following members.

Constructors
  NameDescription
Public methodFieldSymbol
Initializes a new instance of the FieldSymbol class
Properties
  NameDescription
Public propertyCode exampleCharacterCode
Gets or sets the character's code point value in decimal or hexadecimal.
Public propertyCode exampleDisplayResult
Gets the text that represents the displayed field result.
(Inherited from Field.)
Public propertyCode exampleDontAffectsLineSpacing
Gets or sets whether the character retrieved by the field affects the line spacing of the paragraph.
Public propertyCode exampleEnd
Gets the node that represents the field end.
(Inherited from Field.)
Public propertyCode exampleFontName
Gets or sets the name of the font of the character retrieved by the field.
Public propertyCode exampleFontSize
Gets or sets the size in points of the font of the character retrieved by the field.
Public propertyCode exampleFormat
Gets a FieldFormat object that provides typed access to field's formatting.
(Inherited from Field.)
Public propertyCode exampleIsAnsi
Gets or sets whether the character code is interpreted as the value of an ANSI character.
Public propertyCode exampleIsDirty
Gets or sets whether the current result of the field is no longer correct (stale) due to other modifications made to the document.
(Inherited from Field.)
Public propertyCode exampleIsLocked
Gets or sets whether the field is locked (should not recalculate its result).
(Inherited from Field.)
Public propertyCode exampleIsShiftJis
Gets or sets whether the character code is interpreted as the value of a SHIFT-JIS character.
Public propertyCode exampleIsUnicode
Gets or sets whether the character code is interpreted as the value of a Unicode character.
Public propertyCode exampleLocaleId
Gets or sets the LCID of the field.
(Inherited from Field.)
Public propertyCode exampleResult
Gets or sets text that is between the field separator and field end.
(Inherited from Field.)
Public propertyCode exampleSeparator
Gets the node that represents the field separator. Can be null.
(Inherited from Field.)
Public propertyCode exampleStart
Gets the node that represents the start of the field.
(Inherited from Field.)
Public propertyCode exampleType
Gets the Microsoft Word field type.
(Inherited from Field.)
Methods
  NameDescription
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodCode exampleGetFieldCode
Returns text between field start and field separator (or field end if there is no separator). Both field code and field result of child fields are included.
(Inherited from Field.)
Public methodCode exampleGetFieldCode(Boolean)
Returns text between field start and field separator (or field end if there is no separator).
(Inherited from Field.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Protected methodNeedStoreOldResultNodes (Inherited from Field.)
Public methodCode exampleRemove
Removes the field from the document. Returns a node right after the field. If the field's end is the last child of its parent node, returns its parent paragraph. If the field is already removed, returns null.
(Inherited from Field.)
Public methodToString (Inherited from Object.)
Public methodCode exampleUnlink
Performs the field unlink.
(Inherited from Field.)
Public methodCode exampleUpdate
Performs the field update. Throws if the field is being updated already.
(Inherited from Field.)
Public methodCode exampleUpdate(Boolean)
Performs a field update. Throws if the field is being updated already.
(Inherited from Field.)
Remarks
Retrieves the character whose code point value is specified in decimal or hexadecimal.
Examples
Shows how to use the SYMBOL field
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Insert a SYMBOL field to display a symbol, designated by a character code
FieldSymbol field = (FieldSymbol)builder.InsertField(FieldType.FieldSymbol, true);

// The ANSI character code "U+00A9", or "169" in integer form, is reserved for the copyright symbol 
field.CharacterCode = 0x00a9.ToString();
field.IsAnsi = true;

Assert.AreEqual(" SYMBOL  169 \\a", field.GetFieldCode());

builder.Writeln(" Line 1");

// In Unicode, the "221E" code is reserved for ths infinity symbol
field = (FieldSymbol)builder.InsertField(FieldType.FieldSymbol, true);
field.CharacterCode = 0x221E.ToString();
field.IsUnicode = true;

// Change the appearance of our symbol
// Note that some symbols can change from font to font
// The full list of symbols and their fonts can be looked up in the Windows Character Map
field.FontName = "Calibri";
field.FontSize = "24";

// A tall symbol like the one we placed can also be made to not push down the text on its line
field.DontAffectsLineSpacing = true;

Assert.AreEqual(" SYMBOL  8734 \\u \\f Calibri \\s 24 \\h", field.GetFieldCode());

builder.Writeln("Line 2");

// Display a symbol from the Shift-JIS, also known as the Windows-932 code page
// With a font that supports Shift-JIS, this symbol will display "あ", which is the large Hiragana letter "A"
field = (FieldSymbol)builder.InsertField(FieldType.FieldSymbol, true);
field.FontName = "MS Gothic";
field.CharacterCode = 0x82A0.ToString();
field.IsShiftJis = true;

Assert.AreEqual(" SYMBOL  33440 \\f \"MS Gothic\" \\j", field.GetFieldCode());

builder.Write("Line 3");

doc.Save(ArtifactsDir + "Field.SYMBOL.docx");
See Also