Introduction
sgNeoWordEditor puts a word processor into a VisualNEO Win publication. It is based on the Windows RichEdit
control (Msftedit.dll), which is part of every Windows version. It opens and saves Word (.docx), RTF and
text files. It exports to PDF, HTML and Markdown, and it prints with headers and footers. It also has spell checking,
tables, pictures, OLE objects, hyperlinks, a ruler, a formatting toolbar and a Word-style page view.
Each editor sits on a Rectangle object on a page. A publication can have several editors at once, one per
Rectangle. Every command names the Rectangle as its first parameter.
Requirements. VisualNEO Win with the plug-in installed (App › Plug-Ins › Install).
Windows 8 or later for spell checking; Windows 10/11 have everything else built in. Vector PDFs use the
Microsoft Print to PDF printer when it is installed; otherwise PDFs are made from page images automatically.
Getting started
- Draw a Rectangle on the page, for example
Rectangle1. Its size is the size of the editor.
- In the page's Page Enter actions, open the editor. Then load a document, or start a new one:
sgEditorOpen "Rectangle1" "[DocText]" "" "Single" "True" "" "" "Centimeters" "" "True"
sgEditorPageView "Rectangle1" "FitWidth" ""
sgEditorLoadFile "Rectangle1" "[PubDir]Welcome.docx" "[Loaded]"
sgEditorSetFocus "Rectangle1"
- Add buttons that call commands. Examples:
sgEditorSetFontStyle "Rectangle1" "ToggleBold",
or sgEditorSaveFile "Rectangle1" "" "[Saved]" to save to the file that was loaded.
- On Page Exit you can use
sgEditorClose "Rectangle1" "Hide". The document is kept, and the
next sgEditorOpen shows it again. Use "Free" to discard it.
The plug-in's own toolbar (sgEditorOpen parameter Toolbar = True) already has font,
style, alignment, list, indent, colour, link, undo and page-view buttons. You only need your own buttons for
anything else.
Word, RTF and page view
Word documents. sgEditorLoadFile, sgEditorLoadFileDialog, sgEditorSaveFile,
sgEditorSaveFileDialog and sgEditorExportDocument read and write .docx. No Microsoft Word
is needed.
The conversion keeps the following:
- character and paragraph formatting, and styles;
- multi-level lists;
- hyperlinks;
- tables, including merged cells, borders and shading;
- pictures and text boxes;
- footnotes and endnotes, which appear as notes at the end;
- section breaks;
- page size and margins;
- header and footer text;
- the document title.
RichEdit cannot show floating positions, columns, comments or tracked changes, so those are not kept.
RTF. The paper size and margins stored in an .rtf are read on loading and written on saving.
Page view. sgEditorPageView "Rectangle1" "On" shows the document like Word's Print Layout: a white sheet
of the real paper width on a grey desk, with the text inside the page margins. The margins come from the page setup,
from the loaded document, or from sgEditorPageSetupDialog. New documents use Word's 1-inch margins.
Open/Close
Attach the editor to a Rectangle object, and hide or free it again.
Open and configure the Rich Edit control.
sgEditorOpen "Rectangle" "Variable" "OnFormat" "Border" "Toolbar" "BackgroundColor" "TextColor" "MeasurementUnits" "OnLink" "Ruler"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object to attach the Rich Edit control to |
Variable | variable | Variable linked to the editor text [VariableName] |
OnFormat | subroutine | Subroutine to run on format change |
Border | text (option) | Border
|
Toolbar | text (option) | Show formatting toolbar
|
BackgroundColor | colour | Background color R,G,B · #RRGGBB · clName · number |
TextColor | colour | Text color R,G,B · #RRGGBB · clName · number |
MeasurementUnits | text (option) | Measurement units
PixelsInchesCentimetersPoints
|
OnLink | subroutine | Subroutine to run when a link is clicked |
Ruler | text (option) | Show ruler
|
The object must be a Rectangle. OnFormat receives [sgFontName] [sgFontSize] [sgFontStyle] [sgAlignment] [sgSelStart] [sgSelLength]; OnLink receives [sgLinkURL].
ExamplesgEditorOpen "Rectangle1" "[DocText]" "OnFormatChange" "Single" "True" "" "" "Centimeters" "OnLinkClick" "True"
Close the text control window.
sgEditorClose "Rectangle" "Options"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
Options | text (option) | Close mode
Hide hide the editor; its document is kept for the next sgEditorOpenFree destroy the editor and its document
|
Hide keeps the document for a later sgEditorOpen; Free releases the editor.
ExamplesgEditorClose "Rectangle1" "Hide"
Set focus to the editor.
sgEditorSetFocus "Rectangle"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
ExamplesgEditorSetFocus "Rectangle1"
Realign the editor.
sgEditorReAlign "Rectangle"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
ExamplesgEditorReAlign "Rectangle1"
Redraw the editor.
sgEditorRedraw "Rectangle"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
ExamplesgEditorRedraw "Rectangle1"
sgEditorRichEditVersion
ID 41
Get Rich Edit version.
sgEditorRichEditVersion "Rectangle" "Variable"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
Variable | variable | Variable to receive the result [VariableName] |
ExamplesgEditorRichEditVersion "Rectangle1" "[Result]"
Settings
Page view, colours, reading direction, wrapping, read-only mode, zoom, header and footer.
Show the document as a page, like Word's Print Layout.
sgEditorPageView "Rectangle" "Mode" "DeskColor"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
Mode | text (option) | Page view
On show the page sheetOff normal editor viewToggle switch between the twoFitWidth page view, zoomed so the sheet width fits
|
DeskColor | colour | Desk colour around the page (blank = grey) R,G,B · #RRGGBB · clName · number |
The sheet has the paper size and margins of the page setup (a loaded .docx or .rtf brings its own). FitWidth also zooms so the whole sheet width is visible. Blank desk colour = Word grey.
ExamplesgEditorPageView "Rectangle1" "FitWidth" ""
sgEditorSetBackground
ID 2
Get or set the editor background color.
sgEditorSetBackground "Rectangle" "Color" "Variable"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
Color | colour | Background color (-1 = read current) R,G,B · #RRGGBB · clName · number |
Variable | variable | Variable to receive the color (when Color is -1) [VariableName] |
Use -1 as Color to read the current background color into the variable.
ExamplesgEditorSetBackground "Rectangle1" "255,253,240" ""
Set bidirectional text mode.
sgEditorBiDiMode "Rectangle" "BiDiMode"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
BiDiMode | text (option) | Bidirectional mode
LeftToRightRightToLeftAuto each paragraph takes its direction from its own text
|
RightToLeft / LeftToRight set every paragraph; Auto picks the direction per paragraph from its text.
ExamplesgEditorBiDiMode "Rectangle1" "LeftToRight"
sgEditorHideSelection
ID 24
Set selection visibility on focus loss.
sgEditorHideSelection "Rectangle" "Options"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
Options | text (option) | Hide selection when the editor loses focus
|
ExamplesgEditorHideSelection "Rectangle1" "True"
Set plain/rich text mode.
sgEditorPlainText "Rectangle" "Options"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
Options | text (option) | Plain text mode
|
ExamplesgEditorPlainText "Rectangle1" "True"
Set word wrapping.
sgEditorWordWrap "Rectangle" "Options"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
Options | text (option) | Word wrap
|
ExamplesgEditorWordWrap "Rectangle1" "True"
Set write mode.
sgEditorWriteMode "Rectangle" "Options"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
Options | text (option) | Write mode
EditMode the user can editReadOnly the user cannot change the textEnableEditProtected protected text may be changedDisableEditProtected protected text is locked again
|
EnableEditProtected lets the user change protected text; DisableEditProtected blocks it again.
ExamplesgEditorWriteMode "Rectangle1" "EditMode"
Get or set the zoom factor.
sgEditorZoom "Rectangle" "Variable"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
Variable | variable | Variable holding the zoom percent [VariableName] |
Put -1 in the variable to read the current value into it; any other value is applied. Percent, 100 = normal.
ExampleSetVar "[Zoom]" "125"
sgEditorZoom "Rectangle1" "[Zoom]"
File
New Word documents, loading and saving (.docx, .rtf, .txt, .html, .md, .pdf) and exports.
Start a new, empty Word document.
sgEditorNewWordFile "Rectangle" "FileName" "PageSize" "PrintOrientation"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
FileName | file name | New Word file (blank = choose later) |
PageSize | text (option) | Page size
|
PrintOrientation | text (option) | Orientation
|
Clears the text and resets page setup, header and footer. With a file name the empty .docx is created at once and becomes the current file for sgEditorSaveFile.
ExamplesgEditorNewWordFile "Rectangle1" "[PubDir]Letter.docx" "A4" "Portrait"
Load a Word (.docx), RTF or text file.
sgEditorLoadFile "Rectangle" "FileName" "Variable"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
FileName | file name | Document to load |
Variable | variable | Variable to receive True or False [VariableName] |
The format is detected from the file content. The variable receives True or False; [LastError] holds the reason of a failure. Blank file name = Open dialog.
ExamplesgEditorLoadFile "Rectangle1" "[PubDir]Report.docx" "[Loaded]"
If "[Loaded]" "=" "False"
AlertBox "Cannot open" "[LastError]"
EndIf
Save the document as Word (.docx), RTF, text, HTML, Markdown or PDF.
sgEditorSaveFile "Rectangle" "FileName" "Variable"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
FileName | file name | File to save (blank = current file) |
Variable | variable | Variable to receive True or False [VariableName] |
The extension picks the format. Blank file name = the file last loaded or saved (Save dialog when there is none).
ExamplesgEditorSaveFile "Rectangle1" "" "[Saved]"
sgEditorLoadFileDialog
ID 31
Load a Word (.docx), RTF or text file.
sgEditorLoadFileDialog "Rectangle" "FileName"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
FileName | file name | File to load |
Leave the file name blank to show the Open dialog at run time.
ExamplesgEditorLoadFileDialog "Rectangle1" ""
sgEditorSaveFileDialog
ID 43
Save the current document.
sgEditorSaveFileDialog "Rectangle" "FileName"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
FileName | file name | File to save |
Leave the file name blank to show the Save dialog at run time. The extension picks the format: .docx, .rtf, .txt, .html, .md or .pdf.
ExamplesgEditorSaveFileDialog "Rectangle1" "[PubDir]Copy.rtf"
Export the document to PDF.
sgEditorExportToPDF "Rectangle" "Engine" "Resolution" "PageMargins" "PageSize" "PrintOrientation" "PDFFileName"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
Engine | text (option) | PDF engine (Vector = Microsoft Print to PDF, Image = rendered pages)
|
Resolution | text (option) | Resolution of the Image engine (dpi)
|
PageMargins | text | Margins in mm: all or left,top,right,bottom (blank = page setup) |
PageSize | text (option) | Page size (blank = page setup)
"" blank = keep the page setup valueA4A5A3B5LetterLegal
|
PrintOrientation | text (option) | Orientation (blank = page setup)
"" blank = keep the page setup valuePortraitLandscape
|
PDFFileName | file name | PDF file to create |
Header/footer from sgEditorHeaderFooter are included. Auto uses Vector when the PDF printer is installed.
ExamplesgEditorExportToPDF "Rectangle1" "Auto" "150" "" "A4" "Portrait" "[PubDir]Report.pdf"
sgEditorExportDocument
ID 68
Export the document as Word (.docx), HTML, Markdown, text or RTF.
sgEditorExportDocument "Rectangle" "Format" "FileName"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
Format | text (option) | Format
DOCX Word documentHTMLMarkdownTextRTF
|
FileName | file name | File to create |
Blank format = taken from the file extension. Exporting does not change the current file name.
ExamplesgEditorExportDocument "Rectangle1" "HTML" "[PubDir]Report.html"
Edit
Clipboard, undo, searching and replacing, document state and protected text.
Perform clipboard actions.
sgEditorClipboard "Rectangle" "Options"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
Options | text (option) | Clipboard operation
CutCopyPasteSelectAllClear
|
ExamplesgEditorClipboard "Rectangle1" "Cut"
Undo/redo editor operations.
sgEditorUndo "Rectangle" "Options"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
Options | text (option) | Operation
|
ExamplesgEditorUndo "Rectangle1" "Undo"
Delete the complete text.
sgEditorClear "Rectangle"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
ExamplesgEditorClear "Rectangle1"
Search for text in the document.
sgEditorFindText "Rectangle" "FoundVariable" "FindString" "Start" "Highlight" "MatchCase" "WholeWord"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
FoundVariable | variable | Variable to receive the found position (-1 = not found) [VariableName] |
FindString | text | Text to find |
Start | number | Start position (blank = after the selection) |
Highlight | text (option) | Select the found text
|
MatchCase | text (option) | Match case
|
WholeWord | text (option) | Whole word only
|
ExamplesgEditorFindText "Rectangle1" "[Pos]" "library" "" "True" "False" "True"
Find and replace text.
sgEditorReplaceText "Rectangle" "FindString" "ReplaceWith" "Options" "Variable"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
FindString | text | Find |
ReplaceWith | text | Replace with |
Options | text (option) | Options
AllAll,MatchCaseAll,WholeWordAll,MatchCase,WholeWordNext
|
Variable | variable | Variable to receive the number of replacements [VariableName] |
Options: All (else only the next match), MatchCase, WholeWord.
ExamplesgEditorReplaceText "Rectangle1" "colour" "color" "All,WholeWord" "[Count]"
Check editor state or word count.
sgEditorCheckState "Rectangle" "CheckThis" "Variable"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
CheckThis | text (option) | State to check
CanUndo True if Undo is possibleCanRedo True if Redo is possibleCanPaste True if the clipboard holds text or a pictureWordCount number of words in the document
|
Variable | variable | Variable to receive the result [VariableName] |
ExamplesgEditorCheckState "Rectangle1" "WordCount" "[Words]"
sgEditorModifiedState
ID 32
Get modified state.
sgEditorModifiedState "Rectangle" "Variable"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
Variable | variable | Variable for the modified flag [VariableName] |
If the variable holds TRUE or FALSE the flag is set; otherwise the current state is read into it.
ExampleSetVar "[Changed]" ""
sgEditorModifiedState "Rectangle1" "[Changed]"
If "[Changed]" "=" "True"
sgEditorSaveFile "Rectangle1" "" ""
EndIf
Protect or unprotect the selected text.
sgEditorProtectText "Rectangle" "Options"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
Options | text (option) | Protect the selection
|
Protected text cannot be changed by the user.
ExamplesgEditorProtectText "Rectangle1" "True"
Text & Lines
Put text into the editor, read it back, and work with lines.
Set document text.
sgEditorSetText "Rectangle" "Text"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
Text | text | Text to place in the editor |
Text beginning with {\rtf is loaded as rich text.
ExamplesgEditorSetText "Rectangle1" "Dear reader,"
Get document text.
sgEditorGetText "Rectangle" "Options" "Variable"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
Options | text (option) | Text format
Text plain textRTF the whole document as RTFHTML an HTML pageMarkdown Markdown textSelectedText only the selected textWordAtCursor the word at the caret
|
Variable | variable | Variable to receive the result [VariableName] |
ExamplesgEditorGetText "Rectangle1" "RTF" "[DocRtf]"
sgEditorGetTextLength
ID 22
Get document character count.
sgEditorGetTextLength "Rectangle" "Variable"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
Variable | variable | Variable to receive the result [VariableName] |
ExamplesgEditorGetTextLength "Rectangle1" "[Result]"
Add a line at a specified line number.
sgEditorAddLine "Rectangle" "LineNumber" "Text"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
LineNumber | number | Line number to insert at (-1 = append) |
Text | text | Text of the new line |
ExamplesgEditorAddLine "Rectangle1" "-1" "A new last line"
Delete a specified line.
sgEditorDeleteLine "Rectangle" "LineNumber"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
LineNumber | number | Line number to delete (0-based) |
ExamplesgEditorDeleteLine "Rectangle1" "1"
Get a line of text.
sgEditorGetLine "Rectangle" "Line" "Variable"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
Line | number | Line number (0-based) |
Variable | variable | Variable to receive the result [VariableName] |
ExamplesgEditorGetLine "Rectangle1" "1" "[Result]"
sgEditorGetLineFromChar
ID 19
Get line number from character position.
sgEditorGetLineFromChar "Rectangle" "Variable"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
Variable | variable | Variable to receive the line number at the caret [VariableName] |
ExamplesgEditorGetLineFromChar "Rectangle1" "[Result]"
sgEditorGetTotalLines
ID 23
Get total number of lines.
sgEditorGetTotalLines "Rectangle" "Variable"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
Variable | variable | Variable to receive the result [VariableName] |
ExamplesgEditorGetTotalLines "Rectangle1" "[Result]"
Selection
Read or change the selection.
Get or set selection start.
sgEditorSelStart "Rectangle" "Variable"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
Variable | variable | Variable holding the selection start [VariableName] |
Put -1 in the variable to read the current value into it; any other value is applied.
ExampleSetVar "[Start]" "0"
sgEditorSelStart "Rectangle1" "[Start]"
Get or set selection length.
sgEditorSelLength "Rectangle" "Variable"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
Variable | variable | Variable holding the selection length [VariableName] |
Put -1 in the variable to read the current value into it; any other value is applied.
ExamplesgEditorSelLength "Rectangle1" "[Result]"
Get or set selected text.
sgEditorSelText "Rectangle" "Variable"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
Variable | variable | Variable holding the selected text [VariableName] |
An empty variable receives the selected text; otherwise its text replaces the selection.
ExampleSetVar "[Sel]" ""
sgEditorSelText "Rectangle1" "[Sel]"
. [Sel] now holds the selected text
Font
Character formatting of the selection (or of the text typed next).
Get the font name.
sgEditorGetFontName "Rectangle" "Variable"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
Variable | variable | Variable to receive the result [VariableName] |
ExamplesgEditorGetFontName "Rectangle1" "[Result]"
Set font name.
sgEditorSetFontName "Rectangle" "FontName"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
FontName | font name | Font name |
ExamplesgEditorSetFontName "Rectangle1" "Nirmala UI"
Get the font size.
sgEditorGetFontSize "Rectangle" "Variable"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
Variable | variable | Variable to receive the result [VariableName] |
ExamplesgEditorGetFontSize "Rectangle1" "[Result]"
Set font size.
sgEditorSetFontSize "Rectangle" "FontSize"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
FontSize | number | Font size |
ExamplesgEditorSetFontSize "Rectangle1" "14"
sgEditorGetFontStyle
ID 17
Get the font style.
sgEditorGetFontStyle "Rectangle" "FontStyle" "Variable"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
FontStyle | text (option) | Style to test (blank = list all styles)
"" blank = keep the page setup valueBoldItalicUnderlineStrikeout
|
Variable | variable | Variable to receive the result [VariableName] |
ExamplesgEditorGetFontStyle "Rectangle1" "Bold" "[Result]"
sgEditorSetFontStyle
ID 51
Set font style.
sgEditorSetFontStyle "Rectangle" "FontStyle"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
FontStyle | text (option) | Font style
NoneBoldItalicUnderlineStrikeoutBold ItalicToggleBoldToggleItalicToggleUnderlineToggleStrikeoutNoBoldNoItalicNoUnderlineNoStrikeout
|
Bold/Italic/... add a style, ToggleX switches it, NoX removes it, None clears all.
ExamplesgEditorSetFontStyle "Rectangle1" "ToggleBold"
Get or set text color.
sgEditorTextColor "Rectangle" "Color" "Variable"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
Color | colour | Text color (-1 = read current) R,G,B · #RRGGBB · clName · number |
Variable | variable | Variable to receive the color (when Color is -1) [VariableName] |
Use -1 as Color to read the current text color into the variable.
ExamplesgEditorTextColor "Rectangle1" "192,0,0" ""
sgEditorTextColor "Rectangle1" "-1" "[CurrentColor]"
Get or set the text highlight (background) color.
sgEditorHighlight "Rectangle" "Color" "Variable"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
Color | colour | Highlight color (None = remove, -1 = read current) R,G,B · #RRGGBB · clName · number |
Variable | variable | Variable to receive the color (when Color is -1) [VariableName] |
None removes the highlight; -1 reads the current color into the variable.
ExamplesgEditorHighlight "Rectangle1" "#FFFF00" ""
Set superscript or subscript.
sgEditorSetScript "Rectangle" "Options"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
Options | text (option) | Script
NormalSuperscriptSubscriptToggleSuperscriptToggleSubscript
|
ExamplesgEditorSetScript "Rectangle1" "Normal"
Fill a VisualNEO ListBox/ComboBox with font names.
sgEditorGetFontList "Rectangle" "ListBox"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
ListBox | object name | ListBox or ComboBox object to fill |
ExamplesgEditorGetFontList "Rectangle1" "FontCombo"
Paragraph
Alignment, indents, line spacing, bullets and numbering of the selected paragraphs.
sgEditorGetAlignment
ID 13
Get paragraph alignment.
sgEditorGetAlignment "Rectangle" "Variable"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
Variable | variable | Variable to receive the result [VariableName] |
ExamplesgEditorGetAlignment "Rectangle1" "[Result]"
sgEditorSetAlignment
ID 47
Set paragraph alignment.
sgEditorSetAlignment "Rectangle" "Alignment"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
Alignment | text (option) | Alignment
|
ExamplesgEditorSetAlignment "Rectangle1" "Left"
Get or set first-line indentation.
sgEditorFirstIndent "Rectangle" "Variable"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
Variable | variable | Variable holding the first-line indent [VariableName] |
Put -1 in the variable to read the current value into it; any other value is applied.
ExampleSetVar "[Indent]" "1.25"
sgEditorFirstIndent "Rectangle1" "[Indent]"
Get or set left indentation.
sgEditorLeftIndent "Rectangle" "Variable"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
Variable | variable | Variable holding the left indent [VariableName] |
Put -1 in the variable to read the current value into it; any other value is applied.
ExampleSetVar "[Indent]" "-1"
sgEditorLeftIndent "Rectangle1" "[Indent]"
. [Indent] now holds the current left indent
Get or set right indentation.
sgEditorRightIndent "Rectangle" "Variable"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
Variable | variable | Variable holding the right indent [VariableName] |
Put -1 in the variable to read the current value into it; any other value is applied.
ExamplesgEditorRightIndent "Rectangle1" "[Result]"
Get or set line spacing.
sgEditorLineSpacing "Rectangle" "Variable"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
Variable | variable | Variable holding the line spacing [VariableName] |
Put -1 in the variable to read the current value into it; any other value is applied. Values: 1, 1.5, 2 ...
ExampleSetVar "[Spacing]" "1.5"
sgEditorLineSpacing "Rectangle1" "[Spacing]"
sgEditorGetNumbering
ID 20
Get paragraph numbering style.
sgEditorGetNumbering "Rectangle" "Variable"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
Variable | variable | Variable to receive the result [VariableName] |
ExamplesgEditorGetNumbering "Rectangle1" "[Result]"
sgEditorSetNumbering
ID 52
Set bullets or numbering.
sgEditorSetNumbering "Rectangle" "Options"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
Options | text (option) | Numbering (Type[,Period|Paren|Parens|Plain[,Start]])
NoneBulletArabic,Period,1 1. 2. 3. - type, style (Period, Paren, Parens, Plain), startLowerLetter,Paren,1UpperLetter,Period,1LowerRoman,Period,1UpperRoman,Period,1ToggleBullet bullets on/offIncrease one list level deeperDecrease one list level up
|
Increase / Decrease change the list level (indent).
ExamplesgEditorSetNumbering "Rectangle1" "LowerRoman,Paren,1"
Insert
Pictures, tables, special characters, page breaks and hyperlinks.
Insert an image.
sgEditorInsertImage "Rectangle" "PictureName"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
PictureName | file name | Image file (blank = let the user choose) |
ExamplesgEditorInsertImage "Rectangle1" "[PubDir]logo.png"
Insert a table.
sgEditorInsertTable "Rectangle" "Rows" "Columns" "ColumnWidth" "Borders"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
Rows | number | Rows |
Columns | number | Columns |
ColumnWidth | number | Column width (0 = fit page) |
Borders | text (option) | Cell borders
|
Column width is in the sgEditorOpen measurement units; 0 divides the page width equally.
ExamplesgEditorInsertTable "Rectangle1" "3" "4" "0" "True"
sgEditorInsertSpecial
ID 27
Insert a page break or special character.
sgEditorInsertSpecial "Rectangle" "Options"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
Options | text (option) | Item to insert
PageBreak start a new page when printingLineBreakTabNonBreakingSpaceNonBreakingHyphenSoftHyphenEnDashEmDashBulletEllipsisCopyrightRegisteredTrademarkSectionPilcrowDegreeEuroRupeeDate today's dateTimeDateTimeU+2605 any Unicode character by its code
|
U+XXXX inserts any Unicode character; other text is inserted as typed.
ExamplesgEditorInsertSpecial "Rectangle1" "PageBreak"
sgEditorInsertSpecial "Rectangle1" "U+20B9"
Create, edit or remove a hyperlink.
sgEditorLink "Rectangle" "Options"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
Options | text (option) | URL or command
Dialog show the hyperlink dialogClear remove the link at the caretSelection link the selected text to itself (it must be a URL)AutoDetectOn typed URLs become links automaticallyAutoDetectOff stop detecting URLshttps:// any URL: link the selected text to it
|
URL links the selected text; Selection links the selected text to itself. A click sets [sgLinkURL] and [<OnLink>.Source/.Start/.End/.Text/.URL] and runs the OnLink subroutine.
ExamplesgEditorLink "Rectangle1" "https://lissoftware.in"
Spell Check
Windows spell checker: dialog, live underlining and suggestions.
Run spell checking.
sgEditorSpellCheck "Rectangle" "Language" "Options"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
Language | text | Dictionary language, e.g. en-US or English (blank = Windows default) |
Options | text (option) | Mode
Dialog check the document with the spelling dialogLiveOn underline misspelt words while typingLiveOff stop live checking
|
Uses the Windows spell checker (Windows 8+). Dialog checks the document; LiveOn underlines errors while typing.
ExamplesgEditorSpellCheck "Rectangle1" "en-IN" "LiveOn"
sgEditorSpellSuggest
ID 56
Suggest spelling corrections.
sgEditorSpellSuggest "Rectangle" "CheckThisWord" "SuggestWords"
| Parameter | Type | Meaning |
Rectangle | Rectangle object | Rectangle object hosting the Rich Edit control |
CheckThisWord | text | Word to check (blank = word at the caret) |
SuggestWords | variable | Variable to receive the suggestions [VariableName] |
The variable receives -1 if the word is correct, otherwise the suggestions separated by | (empty = none).
ExamplesgEditorSpellSuggest "Rectangle1" "recieve" "[Words]"
. [Words] = receive|relieve|...