Equations and Formulas Fields

Equations and Formulas Fields

Equations and Formulas Fields

This guide shows how to work with the FieldAdvance and FieldSymbol field classes in Aspose.Words FOSS for .NET, which implement Word’s ADVANCE and SYMBOL fields. Both classes derive from Field and implement IFieldCodeTokenInfoProvider; for the base Field object model itself, see the Working with Fields guide.


Repositioning Text with FieldAdvance

FieldAdvance implements the ADVANCE field, which shifts the text that follows it without inserting visible characters. DownOffset, UpOffset, LeftOffset, and RightOffset (all string) move the following text by a number of points in that direction. HorizontalPosition and VerticalPosition (also string) move the following text to an absolute position measured from the left edge of the column, frame, or text box, and the top edge of the page, respectively.


Inserting Special Characters with FieldSymbol

FieldSymbol implements the SYMBOL field, which inserts a single character by code point. CharacterCode (string) supplies the character’s code point in decimal or hexadecimal. IsAnsi, IsUnicode, and IsShiftJis (all bool) select how CharacterCode is interpreted. FontName and FontSize (string) set the font used to render the retrieved character, and DontAffectsLineSpacing (bool) controls whether the inserted character affects the paragraph’s line spacing.


Tips and Best Practices

  • Set only one of IsAnsi, IsUnicode, or IsShiftJis on a FieldSymbol to avoid an ambiguous interpretation of CharacterCode.
  • FieldAdvance’s offset properties are string, not numeric types — pass point values as strings when setting DownOffset, UpOffset, LeftOffset, RightOffset, HorizontalPosition, or VerticalPosition.
  • Set FieldSymbol.FontName to a font that actually contains the glyph at CharacterCode, or the rendered character may fall back to a missing-glyph placeholder.
  • Call Update() after changing any property on FieldAdvance or FieldSymbol so the field’s Result / DisplayResult reflects the change.
  • Use DontAffectsLineSpacing when inserting a tall or unusual symbol character that should not stretch the surrounding line’s height.

Common Issues

IssueCauseFix
ADVANCE field doesn’t move text as expectedThe wrong offset property was set, or a value was left at its defaultSet the specific DownOffset / UpOffset / LeftOffset / RightOffset (relative) or HorizontalPosition / VerticalPosition (absolute) property that matches the intended movement
SYMBOL field displays the wrong characterCharacterCode was interpreted under the wrong encodingSet exactly one of IsAnsi, IsUnicode, or IsShiftJis to match how CharacterCode was authored
Symbol character renders as a missing-glyph boxFontName does not contain a glyph for CharacterCodeSet FontName to a font known to include that character

FAQ

What does the ADVANCE field do?

It repositions the text that follows it, either by a relative offset (DownOffset, UpOffset, LeftOffset, RightOffset) or an absolute position (HorizontalPosition, VerticalPosition), without inserting visible characters.

How do I insert a specific Unicode character with FieldSymbol?

Set CharacterCode to the character’s code point, set IsUnicode = true, and optionally set FontName / FontSize for the glyph’s rendering.

Are FieldAdvance’s offset values numbers or strings?

They’re string properties (DownOffset, UpOffset, LeftOffset, RightOffset, HorizontalPosition, VerticalPosition), matching the raw field-code argument format.

Does inserting a SYMBOL character affect line spacing?

Set DontAffectsLineSpacing to true to prevent the inserted character from affecting the paragraph’s line height.


API Reference Summary

Class/MethodDescription
FieldAdvanceImplements the ADVANCE field; repositions following text without inserting characters
FieldAdvance.DownOffset / UpOffset / LeftOffset / RightOffsetRelative point offsets applied to the following text
FieldAdvance.HorizontalPosition / VerticalPositionAbsolute point position applied to the following text
FieldSymbolImplements the SYMBOL field; inserts a character by code point
FieldSymbol.CharacterCodeThe character’s code point, in decimal or hexadecimal
FieldSymbol.IsAnsi / IsUnicode / IsShiftJisSelects how CharacterCode is interpreted
FieldSymbol.FontName / FontSizeFont used to render the retrieved character
FieldSymbol.DontAffectsLineSpacingControls whether the inserted character affects paragraph line spacing

See Also