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, orIsShiftJison aFieldSymbolto avoid an ambiguous interpretation ofCharacterCode. FieldAdvance’s offset properties arestring, not numeric types — pass point values as strings when settingDownOffset,UpOffset,LeftOffset,RightOffset,HorizontalPosition, orVerticalPosition.- Set
FieldSymbol.FontNameto a font that actually contains the glyph atCharacterCode, or the rendered character may fall back to a missing-glyph placeholder. - Call
Update()after changing any property onFieldAdvanceorFieldSymbolso the field’sResult/DisplayResultreflects the change. - Use
DontAffectsLineSpacingwhen inserting a tall or unusual symbol character that should not stretch the surrounding line’s height.
Common Issues
| Issue | Cause | Fix |
|---|---|---|
ADVANCE field doesn’t move text as expected | The wrong offset property was set, or a value was left at its default | Set the specific DownOffset / UpOffset / LeftOffset / RightOffset (relative) or HorizontalPosition / VerticalPosition (absolute) property that matches the intended movement |
SYMBOL field displays the wrong character | CharacterCode was interpreted under the wrong encoding | Set exactly one of IsAnsi, IsUnicode, or IsShiftJis to match how CharacterCode was authored |
| Symbol character renders as a missing-glyph box | FontName does not contain a glyph for CharacterCode | Set 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/Method | Description |
|---|---|
FieldAdvance | Implements the ADVANCE field; repositions following text without inserting characters |
FieldAdvance.DownOffset / UpOffset / LeftOffset / RightOffset | Relative point offsets applied to the following text |
FieldAdvance.HorizontalPosition / VerticalPosition | Absolute point position applied to the following text |
FieldSymbol | Implements the SYMBOL field; inserts a character by code point |
FieldSymbol.CharacterCode | The character’s code point, in decimal or hexadecimal |
FieldSymbol.IsAnsi / IsUnicode / IsShiftJis | Selects how CharacterCode is interpreted |
FieldSymbol.FontName / FontSize | Font used to render the retrieved character |
FieldSymbol.DontAffectsLineSpacing | Controls whether the inserted character affects paragraph line spacing |