HLP Tej
HLP Tej
TE Edit control
Version 28
2011-2021
Austin, TX 78728
512-733-2525
The Software is protected by copyright laws and international copyright treaties, as well as
other intellectual property laws and treaties. The Software is licensed, not sold. This
LICENSE AGREEMENT grants you the following rights:
A) This product is licensed per developer basis. Each developer working with this package
needs to purchase a separate license.
B) When used this product within a desktop application, you are granted the right to modify
and link the editor routine into your application. Such an application is free of distribution
royalties with these conditions: the target application is 'larger' than the editor; the target
application is not a standalone word-processor; the target application is not a programmer's
utility 'like' a text editor; the target application is not a programmer's product to convert to
or from the RTF, HTML, PDF and DOCX formats; and the source code (or part) of the editor
is not distributed in any form.
C. The DESKTOP LICENSE allows for the desktop application development. Your desktop
application using this product can be distributed royalty-free. Each desktop license allows
one developer to use this product on up to two development computers. A developer must
purchase additional licenses to use the product on more than two development computers.
D. The SERVER LICENSE allows for the server application development. The server
licenses must be purchased separately when using this product in a server application.
Additionally, the product is licensed per developer basis. Only an UNLIMITED SERVER
LICENSE allows for royalty-free distribution of your server applications using this product.
E. ENTERPRISE LICENSE: The large corporations with revenue more than $50 million and
large government entities must purchase an Enterprise License. An Enterprise license is
also applicable if any target customer of your product using the Software have revenue
more than $500 million. Please contact us at info@subsystems.com for a quote for an
Enterprise License.
F. Your license rights under this LICENSE AGREEMENT are non-exclusive. All rights not
expressly granted herein are reserved by Licensor.
G. You may not sell, transfer or convey the software license to any third party without
Page 1
Licensor's prior express written consent.
H. The license remains valid for 12 months after the issue date. The subsequent year
license renewal cost is 40 percent of the license acquisition cost. The license includes
standard technical support, patches and new releases.
This software is designed keeping the safety and the reliability concerns as the main
considerations. Every effort has been made to make the product reliable and error free.
However, Sub Systems, Inc. makes no warranties against any damage, direct or indirect,
resulting from the use of the software or the manual and can not be held responsible for the
same. The product is provided 'as is' without warranty of any kind, either expressed or
implied, including but not limited to the implied warranties of suitability for a particular
purpose. The buyer assumes the entire risk of any damage caused by this software. In no
event shall Sub Systems, Inc. be liable for damage of any kind, loss of data, loss of profits,
interruption of business or other financial losses arising directly or indirectly from the use of
this product. Any liability of Sub Systems will be exclusively limited to refund of purchase
price.
Sub Systems, Inc. offers a 30-day money back guarantee with the product. The money
back guarantee is not available when the product is purchased with dll source.
Page 2
General Overview
The TER editor routine allows a developer to incorporate text editing features into a desktop
or a web application. This product is designed to be simple to use. The TER editor offers
the following features:
Character Formatting and Text Color: The editor allows for multiple fonts and point
sizes within a document. The character styles include bold, underline, italic, superscript,
subscript, and strikeout. The text can be painted in multiple colors.
Imbedded Picture: The picture can be imported from a disk file or from the clipboard. The
editor supports the bitmap, device independent bitmap and metafile picture formats.
Support for Multiple Section, Multiple Column documents. The editor also offers the
Page Mode feature to edit side-by-side multiple column text.
Block Highlighting: The text can be highlighted using character highlighting or line
highlighting functions.
Text Format
Printing and Mail/Merge: The editor can print the selected text or the entire document to
the selected printer. An API function allows your application to print a text buffer without
invoking the text window. This process can also replace the field names with data strings.
Application Programming Interface: The APIs allow you to insert or retrieve text and
format attributes anywhere in the text window. You can also interface to the editor window
using message communication.
In most instances, only a single API function is needed to invoke the editor.
Input and Output Source: The editor can accept data in a buffer or from a disk file.
Likewise, the output can be obtained in a buffer or disk file.
Input and Output text format: The editor supports the following file formats:
Text format
File and buffer size: The editor supports unlimited size text files using Windows' virtual
memory capability.
Text and Picture Frames: The editor in the Page Mode allows for frames which can be
moved and positioned anywhere on a page.
Page 3
Other Features:
Search/replace
Page header/footer
Column break
Table support
Optional ruler
Page numbering
Paragraph Spacing
Picture Alignment
Tracking changes
Commenting
Page 4
Getting Started
Unzip teje.zip file into a separate folder, for example c:\demo:
Now use the jar program to unzip the tej25.jar in the demo folder:
This would create a new subdirectory called tej where the Tej class files are extracted:
Now, unzip the demo.zip file in the same folder (c:\demo) to extract the demo class and
source files.
In This Chapter
Differences between the HTML/Javascript and Java
Versions
License Key
Creating an Editor Window
Page 5
Differences between the HTML/Javascript and Java Versions
This manual describes two separate products, TE Edit Control for HTML/Javascript and TE Edit Control for Java.
of API's are common among these two products (hence the common manual), here are some of the salient differ
Ease of use within the Very simple since the javascript is fully Need to tackle security iss
browser. support within a HTML 5 compliant browser. vary from java version to ve
Drag/drop from external Browser does not allow for the security Full support
application reason
Clipboard access from Browser allows only the plain text format Full support
external applications. using ctrl+x, ctrl+c, and ctrl+v keys.
File system The browser allows the editor to import the Conventional file system a
documents and picture files from the local
Page 6
disk using a browser file dialog. Similarly, the
text can be written to the file system as a
downloaded file.
Windows Metafile and Limited on Windows OS and not available on Unlimited on Windows OS
Windows Bitmap format other OS. available on other OS.
support
Linked picture within the Linked picture with file-system references are Full linked picture support
RTF file. not supported since the browser limits
access to the file system.
Page 7
License Key
TE Edit Control for HTML/Javascript
Please apply the product key as described in your license delivery e-mail.
Your license k ey is e-mailed to you after your order is processed. You would set the
license key using the TerSetLicenseKey static function. This should be preferably done
before creating any TE control to avoid pop-up nag screens.
Tej.TerSetLicenseKey("wwwww-xxxxx-yyyyy-zzzzz")
Page 8
Creating an Editor Window
This chapter describes how to create the editor session for the HTML/Javascript and Java versions of TE
Edit Control.
In This Chapter
TE Edit Control for HTML/Javascript
TE Edit Control for Java
Page 9
TE Edit Control for HTML/Javascript
This topic describes the method of directly inserting the editor control into your HTML page using the 'canvas' element. Howe
product also contains an ASP.NET wrapper dll called WebTeh.dll. If you are using ASP.NET, please refer to the ASP.NET In
topic for embedding the editor control into your ASP.NET page.
The distribution file contains a number of files. The editor code is contained in the terh28.js file. Please copy the following file
your project folder, such as: c:\inetpub\wwwroot\myapp
ter_hlp.pdf Editor help file for the user. This file is displayed when the user clicks on the 'help' to
icon.
1. Add a script function called ControlCreated which shall be called after the control is created. Here is wh
will add statements to customize the control for your need. You can also add statement to catch events. An
handler function used to catch the events should be physically placed before the 'ControlCreated' event func
browser loads these in proper order.
4. Call the TerInit function to create the editor in the 'canvas' element.
Here is an example:
NOTE: ALL EDITOR CONSTANT, SUCH AS ID_PASTE, MUST BE PREFIXED WITH A tc. PREFIX
<script>
function PreprocessEvent(obj,ActionType,ActionId) {
"id: ",ActionId);
Page 10
}
function Hypertext(obj,HText,HCode) {
if (HCode.indexOf("http://")==0) window.open(HCode);
</script>
<script>
var tej=null;
function ControlCreated(te) {
tej.TerSetEvent("Preprocess",PreprocessEvent); // an example of
tej.TerSetEvent("Hypertext",Hypertext);
</script>
<script src="terh28.js"></script>
<table><tr>
<td>
<div>
Page 11
style="border: 1px solid;"
data-word-wrap = "true"
data-page-mode = "true"
data-print-view-mode = "true"
data-fitted-view = "false"
data-show-menu = "true"
data-show-status-bar = "true"
data-show-ruler = "true"
data-show-vert-ruler = "true"
data-show-tool-bar = "true"
data-border-margin = "true"
data-rtf-output = "true"
data-read-only-mode = "false"
data-vert-scroll-bar = "true"
data-horz-scroll-bar = "true"
>
</canvas>
</div>
</td>
</tr></table>
</div>
<!-- Create the editor session within the canvas element created above.
This should be done after the loading the script (above) and
-->
Page 12
<script>
ControlCreated(te1);
</script>
Page 13
TE Edit Control for Java
The Tej class extends the the Panel class. Here are the steps to add a Tej class object to
your application Frame window.
(Please refer to the ASP.NET Interface for a description of the steps needed to insert a Tejw
Applet object into your ASP.NET application).
To start, extract the tej28.jar files into one of the folders in the class path:
This would create a new subdirectory called tej where the Tej class files are extracted. 'tej' is
also the name of the package for this product. The 'import' statement should be used on the
top of your application to access the editor classes.
import tej.*;
Tej tej=null;
JMenuBar MainMenu=null;
public dmo_te()
frame=this;
addWindowListener(this);
setLocation(x,y);
setSize(width,height);
Page 14
setTitle("Unknown");
tej.addTejListener(tej_listener);
MainMenu=tej.TerBuildMenu();
MainMenu.setBorder(BorderFactory.createLineBorder(Color.black));
add(MainMenu,BorderLayout.NORTH);
Page 15
// add the Tej control, the control is actually constructed
in the WindowActivated event
/****************************************************************
*****
OnCreate:
Here you can add additional code that relies on Tej control
*****************************************************************
*****/
void OnCreate()
control
////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
Page 16
// provide overrides for the event which you would like to
use
JOptionPane.showMessageDialog(frame,ev.text,ev.code,
JOptionPane.PLAIN_MESSAGE);
frame.setTitle(ev.DocName);
};
/////////////////////////////////////////////////////////////////
//////
// WindowListener methods
/////////////////////////////////////////////////////////////////
/////
if (!tej.TerControlCreated()) {
OnCreate();
Page 17
public void windowClosing(WindowEvent ex) {
int MessageResult;
if (JOptionPane.YES_OPTION==(MessageResult=
JOptionPane.showConfirmDialog(this,"File
modified.
if (!tej.SaveTerFile(null)) return;
else if (MessageResult==JOptionPane.CANCEL_OPTION)
return;
Window w = ex.getWindow();
w.setVisible(false);
w.dispose();
Page 18
Control Methods
These API functions allow you to open, close and manipulate data in a TE window.
The example supplied with the control methods in this chapter use the tej. prefix which is
applicable only to the Java version of TE Edit Control. For TE Edit Control for
HTML/Javascript, all program constants must be prefixed by a tc. namespace, example:
tc.ID_PASTE, tc.TP_CUR_LINE.
Before a TE control is created, please set the license key to unlock the full functionality of
the product.
In This Chapter
Import and Export
Text Insert, Append and Delete
Print and Print-preview
Character Formatting
Paragraph Formating
Section Formatting
Document
Text Selection
Cursor and Text Position
Table
Hyperlink
Mail-merge
Picture and Embedded Controls
Page Header/Footer
Frame and Drawing Objects
Footnote, Endnote, Bookmark, Tag
Stylesheet
Control Flags
List Numbering
Toolbar
Undo
Input Field
Page
Search, Replace, Locate
Track Changes
Comment
Menu Command
Screen Drawing
Spell Checking
Page 19
HTML Add-on Interface
Miscellaneous
Page 20
Import and Export
This chapter includes the data import and export functions.
In This Chapter
getData
GetTerBuffer
ReadTerFile
SaveTerFile
setData
SetTerBuffer
TerDocName
TerFileToMem
TerGetReadOnly
TerIsModified
TerSetModify
TerSetOutputFormat
TerSetReadOnly
TerQueryExit
Page 21
getData
String GetData()
Page 22
GetTerBuffer
String GetTerBuffer()
etData method.
See Also
SetTerBuffer
TerSetOutputFormat
Page 23
ReadTerFile
boolean ReadTerFile(FileName)
Description: This function instructs the editor to load the specified file for editing. Any
existing text in the window is discarded.
See Also:
SaveTerFile
GetTerBuffer
SetTerBuffer
Page 24
SaveTerFile
boolean SaveTerFile(FileName)
Description: This function instructs the editor to save the document data to the specified
disk file. The format of the output data can be specified by first calling the
TerSetOutputFormat function.
See Also:
ReadTerFile
GetTerBuffer
SetTerBuffer
TerSetOutputFormat
Page 25
setData
void setData(buffer)
String buffer: // The String containing the new text and format data.
Description: You can use this function to set new data in an existing TEJ window. The
exising text in the window is discarded. The data in the buffer can be provided in one of
these formats:
Text Format
Page 26
SetTerBuffer
String buffer: // The String containing the new text and format data.
String title; // new title for the window. Specify a null if you do not wish
to change the window title
Description: You can use this function to set new data in an existing TEJ window. The
exising text in the window is discarded. The data in the buffer can be provided in one of
these formats:
Text Format
Return Value: This function returns a true value if successful. Otherwise it returns a false
value.
See Also:
GetTerBuffer
InsertTerText
InsertRtfBuf
SaveTerFile
ReadTerFile
Page 27
TerDocName
boolean get; // Set to true to retrieve the current document name, or set to
false to set the new document name.
String name; // Set to the new document name if the 'get' parameter is set to
'false'. This parameter is ignored if the 'get' parameter is set to
true.
Upon successful return if the 'get' parameter is set to true, you can retrieve the current document
name as following:
if (TerDocName(true,"")) {
// TerDocName method
Page 28
TerFileToMem
A utility function to read a file into a character array.
char[] TerFileToMem(FileName)
Description: This function simply reads a file into a character. Please note that this
function does not load the file into the editor's buffer. To load a file into the editor, please
use the function: ReadTerFile.
Return Value: This function returns the character array containing the file. A null value
indicates an error condition.
Page 29
TerGetReadOnly
Retrieve the current Read Only status.
boolean TerGetReadOnly()
Return Value: The function returns true if read-only mode is turned on.
See Also:
TerSetReadOnly
Page 30
TerIsModified
Check if the editor data needs saving.
boolean TerIsModified()
Return Value: This function returns true if the text is modified and is not yet saved.
See Also:
TerSetModify
Page 31
TerSetModify
boolean TerSetModify(modify)
Description: This flag is used to set or reset the modification flag. The modification flag is
used to prompt the user to save the data before exiting the editor.
See Also:
TerIsModified
Page 32
TerSetOutputFormat
boolean TerSetOutputFormat(format)
boolean format; // The output format can be set to one of the following:
Description: This function is used to change the data format of the document when saved.
The original output format is specified by the calling application when the editor window is
created.
Page 33
TerSetReadOnly
Description: This function is used to set or reset the Read Only status.
Return Value: The function returns the previous value of the Read Only status.
See Also:
TerGetReadOnly
Page 34
TerQueryExit
Check if it is OK to close a TE window.
boolean TerQueryExit()
Page 35
Text Insert, Append and Delete
In This Chapter
InsertRtfBuf
InsertTerText
SetTerLine
TerAddAutoCompWord
TerAppendText
TerAppendTextEx
TerDeleteBlock
TerGetLine
TerGetLineInfo
TerGetLineParam
TerGetLineWidth
TerGetRtfSel
TerInsertLine
TerInsertRtfFile
TerInsertText
TerSetLine
Page 36
InsertRtfBuf
Insert a text buffer in the RTF format at the specified cursor location.
int line; // line location (base 0) where the text will be inserted.
You can also set the 'line' parameter to -1 to insert the rtf
document at the current cursor position. Or, set it to -2 to
insert the rtf file at the end of the current document.
int column; // column location (base 0) where the text will be inserted.
This parameter is ignored when the 'line' parameter is set
to -1 or -2.
Description: This function is used to insert a buffer containing the text (in RTF format) into
the specified TEJ window. The text is inserted at the specified line and column position.
To specify the location in terms of the line and column numbers, specify the line number in
the 'line' argument and column number in the 'column' argument. To specify the absolute
location, set the 'column' argument to -1, and set the 'line' argument to the absolute text
location. To insert the text at the current cursor location, set the 'line' and 'col' arguments
to -1. To append the text at the end of the document, set the 'line' to -2.
See Also:
InsertTerText
GetTerBuffer
TerInsertRtfFile
Page 37
InsertTerText
Insert a text buffer in the ASCII format at the current cursor location.
Description: This function is used to insert a String containing the text (in ASCII format)
into the specified TEJ window. The text is inserted at the current cursor position.
The text lines within the buffer must be delimited using CR/LF pair.
See Also:
InsertRtfBuf
TerAppendText
SetTerBuffer
SetTerCursorPos
Page 38
SetTerLine
This function has been replaced by the TerSetLine function.
Page 39
TerAddAutoCompWord
Description: This function adds the key word and the expansion phrase to the
auto-completion list. When the user type a key word, the control automatically replaces it
with the corresponding phrase.
Page 40
TerAppendText
int FontId; // font id to use for the new text. Use -1 for the default
value.
int ParaId; // paragraph id to use for the new text. Use -1 for the
default value.
Description: This function adds the specified text at the end of the buffer. The current
cursor position does not change after the insertion.
This is a very efficient function which can be used to rapidly build a document. This function
does not attempt to wrap the text as they are being added. Your application should call the
TerRewrap or TerRepaginate functions after making a series of calls to this function.
See Also:
TerAppendTextEx
TerInsertText
TerCreateFont
TerCreateParaId
Page 41
TerAppendTextEx
int FontId; // font id to use for the new text. Use -1 for the default
value.
int ParaId; // paragraph id to use for the new text. Use -1 for the
default value.
int CellId; // Cell id to use for this new text. Use -1 for the default
value. When creating a table structure using this function,
you must specify the current cell id for this parameter.
int ParaFID; // Paragraph frame id. Use -1 for the default value.
See Also:
TerAppendText
TerInsertText
TerInsertLine
TerCreateFont
TerCreateParaId
Page 42
TerDeleteBlock
Page 43
TerGetLine
Description: This routine is used to retrieve the text and the font ids for a specified line.
The 'font' variable receives an array of font ids. You can get further information about each
font id by calling the 'GetFontInfo' function.
Return Value: This function returns the length of the retrieved line. This function return -1 if
an error is encountered or when the 'LineNo' exceeds the total lines in the windows. The
line text and the associated font array can be retrieved using the TerGetOutIntArray
method.
C# Example:
String text;
int[] font;
int len;
if (TerGetLine(LineNo)>0) {
// TerGetLine method
There is one font-id associated with each character on the line. Therefore the string length
of the line-text would be the same as the length of the font id array.
See Also:
Page 44
TerSetLine
TerGetLineInfo
TerGetParaInfo
GetFontInfo
Page 45
TerGetLineInfo
boolean TerGetLineInfo(LineNo);
The following information can be retrieved by using the TerGetOutInt method after
a successful return from this method.
if (TerGetLineInfo(LineNo)) {
ParaId = TerGetOutInt("ParaId");
if (TerGetLineInfo(LineNo)) {
CellId = TerGetOutInt("CellId");
if (TerGetLineInfo(LineNo)) {
ParaFID = TerGetOutInt("ParaFID");
if (TerGetLineInfo(LineNo)) {
x = TerGetOutInt("x");
int y; The y position (in twips) of the line relative to the top of the
page. Retrieve as following:
if (TerGetLineInfo(LineNo)) {
y = TerGetOutInt("y");
Page 46
Retrieve as following:
if (TerGetLineInfo(LineNo)) {
height = TerGetOutInt("height");
line
control
space characters
rule
screen frame
dash characters
Page 47
aligned picture
tej.LFLAG_FNOTETEXT : contains a
footnote
text
hyphenation.
this line
this line
contents
list number to
display
field in it
tej.LFLAG_SELECTED : result of
LineSelected
function
Page 48
assumes a decimal
tab in the
beginning of the
line
Retrieve as following:
if (TerGetLineInfo(LineNo)) {
lflags = TerGetOutInt("lflags");
tej.INFO_FRAME = displaced by a
frame
frame
Retrieve as following:
Page 49
if (TerGetLineInfo(LineNo)) {
InfoFlags = TerGetOutInt("InfoFlags");
Description: The x, y, and the height values are available in the Page Mode only.
Return Value: This function returns a true value when successful. Otherwise it returns
false. The TerGetOutInt parameter can be used to retrieve various bit of information after a
successful return from this method:
if (TerGetLineInfo(LineNo)) {
CellId = TerGetOutInt("CellId");
ParaId = TerGetOutInt("ParaId");
See
Also:
TerGet
LineWi
dth
Page 50
TerGetLineParam
Return Value: The function returns the value for the requested parameter. It returns
LP_ERROR to indicate an error condition.
Page 51
TerGetLineWidth
int TerGetLineWidth(LineNo)
Return Value: This function returns the line width in twips. A return value of -1 indicates an
error condition.
See Also
TerGetLineInfo
Page 52
TerGetRtfSel
Retrieve the selected text in the RTF format.
String TerGetRtfSel()
Return Value: This function returns the String containing the selected text in the RTF
format.
See Also:
TerGetTextSel
GetTerBuffer
SetTerBuffer
ReadTerFile
SaveTerFile
Page 53
TerInsertLine
int FontId; // font id to use for the new text. Use -1 for the default value.
int ParaId; // paragraph id to use for the new text. Use -1 for the default
value.
int CellId; // Cell id to use for this new text. Use -1 for the default
value. When creating a table structure using this function,
you must specify the current cell id for this parameter.
int ParaFID; // Paragraph frame id. Use -1 for the default value.
Description: This function provides a very fast method of inserting a line of text before
the current line. After the insertion the cursor is moved to the first character of the next
line. In a batch of calls to the TerInsertLine function, the 'repaint' argument should be set
to true only for the last call to this function.
See Also:
TerAppendText
TerInsertText
TerCreateFont
TerCreateParaId
Page 54
TerInsertRtfFile
int line; // line location (base 0) where the text will be inserted.
You can also set the 'line' parameter to -1 to insert the rtf
document at the current cursor position. Or, set it to 2 to
insert the rtf file at the end of the current document.
int column; // column location (base 0) where the text will be inserted.
This parameter is ignored when the 'line' parameter is set
to -1 or 2.
Description: Please refer to the InsertRtfBuf function for further description of the 'line' and
'column' arguments.
See Also:
InsertRtfBuf
SetTerBuffer
Page 55
TerInsertText
int FontId; // font id to use for the new text. Use -1 for the default
value.
int ParaId; // paragraph id to use for the new text. Use -1 for the
default value.
Description: This function inserts the specified text at the current cursor position. After the
operation the cursor is positioned after the inserted text.
See Also:
TerAppendText
InsertTerText
TerCreateFont
TerCreateParaId
Page 56
TerSetLine
int[] font; // Contain the font id array to apply. You can set this
parameter to null if the font ids are not available.
Description: This function is used to set new text for a line. The length of the 'font' array
must be identical to the number of characters in the text string. The font array must contain
valid font ids (0 to TotalFonts - 1). You can get information about an editor font id by using
the GetFontInfo function.
See Also:
TerGetLine
GetFontInfo
Page 57
Print and Print-preview
In This Chapter
TerIsPrinting
TerMergePrint
TerOverridePageSize
TerPrint
TerPrintPreview
TerSelectPrint
TerSetDefPrinter
TerSetPreview
TerSetPrinter
TerSetPrintPreview
TerSpoolBegin
TerSpoolEnd
Page 58
TerIsPrinting
Check if the editor is printing a document.
boolean TerIsPrinting()
Return Value: This function returns true if the editor is printing or previewing a document.
See Also:
TerPrint
Page 59
TerMergePrint
Description: This function is used to print a buffer or a file to a specified printer or window
device context and at a specified location on the page. If requested, this function can
replace the field names with field data. The print parameter class (TejPrint) is used to
specify the printing parameters.
class TejPrint {
char InputType;
String file;
String buffer;
Graphics gr;
boolean IsPrinter
Rectangle rect;
boolean FullPage;
int StartPos;
boolean OnePage;
int NextPos;
String MergeFields;
String MergeData;
boolean
PrintHiddenText;
boolean
PrintMarginArea;
Form parnt;
int NextY;
Member Variables:
InputType: This flag specifies the input type. If you wish to specify a
disk file name, set the 'InputType' to 'F'. Conversely, if you
Page 60
wish to pass the text in a buffer, set this field to 'B'.
file: If the 'InputType' is 'F', specify the input file path name in
this field.
buffer: If the 'InputType' is 'B', specify the document data using this
variable..
gr: The graphics object of the printer or the window to print the
text. Set to null to print to the default printer.
rect: This field contains the rectangle co-oridnates to print to. The
rectangle co-ordinates are specified in the millimeter (mm)
units. For a higher precision, you can specify the rectangle
coordinates in twips units by specifying the negative values
for the left, right, top and bottom variables in the rect
structure.
FullPage Print full page. This argument is used only when printing to
the default printer (gr = null); The 'rect' variable is not used
when FullPage is set to true.
StartPos: The positive value for this field specifies the character
position to begin the printing. The negative value specifies
the page number to begin printing. Set to 0 to begin the
printing from the first page.
OnePage: Set this variable to true to print one page only. When this
variable is set to false, the editor prints the entire document
by spooling each page.
MergeFields: This field specifies the variable to a list of mail merge field
names. Each field name must be separated by a '|'
character. The list must be terminated by a null character. If
you do not wish to merge field data, set this field to null.
MergeData: This field specifies the variable to a list of mail merge data
strings. Each data String must be separated by a '|'
character. The number of data elements in the 'MergeData'
array MUST be the same as the number of elements in the
'MergeFields' array. The list must be terminated by a null
character. If you do not wish to merge field data, set this
field to null.
Page 61
NextY: (OUTPUT) The field returns the Y pixel position on the
device context after printing.
See Also:
TerPrint
TerMergeFields
TerSetDefPrinter
TerSetInitTypeface
Page 62
TerOverridePageSize
int width; // The page width in twips unit (for the portrait orientation)
int height; // The page height in twips unit (for the portrait orientation)
Description: This function is used to specify a page size which may not be supported by
the selected printer. The editor formats the document to the given page size, but it does
not enforce the page size to the printer. This function is called before an editor window is
opened. Set the width and height to 0 to reset to the regular page size for the subsequent
editor windows.
See Also:
TerSetPaper
Page 63
TerPrint
boolean TerPrint(dialog)
int Colate; // When printing multiple copies, set this parameter to true
to print all pages of the first set, before printing the next
copy.
Description: This function can be used to print the current document. When the 'dialog'
parameter is true, the editor displays a dialog box. The dialog box allows the user to print
the entire document or the selected text.
The text is printed to the currently selected printer using the current settings for margins.
The editor creates a new printer device context for printing.
Return Value: The editor returns a true value when the print job is successfully completed.
See Also:
TerMergePrint
TerIsPrinting
Page 64
TerPrintPreview
Rectangle rect; // The rectangle on the device context where the preview
output is to be displayed. The rectangle must be specified
in the device units.
boolean scale; // Set to true if you wish this API to perform scaling to fit
the page within the rectangle. Set to false if your
application performs the required scaling.
Description: This function is used to draw the image of a page at the specified location on
the specified device context.
See Also:
TerPrint
TerSetPrintPreview
TerSetPreview
Page 65
TerSelectPrint
Print the selected text.
boolean TerSelectPrint()
Description: This function extracts the selected text and uses the TerMergePrint function
to print it to the current printer. Since this function creates a temporary buffer for the
selected text, it is not efficient for huge text selection.
See Also:
TerPrint
TerMergePrint
Page 66
TerSetDefPrinter
Description: Use this function to override the default printer. The new default printer is
effective for the controls created after this function is called. This function can also be
called before calling the TerMergePrint function.
_______________________________________________________________________
Page 67
TerSetPreview
boolean ShowToolbar; // Show the print preview tool bar. This setting takes effect
after the current print preview session.
Page 68
TerSetPrinter
boolean ModDoc; // Set to true to update the current document using the
page-size, page-orienataion and bin values from the
specified PageSettings object. The values are applied to
all sections in the document.
Description: This function is used to set the new printer selection information.
Page 69
TerSetPrintPreview
Description: This function can be called before and after calling the TerPrintPreview
function to increase the print preview performance when doing multi-page print-preview.
Example:
for (page=0;page<PageCount;page++){
See Also:
TerPrintPreview
Page 70
TerSpoolBegin
String name; // The name of the print job. The print-job appears with this
name in the printer queue.
Description: This method together with the TerSpoolEnd method is used to combine
multiple calls to the TerMergePrint method into a single print job. When calling the
TerMergePrint method, the member variable 'gr' within the TejPrint class must be set to
null.
Example:
Page 71
TerSpoolEnd
String name; // The name of the print job. The print-job appears with this
name in the printer queue.
Description: This method together with the TerSpoolBegin method is used to combine
multiple calls to the TerMergePrint method into a single print job. When calling the
TerMergePrint method, the member variable 'gr' within the TejPrint structure must be set to
null.
Example:
Page 72
Character Formatting
In This Chapter
GetFontInfo
SetTerBkColor
SetTerCharStyle
SetTerColor
SetTerDefaultFont
SetTerPointSize
SetTerFont
TerCreateFont
TerGetCurFont
TerGetEffectiveFont
TerGetFontAux1Id
TerGetFontLang
TerGetFontFieldId
TerGetFontParam
TerGetFontSpace
TerGetFontStyleId
TerGetTextColor
TerLocateFontId
TerLocateStyle
TerLocateStyleChar
TerRestrictFont
TerSelectCharStyle
TerSetCharAuxId
TerSetCharLang
TerSetCharScaleX
TerSetCharSet
TerSetCharSpace
TerSetDefLang
TerSetDefTextColor
TerSetEffectiveFont
TerSetFontId
TerSetFontSpace
TerSetFontStyleId
TerSetInitTypeface
TerSetNextFontAux1Id
TerSetTcField
TerSetTextCase
TerSetUlineColor
TerSetWaveUnderline
TerShrinkFontTable
Page 73
GetFontInfo
int FontId; // The editor font id to retrieve. A valid font id would a value
between 0 and TotalFonts - 1.
You can also use this function to get the font information
for a stylesheet item by specifying the style id as a
negative value for this parameter. Also, use the following
constant to specify normal or the current style item.
String typeface; // This variable receives the typeface for the specified font
id. The typeface String can be up to 32 characters.
Retrieve as following:
if (GetFontInfo(FontId)) {
typeface = TerGetOutStr("typeface");
int PointSize; // This integer variable receives the point size for the
specified font id. This argument is used by the
GetFontInfo function only. Retrieve as following:
if (GetFontInfo(FontId)) {
PointSize =
TerGetOutInt("PointSize");
int TwipsSize; // This integer variable receives the size of the specified
font in the twips unit. This is useful when a font uses
fractional point size (1 point equal 20 twips). This
argument is used by the GetFontInfo2 function only.
Retrieve as following:
if (GetFontInfo2(FontId)) {
TwipsSize =
TerGetOutInt("TwipsSize");
Page 74
}
int style: // This integer variable receives the styles flags for the
specified font id. Retrieve as following:
if (GetFontInfo(FontId)) {
style = TerGetOutInt("style");
BOLD: Bold
ULINE: Underline
ITALIC: Italic
STRIKE: Strikethrough
SUPSCR: Superscript
SUBSCR: Subscript
Description: Use this function to retrieve information about an editor font id.
Return Value: This function returns true if successful. The function returns false if an error
is encountered or when the FontId specifies an invalid font id.
See Also
TerGetLine
GetTerFields
TerGetFontStyleId
Page 75
SetTerBkColor
boolean SetTerBkColor(color,repaint)
boolean SetTerBkColorHtml(HtmlColor,repaint)
Description: If a text block is selected before this operation, the new background color is
applicable for every character in the block. If a block is not highlighted, this function selects
the new color for the next character input.
See Also:
SetTerColor
TerGetTextColor
Page 76
SetTerCharStyle
BOLD: Bold
ULINE: Underline
ITALIC: Italic
STRIKE: Strikethrough
SUPSCR: Superscript
SUBSCR Subscript
HLINK: Hyperlink
To specify more than one styles, use the 'logical OR' (|) operator.
boolean OnOff; //true to set the specified styles, false to reset the specified
styles.
Description: This function is used to set or reset the give character styles. If a text block
is highlighted, this operation is applicable to all characters in the block. Otherwise only
the current character is affected.
Example:
Page 77
See Also:
SelectTerText
TerLocateStyle
TerSetUlineColor
Page 78
SetTerColor
Description: This function is used to apply the new color to the text. If a text block is
highlighted, this operation is applicable to all characters in the block. Otherwise the new
color is selected for the next character input.
Example:
See Also:
SetTerBkColor
TerGetTextColor
SelectTerText
Page 79
SetTerDefaultFont
int PointSize; // Point size for the default font. You can also specify the
font size in twips by specifying a negative value (1 point
equal 20 twips)
String HtmlColor; // Color specified in the html String format, such as "red",
"#FFFFFF"
Description: This function is used by an application to change the initial or default font for
the editor. Any text that used the previous default font now gets printed with the new font,
point size, style and color.
Example:
SetTerDefaultFont("Arial",-240,Color.red, true);
See Also:
SetTerFont
Page 80
SetTerPointSize
int pointsize; // size of the new font in points (72 points = 1 inch). You
can specify the font size in twips unit by using a negative
value (1 point equal 20 twips).
Description: This function is used to apply the new font size to the text. If a text block is
highlighted, this operation is applicable to all characters in the block. Otherwise only the
current character is affected.
Example:
SelectTerText(0,0,0,40,false);
SetTerPointSize(14,true);
SetTerPointSize(-280,true);
Se Also:
SelectTerText
SetTerFont
SetTerCharStyle
Page 81
SetTerFont
Description: This function is used to apply the new font typeface to the text. If a text block
is highlighted, this operation is applicable to all characters in the block. Otherwise only the
current character is affected.
Example:
SelectTerText(0,0,0,40,false);
SetTerFont("Arial",true);
See Also:
SelectTerText
SetTerPointSize
SetTerCharStyle
SetTerDefaultFont
Page 82
TerCreateFont
int TerCreateFont( ReuseId, shared, typeface, pointsize, style, color, BkColor, FieldId,
AuxId)
int TerCreateFont2( ReuseId, shared, typeface, pointsize, style, color, BkColor, FieldId,
AuxId, CharStyId, ParaStyId, expand)
int TerCreateFont3( ReuseId, shared, typeface, pointsize, style, color, BkColor, FieldId,
AuxId, CharStyId, ParaStyId, expand, CharSet)
int PointSize; // Point size of the new font. You can also specify the font
size in twips unit by using a negative value (1 point equal
20 twips).
int style; // Style bits for the new font. Refer to the function
SetTerCharStyle for a list of style ids. Use 0 for the default
value.
int FieldId; // Text field id. Use 0 for the default value.
int AuxId; // An application specified id. The editor does not use this
id intejally. Use 0 for default.
Page 83
int exapnd; // Character width expansion in twips unit. Use 0 for
default.
Description: This function is used to create a new font id or to modify an exiting id with
new font information. To modify an existing id, specify the old font id using the 'ReuseId'
argument, otherwise set the 'ReuseId' parameter to -1. When an existing id is modified, this
function automatically updates the text which uses this id with new information.
Return Value: When successful, this function returns the id of the new font. Otherwise it
returns -1.
See Also:
TerCreateParaId
TerAppendText
TerSetNextFontAux1Id
Page 84
TerGetCurFont
int LineNo; // line number for the location. Set to -1 to use the current
text line and column position.
Return Value: This function returns the font id for the character at the given location.
Note: For a picture character, the font ids is same as the picture id. So the font id
returned by the TerGetCurFont function is actually a picture id if the LineNo/ColNo
parameters point to a picture.
See Also:
TerGetEffectiveFont
Page 85
TerGetEffectiveFont
Retrieve the font id effective at the current cursor position.
int TerGetEffectiveFont()
Return Value: This function returns the effective font id for the next keyboard input at the
current cursor position. If your application uses an external toolbar, use this font id to show
the current font attributes in your toolbar.
See Also:
TerGetCurFont
GetFontInfo
Page 86
TerGetFontAux1Id
Return Value: This function returns the Aux1Id associated with a font id..
See Also:
TerSetNextFontAux1Id
Page 87
TerGetFontLang
Return Value: This function returns the language id for the font id. The language ids are
defined by MS RTF Spec 1.5 or later.
See Also:
TerSetCharLang
Page 88
TerGetFontFieldId
Return Value: This function returns the field id associated with a font id. A value of 0
indicates that the font id is not used for a field text.
See Also:
TerGetFontSpace
Page 89
TerGetFontParam
You can also use this function to get the font information
for a stylesheet item by specifying the style id as a
negative value for this parameter. Also, use the following
constant to specify normal or the current style item.
Page 90
picture, otherwise returns 0.
Color color; The 'out' parameter to retrieve the color parameter. This
parameter is valid only for the parameter types which
return a color value.
Return Value: This first method returns the value of the requested parameter. It returns -1
to indicate an error condition.
The second override method returns True if successful, otherwise it returns a False value.
Page 91
TerGetFontSpace
Return Value: This function returns the font space adjustment for the font id in Twips unit.
See Also:
TerSetFontSpace
Page 92
TerGetFontStyleId
Return Value: This function returns the character style id associated with a font id.
See Also:
GetFontInfo
TerSelectCharStyle
TerEditStyle
TerSetFontStyleId
Page 93
TerGetTextColor
Get the foreground and background colors for the specified font id.
int FontId; // The editor font id to retrieve color. A valid font id would a value between 0
and TotalFonts - 1.
You can also use this function to get the text color for a stylesheet item by
specifying the style id as a negative value for this parameter. Also, use the
following constant to specify normal or the current style item:
if (TerGetTextColor(FontId)) {
Color TextColor=TerGetOutColor("TextColor");
String TextColor Get the text foreground color in Html string format. Example:
if (TerGetTextColor(FontId)){
String TextColor=TerGetOutStr("TextColor");
if (TerGetTextColor(FontId)) {
Color BackColor=TerGetOutColor("TextBackColor");
String TextBkColor; Get the text background color in Html text format. Example:
if (TerGetTextColor(FontId)) {
String BackColor=TerGetOutStr("TextBackColor");
Page 94
See Also:
SetTerColor
SetTerBkColor
GetFontInfo
GetTerFields
Page 95
TerLocateFontId
int line; // Starting line number. Set to -1 to start the search from
the current cursor position.
line=tej.TerGetOutInt("Line");
int col; // Starting column position. Set the 'line' and 'col'
arguments to 0 to begin the search from the beginning of
the file.
col=tej.TerGetOutInt("Col");
Return Value: This function returns a true value if the font id is found in the document. The
updated line/col value can be retrieved by using the TerGetOutInt method.
See Also:
TerLocateStyle
Page 96
TerLocateStyle
BOLD: Bold
ULINE: Underline
ITALIC: Italic
STRIKE: Strikethrough
SUPSCR: Superscript
SUBSCR: Subscript
PICT Picture
Use the logical OR (|) operator to specify more than one styles. The search is successful
when any of the specified styles are located.
line=tej.TerGetOutInt("Line");
col=tej.TerGetOutInt("Col");
On a successful search, you can retrieve the following additional information using the
TerGetOutInt method:
int StringLen: The length of the located text. The editor matches the text
up to the end of the line. Example:
Page 97
length=tej.TerGetOutInt("StringLen");
Description: Use his function to locate the beginning of the text with the given character
styles.
See Also:
TerLocateStyleChar
TerLocateFontId
SetTerCharStyle
Page 98
TerLocateStyleChar
int style; // Style bits. See TerLocateStyle function for the detail.
boolean present; // true to test for the presence of the given style, or false
to test for the absence of the given style.
StartLine=tej.TerGetOutInt("StartLine");
StartCol=tej.TerGetOutInt("StartCol");
See Also:
TerLocateStyle
Page 99
TerRestrictFont
Page 100
TerSelectCharStyle
Description: This function is used to assign the given character style to a highlighted
block of text. If a text block is not highlighted, the given style id is used for the next
keyboard input.
See Also:
TerSelectParaStyle
TerEditStyle
TerGetFontStyleId
Page 101
TerSetCharAuxId
Description: This function is used to set an auxiliary id. The editor does not use this id. If
a text block is selected, the new id is applied to all characters in the block. Otherwise, the
id is applied to any newly entered characters at the current cursor location.
Page 102
TerSetCharLang
See Also:
TerGetFontLang
TerSetDefLang
Page 103
TerSetCharScaleX
boolean dialog; // TRUE to show the dialog box to accept the user input
Page 104
TerSetCharSet
int NewCharSet; // New character set. To reset the override, set the
NewCharSet to DEFAULT_CHARSET or 1.
Description: Use this function to override the character-set that the editor should use to
create new fonts.
Page 105
TerSetCharSpace
boolean dialog; // true to show the dialog box to accept the user input
See Also:
TerSetFontSpace
Page 106
TerSetDefLang
See Also:
TerGetFontLang
TerSetCharLang
Page 107
TerSetDefTextColor
String HtmlForeColor; // specify the new text foreground color in the html format,
such as "red", "#FF0000".
Description: The new text color is effective only for the current session. The new text color
is not written out when the document is saved.
TerSetEffectiveFont
boolean TerSetEffectiveFont(FontId)
Description: Normally, when the user click on a text location, the editor picks a font for
text entry at that location. You can override this font automatic selection by using this
function. This function can also be used to set a suitable font before inserting the text using
the InsertTerText function.
Page 108
TerSetEffectiveFont
boolean TerSetEffectiveFont(FontId)
Description: Normally, when the user click on a text location, the editor picks a font for
text entry at that location. You can override this font automatic selection by using this
function. This function can also be used to set a suitable font before inserting the text using
the InsertTerText function.
Page 109
TerSetFontId
Description: Normally, the editor assigns a new id when an object (font or picture) is
inserted in the text. This function can be used to utilize an existing id for the object. The
object at the existing id is released before associating the new object with this id.
Page 110
TerSetFontSpace
See Also:
TerSetCharSpace
TerGetFontSpace
Page 111
TerSetFontStyleId
int CharStyleId; // New character style id for the font. Set to -1 to leave this
value unchanged.
int ParaStyleId; // New paragraph style id for the font. Set to -1 to leave
this value unchanged.
See Also:
TerGetFontStyleId
Page 112
TerSetInitTypeface
boolean TerSetInitTypeface(typeface)
String typeface; // Initial font typeface. The editor uses this font typeface as
the default font for the TerMergePrint function. It also uses
this typeface if the editor window is created without
specifying a font typeface.
Description: To be effective, this function must be called before any editor window is
created and before calling the TerMergePrint function.
Page 113
TerSetNextFontAux1Id
boolean TerSetNextFontAux1Id(Aux1Id)
Description: This function sets the value of the Aux1Id font attribute used by the
TerCreateFont function. The TerCreateFont function sets this value to 0 after creating a new
font id.
See Also:
TerCreateFont
TerGetFontAux1Id
Page 114
TerSetTcField
int level; // The 'tc' field level. The level value must be between 1 and
9 inclusive.
Comment: This function can be used to set the 'tc' field to the text to be included in the
table of contents. Please refer to the TerInsetToc2 function for more information.
Page 115
TerSetTextCase
boolean upper; // Set to true to turn the text into upper case. Set to false
to turn the text into lower case
Page 116
TerSetUlineColor
Description: This function does not automatically apply the underline attribute to the text.
The SetTerCharStyle function should be used to apply the underline attribute.
See Also
SetTerCharStyle
Page 117
TerSetWaveUnderline
Color color; // The color for the wavy underline. The default color is
red. This parameter is applicable to the
TerSetWaveUnderline2 method only.
String HtmlColor; // The color for the wavy underline in the Html string
format. Example, "red', "#FF0000"
boolean set; // Set to true to draw the underline. Set to false to erase
the underline.
boolean repaint; // Set to true to repaint the screen after this operation
Page 118
TerShrinkFontTable
Compress the font table cache.
boolean TerShrinkFontTable()
Description: This function is useful if you are opening and closing a number of documents
under your program's control. This function can be called after opening a new document to
release the unused fonts from the font cache.
Page 119
Paragraph Formating
In This Chapter
ClearTab
ClearAllTabs
ParaHangingIndent
ParaIndentTwips
ParaLeftIndent
ParaRightIndent
ParaNormal
SetTab
SetTerParaFmt
TerCreateBulletId
TerCreateListBullet
TerCreateParaId
TerCreateTabId
TerGetParaInfo
TerGetParaParam
TerGetTabStop
TerSelectParaStyle
TerSelectParaText
TerSetBullet
TerSetBulletEx
TerSetBulletId
TerSetDefTabWidth
TerSetDefTabType
TerSetParaAuxId
TerSetParaBkColor
TerSetParaId
TerSetParaBorderColor
TerSetParaList
TerSetParaShading
TerSetParaTextFlow
TerSetParaIndent
TerSetParaSpacing
TerSetPflags
TerSetTab
Page 120
ClearTab
Description: Use this function to remove a specified tab stop for the selected text.
When a text block is highlighted before calling this function, the selected lines are affected
by this function. Otherwise, only the current paragraph is affected by this operation.
See Also
ClearAllTabs
SetTab
Page 121
ClearAllTabs
boolean ClearAllTabs(repaint)
Description: Use this function to reset all tab stops for the selected text. The tab stops
are reset to their default positions.
When a text block is highlighted before calling this function, the selected lines are affected
by this function. Otherwise, only the current paragraph is affected by this operation.
See
Also
SetTab
ClearT
ab
Page 122
ParaHangingIndent
Description: Use this function to increment or decrement the handing indentation by 1/4 of
an inch.
When a text block is highlighted before calling this function, the selected lines are affected
by this function. Otherwise, only the current paragraph is affected by this operation.
See Also:
ParaLeftIndent
ParaRightIndent
ParaNormal
Page 123
ParaIndentTwips
Please note that the left indentation affects the first line of the paragraph as well. To keep
the first line from moving, apply the equal amount of negative indentation to the first line.
Example:
ParaIndentTwips(50,0,-50,true);
See Also:
ParaLeftIndent
ParaRightIndent
ParaHangingIndent
TerSetParaIndent
Page 124
ParaLeftIndent
Description: Use this function to increment or decrement the left indentation by 1/4 of an
inch.
When a text block is highlighted before calling this function, the selected lines are affected
by this function. Otherwise, only the current paragraph is affected by this operation.
See Also:
ParaHangingIndent
ParaRightIndent
ParaNormal
Page 125
ParaRightIndent
Description: Use this function to increment or decrement the right indentation by 1/4 of an
inch.
When a text block is highlighted before calling this function, the selected lines are affected
by this function. Otherwise, only the current paragraph is affected by this operation.
See Also:
ParaHangingIndent
ParaNormal
Page 126
ParaNormal
When a text block is highlighted before calling this function, the selected lines are affected
by this function. Otherwise, only the current paragraph is affected by this operation.
See Also:
ParaHangingIndent
ParaRightIndent
ParaLeftIndent
SetTerParaFmt
Page 127
SetTab
Note: This function will be eventually discontinued in favor of the TerSetTab function.
See Also:
TerSetTab
ClearTab
ClearAllTabs
Page 128
SetTerParaFmt
To specify more than one styles, use the 'logical OR' (|) operator.
boolean OnOff; // true to set the styles, false to reset the selected styles.
Page 129
When a text block is highlighted before calling this function, the selected lines are affected
by this function. Otherwise, only the current paragraph is affected by this operation.
Example:
SetTerParaFmt(tej.CENTER,true,true);
See Also:
ParaNormal
TerSetFlags
Page 130
TerCreateBulletId
boolean IsBullet; // true to set the paragraph bullet or false to set paragraph
numbering.
int type; // The parameter indicates the symbol used for bullets or
the letters used for paragraph numbering. Please refer to
the TerSetBulletEx function for the constant symbols used
for this parameter.
String TextAft; // Text After the paragraph number (limited to one byte).
Set to null for default.
See Also:
TerSetBulletEx
TerSetBulletId
TerCreateListBullet
Page 131
TerCreateListBullet
int level; // The level number to create the bullet. A simple list
allows only one list level (level 0). A nested list allows up
to 9 levels (0 to 8).
Return Value: This function returns a non-zero bullet id when successful. A value of 0
indicates an error condition.
See Also:
TerCreateParaId
TerCreateBulletId
Page 132
TerCreateParaId
boolean shared; // When true, the editor matches the requested specification
against the existing paragraph ids. If a matching paragraph
id is found, it returns that id. Otherwise it creates a new id.
A true value for this field is mutually exclusive with a zero or
positive value for the ReuseId field.
int FirstIndent; // Indentation for the first line (specified in twips). Use 0 for
default.
int StyleId; // Paragraph Style id. Use 0 for default. When a non-zero
style id is specified, other parameters values to the function
must be what is indicated by this style id.
int AuxId; // An application specified id. The editor does not use this id
intejally. Use 0 for default.
int pflags; // Additional paragraph flags reserved for future use. Use 0
for default.
int SpaceBefore; // Space before the paragraph (specified in twips). Use 0 for
default.
int SpaceAfter; // Space after the paragraph (specified in twips). Use 0 for
default.
Page 133
When creating a paragraph id for use inside a page header, the 'flags' parameter
must be ORed with the PAGE_HDR constant. Similarly, when creating a paragraph
id for use inside a page footer, the 'flags' parameter must be ORed with the
PAGE_FTR constant. A paragraph id for use in the regular text must not have
either of these constants.
int BltId; // The bullet id. When a non-zero bullet id is specified, the
BULLET flag must also be specified in the 'flags' parameter.
Set to 0 for default.
Color BkColor: Paragraph background color. Set to Hex FFFFFF (white) for
default.
Return Value: When successful, this function returns the id of the new paragraph.
Otherwise it returns -1.
See Also:
TerCreateFont
TerAppendText
TerGetParaInfo
TerSetParaId
TerCreateTabId
TerCreateBulletId
TerCreateListBullet
Page 134
TerCreateTabId
int pos[20]; // tab position for each tab stop in twips. The tab
positions must be specified in the ascending order
Description: The tab id created by this function can be used in the TerCreateParaId
function.
Return Value: This function returns a non-zero tab id if successful, otherwise it returns
-1.
See Also:
TerCreatePar
aId
Page 135
TerGetParaInfo
int LineNo; // Line number to retrieve the paragraph information. To specify a para id
instead of a line number, specify a negative value.
boolean IsStyleItem; This parameter is applicable to the TerGetParaInfo3 function only. It allows
you to retrieve the paragraph information for a style item. When this flag is
set to true, the LineNo parameter should be used to pass a style id to
retrieve its information. You can also set the LineNo to SID_CUR to get the
paragraph information about the style being currently edited.
Upon a successful return from this method, the following information can be retrieved by using
TerGetOutInt, TerGetOutColor, or TerGetOutStirng methods:
LeftIndent=tej.TerGetOutInt("LeftIndent")
RightIndent=tej.TerGetOutInt("RightIndent")
int FirstIndent; // Indentation for the first line (in twips). Example:
FirstIndent=tej.TerGetOutInt("FirstIndent")
TabId=tej.TerGetOutInt("TabId")
StyId=tej.TerGetOutInt("StyId")
AuxId=tej.TerGetOutInt("AuxId")
int shading; // Shading amount: a value from 0 (no shading) to 10000 (darkest shading).
Example:
shading=tej.TerGetOutInt("Shading")
Page 136
Example:
pflags=tej.TerGetOutInt("pflags")
SpaceBefore=tej.TerGetOutInt("SpaceBefore")
SpaceAfter=tej.TerGetOutInt("SpaceAfter")
int SpaceBetween; // Space between the paragraph lines (in twips). Example:
SpaceBetween=tej.TerGetOutInt("SpaceBetween")
int flags; // Paragraph attribute flags. Please refer to the 'SetTerParaFmt' function for
a list of paragraph attribute ids. Example:
flags=tej.TerGetOutInt("Flags")
Aux1Id=tej.TerGetOutInt("Aux1Id")
Color BkColor=tej.TerGetOutInt("BkColor")
or,
LineSpacing=tej.TerGetOutInt("LineSpacing")
Return Value: This function returns a true value when successful. Otherwise
it returns false.
See Also:
TerCreateParaId
TerGetParaParam
TerGetParaParam
Page 137
boolean IsStyleItem; This parameter allows you to retrieve the paragraph information for a
style item. When this flag is set to TRUE, the LineNo parameter
should be used to pass a style id to retrieve its information. You can
also set the LineNo to SID_CUR to get the paragraph information
about the style being currently edited.
Color color // Use by the override function to return the color related parameters
using the TerGetOutColor or TerGetOutStr methods.
Color color=tej.TerGetOutColor("Color");
or
Return Value: This function returns the value of the requested parameter. It returns
PARAINFO_ERROR to indicate an error condition.
See Also
TerGetParaInfo
Page 138
TerGetParaParam
boolean IsStyleItem; This parameter allows you to retrieve the paragraph information for a
style item. When this flag is set to TRUE, the LineNo parameter
should be used to pass a style id to retrieve its information. You can
also set the LineNo to SID_CUR to get the paragraph information
about the style being currently edited.
Color color // Use by the override function to return the color related parameters
using the TerGetOutColor or TerGetOutStr methods.
Color color=tej.TerGetOutColor("Color");
or
Return Value: This function returns the value of the requested parameter. It returns
PARAINFO_ERROR to indicate an error condition.
See Also
TerGetParaInfo
Page 139
TerGetTabStop
Return the parameters for a tab stop and the number of tab stop for a line.
int LineNo; // Line number (or paragraph or tab id) to get the tab
parameters for. Set to -1 to get the tab stop parameters
for the current line.
int TabNo; // Tab number to inquire. To simply get the tab count for
the line, set the TabNo parameter to -1.
Upon a successful return from this method, the TerGetOutInt method can be used
to retrieve the temporarily saved values for these variables:
int pPos; // The variable to receive the tab position (in twips).
Example:
int pos=tej.TerGetOutInt("TabPos");
int type=tej.TerGetOutInt("TabType");
int flags=tej.TerGetOutInt("TabFlags");
Page 140
TAB_DOT: Dot leader
Return Value: This function returns the number of tab stops for the line.
See Also:
TerPosTable
Page 141
TerSelectParaStyle
Description: This function is used to assign the given paragraph style to the current
paragraph. If more than one paragraph is highlighted, then all highlighted paragraphs are
assigned the specified paragraph style id.
See Also:
TerSelectCharStyle
TerEditStyle
TerGetFontStyleId
TerSelectParaText
boolean TerSelectParaText(repaint)
Page 142
TerSelectParaText
boolean TerSelectParaText(repaint)
Page 143
TerSetBullet
boolean set; // true to set the paragraph bullet or false to remove it.
Page 144
TerSetBulletEx
boolean TerSetBullet2( set, IsBullet, start, level, type, TextBef, TextAft, repaint)
boolean TerSetBullet3( set, IsBullet, start, level, type, TextBef, TextAft, repaint, flags)
boolean IsBullet; // true to set the paragraph bullet or false to set paragraph
numbering.
int type; // The parameter indicates the symbol used for bullets or
the letters used for paragraph numbering.
Page 145
NBR_LWR_ROMAN Lowercase Roman number
String TextAft; // Text After the paragraph number (limited to one byte).
Set to null for default.
Comment: This method uses the older method of applying bullet and numbering. You can
use the TerSetListBullet function to use the newer list mechanism to apply bullets and
numbers. The new function has a better support for nested lists and multiple lists within a
document.
Page 146
TerSetBulletId
See Also:
TerCreateBulletId
TerCreateParaId
Page 147
TerSetDefTabWidth
Return Value: This function returns the previous value of the tab width in twips.
See Also
TerSetDefTabType
Page 148
TerSetDefTabType
boolean TerSetDefTabType(TabType)
Description: This function allows you to set the tab type for the left-mouse click on the
ruler.
See Also
TerSetDefTabWidth
Page 149
TerSetParaAuxId
int FirstLine; // The first line of the paragraph. Set this parameter to -1
to select the current paragraph or all paragraphs in the
range of selected text (if any text selected)
int LastLine; // The last line for the paragraph. This argument is not
used when 'FirstLine' is set to -1.
Page 150
TerSetParaBkColor
boolean dialog; // true to show the dialog box for the user to select a
background color. false to use the background color
specified by the 'color' parameter.
Page 151
TerSetParaId
int FirstLine; // The first line of the paragraph. Set this parameter to -1
to select the current paragraph or all paragraphs in the
range of selected text (if any text selected).
int LastLine; // The last line for the paragraph. This argument is not
used when 'FirstLine' is set to -1.
See Also;
TerCreateParaId
Page 152
TerSetParaBorderColor
Color color; // New border color for the paragraph. This color is
effective only if the paragraph borders are enabled. You
can enable paragraph borders using the SetTerParaFmt
function.
See Also
SetTerParaFmt
Page 153
TerSetParaList
boolean dialog: // Set to true to show a dialog box to the user to select
list-override and level information.
int level; // The level number to use for the paragraph. A simple list
allows only one list level (level 0). A nested list allows up
to 9 levels (0 to 8).
boolean repaint: // Set to true to repaint the screen after this operation.
See Also:
TerCreateParaId
TerEditList
TerEditListOr
TerCreateListBullet
TerSetListBullet
Page 154
TerSetParaShading
Description: This function is used to specify the shading amount for the current paragraph
or the range of selected paragraphs. The shading value of 10000 indicates the darkest
shading, whereas the shading value 0 indicates no shading.
Page 155
TerSetParaTextFlow
int TextFlow; // The text flow constant can be one of the following:
See Also:
TerSetDocTextFlow
TerSetSectTextFlow
TerSetRowTextFlow
Page 156
TerSetParaIndent
int left; // The left indentation in twips. Set this value to -1 to leave
it unchanged
See Also:
ParaIndentTwips
ParaLeftIndent
ParaRightIndent
ParaHangingIndent
Page 157
TerSetParaSpacing
int SpaceBefore; // Space before the first line of the paragraph in twips
int SpaceAfter; // Space after the last line of the paragraph in twips.
Description: This function is used to specify the paragraph spacing parameters. Use zero
to specify the default value for any parameter.
See Also:
ParaIndentTwips
ParaLeftIndent
ParaRightIndent
ParaHangingIndent
Page 158
TerSetPflags
To specify more than one styles, use the 'logical OR' (|)
operator.
boolean OnOff; // true to set the flags, false to reset the selected flags.
See Also:
ParaNormal
SetTerParaFmt
Page 159
TerSetTab
Return Value: This function returns true if successfulSee Also: ClearTab, ClearAllTabs
See Also:
ClearTab
ClearAllTabs
Page 160
Section Formatting
In This Chapter
TerColBreak
TerGetMarginEx
TerGetSectAlign
TerSetSectBorder
TerGetSectColWidth
TerGetSectBins
TerGetSectInfo
TerGetSectParam
TerGetPageOrient
TerGetSeqSect
TerSectBreak
TerSetMargin
TerSetPaper
TerSetSect
TerSetSectAlign
TerSetSectBorder
TerSetSectColWidth
TerSetSectLineNbr
TerSetSectOrient
TerSetSectPageSize
TerSetSectParam
TerSetSectTextFlow
Page 161
TerColBreak
boolean TerColBreak(repaint)
Description: This function is used to place the following text on the new column. This
function is valid only when editing in the 'Print View' and 'Page' modes. Further, this
function is valid only for sections containing multiple columns. Please note that a column
break can not be created inside an object such as table, frame, text box, etc.
See Also:
TerPageBreak
TerSectBreak
Page 162
TerGetMarginEx
Upon a successful return from this method, the TerGetOutInt method can be used
to retrieve the temporarily saved values for these variables:
int left; // The variable to retrieve the left margin value in twip units.
Example:
left=tej.TerGetOutInt("LeftMargin");
int right; // The variable to retrieve the right margin value in twip
units. Example:
right=tej.TerGetOutInt("RightMargin");
int top; // The variable to retrieve the top margin value in twip
units.Example:
top=tej.TerGetOutInt("TopMargin");
int bottom; // The variable to retrieve the bottom margin value in twip
units. Example:
bottom=tej.TerGetOutInt("BotMargin");
int header; // The variable to retrieve the distance of the header text
from the top of the page. Example:
header=tej.TerGetOutInt("HeaderY");
int footer; // The variable to retrieve the distance of the footer text
from the bottom of the page. Example:
footer=tej.TerGetOutInt("FooterY");
Return Value: This function returns the total number of sections in the document if
successful. Otherwise it returns 0.
See Also:
TerSetMargin
Page 163
TerGetSectAlign
int TerGetSectAlign(sect)
int sect; // Section id to retrieve the page number format. You can
also set this parameter to SECT_CUR to specify the
current section.
Return Value: This function returns the alignment constant for the section. Please refer to
the TerSetSectAlign function for the list of alignment constants.
See Also
TerSetSectAlign
Page 164
TerSetSectBorder
boolean TerGetSectBorder( sect, out type, out width, out space, out color)
int sect; // Section id to access. You can also set this parameter to
SECT_CUR to specify the current section.
Upon a successful return from this method, the TerGetOutInt and related methods
can be used to retrieve the temporarily saved values for these variables:
BRDRTYPE_NONE No Border
The following three parameters are not used when border type is
BRDRTYPE_NONE
type=TerGetOutInt("BorderType");
int width; // The variable to retrieve the line thickness in twips units.
Example:
type=TerGetOutInt("BorderWidth");
int space; // The variable to retrieve the border distance from the edge
of the page in twips units, Example:
type=TerGetOutInt("BorderSpace");
See Also
Page 165
TerSetSectBorder
Page 166
TerGetSectColWidth
Retrieve the column width or inter-column spacing for a variable width column
section.
int sect; // Section id to access. You can also set this parameter
to -1 to specify the current column.
boolean GetColWidth; // Set to TRUE to return the column width for the
specified column. Set to FALSE to return the space after
the specified column.
Return Value: This function returns the column width or the space after the column for the
specified column. The value is returned in twips unit. The function return -1 if an error
occurs.
Page 167
TerGetSectBins
boolean TerGetSectBins(sect)
int sect; // The section id to retrieve information. This parameter can assume a value
between 0 and 'TotalSects-1'. It can also be set to SECT_CUR to specify the
current section.
Upon a successful return from this method, the TerGetOutMediaTray method can be used to retrieve the
temporarily saved values for these variables:
MediaTray FirstPageBin; // The variable to retrieve the first page bin. To retrieve this value after calling th
method:
FirstPageBin=tej.TerGetOutMediaTray("FirstPageBin")
MediaTray NextPageBin; // The variable to retrieve the next page bin. To retrieve this value after calling th
method:
NextPageBin=tej.TerGetOutMediaTray("NextPageBin")
See Also
TerGetSectInfo
TerSetSect
Page 168
TerGetSectInfo
boolean TerGetSectInfo()
Upon a successful return from this method, the TerGetOutInt and TerGetOutBool methods can
be used to retrieve the temporarily saved values for these variables:
int NumCols; // The variable to receive the number of columns for the section. To
retrieve this value after calling this method:
NumCols=tej.TerGetOutInt("NumCols")
int ColSpace; // The variable to receive the space between the columns in Twips. To
retrieve this value after calling this method:
ColSpace=tej.TerGetOutInt("ColSpace")
boolean NewPage; // This variable receives true if the section starts on a new page,
otherwise it receives a false. To retrieve this value after calling this
method:
NewPage=tej.TerGetOutBool("StartPage")
int FirstPageNo; // This variable receives 0 if this section uses continuous page
numbering, otherwise it receives the page number of the first page for
this section. To retrieve this value after calling this method:
FirstPageNo=tej.TerGetOutInt("FirstPageNo")
See Also:
TerSetSect
Page 169
TerGetSectParam
Return Value: The function returns the value for the requested parameter. It returns
FP_ERROR to indicate an error condition.
Page 170
TerGetPageOrient
Upon a successful return from this method, the TerGetOutInt method can be used
to retrieve the temporarily saved values for these variables:
int pWidth; // Variable to receive the page width (in twips) after
considering the orientation. To retrieve this value after
calling this method:
width=tej.TerGetOutInt("Width");
int pHeight; // Variable to receive the page height (in twips) after
considering the orientation. To retrieve this value after
calling this method:
height=tej.TerGetOutInt("Height");
int pHiddenX; // Variable to receive the printer hidden area (in twips) in
the x direction. To retrieve this value after calling this
method:
HiddenX=tej.TerGetOutInt("HiddenX");
int pHiddenY; // Variable to receive the printer hidden area (in twips) in
the y direction. To retrieve this value after calling this
method:
HiddenY=tej.TerGetOutInt("HiddenY");
Return Value: This function returns true if the page uses the portrait orientation.
Otherwise, it returns a false value.
Page 171
TerGetSeqSect
Description: This function translates the section id into the sequential section numbers.
Please note that the section id assigned to the text are not sequential. For example, in a
document containing 3 sections, it is not correct to assume id 0 for the first section, or id 1
for the subsequent section of the document. Most APIs involving section need you to
specify the section id. A section id can be retrieved using the GetTerFields or
TerGetPageSect functions. However, certain functions such as TerPosBodyText and
TerPosHdrFtr need the sequential section number for the section argument. For the
purpose of differentiation, this manual uses the term 'section id' or 'sequential section
number' as appropriate.
Return Value: The function returns the sequential section number when successful.
Otherwise it returns -1.
See Also:
TerPosBodyText
TerPosHdrFtr
TerGetPageSect
Page 172
TerSectBreak
boolean TerSectBreak(repaint)
Description: This function is used to place the following text on the new section. The
section break is created before the current line. If you have enabled the editing of
header/footer text, please turn it off before calling this function. Please note that a secion
break can not be created inside an object such as table, frame, text box, etc.
See Also:
TerPageBreak
TerColBreak
Page 173
TerSetMargin
boolean TerSetMargin(left,right,top,bottom,repaint)
boolean TerSetMarginEx(sect,left,right,top,bottom,header,footer,repaint)
int left; // The left margin value in twip units. Set to -1 to leave this
parameter unchanged.
int right; // The right margin value in twip units. Set to -1 to leave
this parameter unchanged.
int top; // The top margin value in twip units. Set to -1 to leave this
parameter unchanged.
int bottom; // The bottom margin value in twip units. Set to -1 to leave
this parameter unchanged.
int header; // The distance of the header text from the top of the page.
Set to -1 to leave this parameter unchanged.
int footer; // The distance of the footer text from the bottom of the
page. Set to -1 to leave this parameter unchanged.
boolean repaint; // set to true to repaint the screen after this operation
See Also:
TerGetMarginEx
Page 174
TerSetPaper
Page 175
TerSetSect
int FirstPageNo; // Page number for the first page of the current section.
Set to 0 to use default page numbering.
int FirstPageBin; / Bin selection to print the first page of this section. Set to
MediaTray enumeration.
boolean IsPortrait; // Set to true to use the portrait orientation. set to false to
apply landscape orientation.
Example:
tej.TerSetSect(2,720,true);
The above statement sets the current section to use 2 column layout.
MediaTray.MAIN,
MediaTray.MAIN,
Page 176
0,0,
false);
The above statement modifies section id 0. It applies the landscape orientation. The paper
bin application is disabled by setting the SetBins to false.
See Also:
TerSetSectOrient
TerGetSectInfo
Page 177
TerSetSectAlign
int sect; // Section id to apply changes. You can also set this
parameter to SECT_CUR to edit the current section, or
set it to SECT_ALL to apply changes to all sections in
the document.
int align; // The 'align' parameter can be set to one of the following
constants:
Page 178
TerSetSectBorder
int sect; // Section id to apply changes. You can also set this
parameter to SECT_CUR to edit the current section, or set
it to SECT_ALL to apply changes to all sections in the
document.
BRDRTYPE_NONE No Border
int space; // Border distance from the edge of the page in twips units
See Also:
TerSetSect
TerSetSectBorder
Page 179
TerSetSectColWidth
Set the column width and inter-column spacing for a variable width column
section.
int sect; // Section id to apply changes. You can also set this
parameter to -1 to specify the current column.
int width; // The new width (int twips) for the specified column.
int ColSpace; // The new inter-column space (in twips) after the
specified column.
Page 180
TerSetSectLineNbr
int sect; // Section id to apply changes. You can also set this
parameter to SECT_CUR to edit the current section, or
set it to SECT_ALL to apply changes to all sections in
the document.
Comment: The line numbers are displayed on the left side of the page. The page-layout
(ID_SHOW_PAGE_LAYOUT) display must be turned on to see line numbering.
Page 181
TerSetSectOrient
Description: This function is used to set the page orientation for the section..
See Also:
TerSetSect
Page 182
TerSetSectPageSize
int sect; // Section id to apply changes. You can also set this
parameter to SECT_CUR to edit the current section, or
set it to SECT_ALL to apply changes to all sections in
the document.
See Also:
TerSetSect
Page 183
TerSetSectParam
int select; // Section id to apply changes. You can also set this
parameter to SECT_CUR to edit the current section, or set
it to SECT_ALL to apply changes to all sections in the
document.
SP_HDR_MARG Get the distance of the header text from the top of the
page in twips.
SP_FTR_MARG Get the distance of the footer text from the bottom of
the page in twips.
int val; New value for the parameter specified by the 'type'
parameter.
Page 184
TerSetSectTextFlow
int sect; // Section id to apply changes. You can also set this
parameter to SECT_CUR to edit the current section, or
set it to SECT_ALL to apply changes to all sections in
the document.
int TextFlow; // The text flow constant can be one of the following
See Also:
TerSetDocTextFlow
TerSetParaTextFlow
TerSetRowTextFlow
Page 185
Document
In This Chapter
GetTerFields
SetTerFields
TerGetParam
TerGetRtfDocInfo
TerGetWordCount
TerInsertDateTime
TerInsertToc
TerInsertToc2
TerLoadExtFont
TerSetDefDir
TerSetDocTextFlow
TerSetRtfDocInfo
Page 186
GetTerFields
TejTerField GetTerFields()
Description: This function returns various operational parameters for the current TEJ
window.
class TejTerField {
The following fields are read/write fields. To update a field you must retrieve the current
values by calling the GetTerFields function. Modify the fields that you wish to, and then
call the SetTerFields function to make the new value effective.
int CurCol Current window column position (0 to one less than the
length of the line).
int PaintEnabled A false value disables the screen painting and word
wrapping until it is re-enabled using another call to the
SetTerFields function
int BeginLine First line number in the window. The editor ensures that
CurRow is always equal to CurLine minus BeginLine (this
field is not meaningful in Page mode or Fittend View
modes).
int CurLine Current line number in the file (0 to one less than the total
number of lines in the file).
Page 187
int HilightBegCol Beginning column number of the highlighted block
boolean StretchHilight A true value allows the user to stretch the current
highlighted block by using the mouse or arrow keys.
Please do not use the following two fields as they are being phased out. Use the
TerGetLine function to retrieve the text and font ids for a line number.
ushort[] font Font id for every character in the 'text' array. Use the
'GetFontInfo' function to get further information about an
editor font id.
int TextApply Use this variable to specify how the 'text' and 'font' data
should be applied to the current TEJ window, see
APPLY_ constants in the TEJ.H file. Using this flag you
can modify the current line, or insert a new line after or
before the current line.
int LinkStyle The character style of the hyperlink phrase. When this
style is set to HLINK, then the following LinkColorW
variable is not used for detecting a link.
boolean SnapToGrid true to snap tabs and margin on the ruler to an invisible
grid
The following are the read only fields. TEJ will ignore any modification to these fields.
Page 188
IntPtr hTerWnd Handle to the editor window
Graphics TerGr Handle to TEJ class DC. Call the TerGetBufferDC function
if you wish to retrieve the handle of the associated buffer
device context.
int MouseLine Current text line position of the mouse pointer. Current
row position is given by MouseLine minus BeginLine.
int WinHeight Number of lines displayed in the window. This field is not
meaningful in Page mode or Fitted View modes.
int TerWinOrgX Window origin x co-ordinates used to set the view port
boolean modified Data modified, user needs to select the 'save' option to
save data
Page 189
int ParaSpaceBetween Minimum space between
int CurSect The section id of the current line. You can use the
TerGetSeqSect function to translate the section id into
the sequential section number.
See
Also
SetTer
Fields
GetFo
ntInfo
Page 190
SetTerFields
boolean SetTerFields(field)
Description: This function sets various operational parameters for the current TEJ window.
You must first call the GetTerFields function to retrieve the current values of the
parameters. You can then change the variables that you need to change. The TEJ editor
validates the information before applying them to the current window.
See Also:
TerGetField
TerSetCtlColor
Page 191
TerGetParam
Page 192
TP_MOUSE_PICT_ID Return the picture-id for the
picture where the mouse is
located. This value would be 0 if
if the mouse is not positioned
over a picture object.
Page 193
TP_TOTAL_FONTS Total number of font ids in the
document.
Return Value: This function returns the value of the requested parameter. It returns -1 to
indicate an error condition.
See
Also:
TerSet
Page 194
PictInfo
TerPas
tePictu
re
TerInse
rtPictur
eFile
TerPict
ureFro
mFile
TerGet
PictOff
set
Page 195
TerGetRtfDocInfo
INFO_SUBJECT Subject
INFO_AUTHOR Author
INFO_MANAGER Manager
INFO_COMPANY Company
INFO_OPERATOR Operator
INFO_CATEGORY Category
INFO_KEYWORDS Keywords
INFO_COMMENT Comment
Return Value: When successful, this function returns the length of the information text,
otherwise it returns 0. It also returns the information text using the 'text' argument.
See Also:
TerSetRtfDocInfo
Page 196
TerGetWordCount
int flags; // The flag can be one or more of the following bits:
Return Value: This function returns the number of words counted. It returns -1 to indicate
an error condition.
Page 197
TerInsertDateTime
String format; // Date time format (see description). Set this parameter to
null to display a date format selection dialog box.
Description: The format argument accepts a format string. A format String consists of day,
date, month, year, second, hour and delimiter components. Example:
Following is a list of various format components using an example date: June 8, 1999,
2:30:01 PM
Format
D day 8
M month 6
dd day, 0 padded 08
MM month, 0 padded 06
yy year, 2 digits 99
mm minutes 30
ss seconds 01
h 12 hour format 2
Page 198
hh 12 hour format, 0 padded 02
am/pm AM or PM am/pm
"HH:mm" 14:30
Delimiter: A delimiter may be used to separate the date components. The delimiter could
be '/', '-', comma, spaces or any character not used by the date components.
Page 199
TerInsertToc
Description: This function scans the document to build a table of contents at the current
cursor location. It includes a text line in the table of contents if it uses a paragraph style
and the name of the paragraph style is in the form of 'heading n', when 'n' is a number from
1 to 9. The heading number is used to specify the indentation level. This function uses
paragraph styles 'toc n' for the assembled heading lines. The top level heading (heading 1)
is assigned the style 'toc 1', and so on. The editor would automatically create any missing
'toc' style.
To insert a table of contents, first create the heading styles using the TerEditStyle function.
For example, if you wish to insert a three level deep table of contents, create heading
styles 'heading 1', 'heading 2', and 'heading 3'. Then place the cursor at the heading lines
and apply a suitable heading style using the TerSelectParaStyle function. The last step
would be to position the cursor where you wish to insert the table of contents and call the
TerInsertToc function.
See Also:
TerEditStyle
TerSelectParaStyle
TerInsertPageRef
Page 200
TerInsertToc2
String styles; // The list of custom styles to use to construct the table of
contents. Each style name in this list must be delimited
using the comma delimiter.
Description: This function provides additional flexibility for creating the table-of-contents
than the simpler method called TerCreateTej.
Page 201
TerLoadExtFont
String FontFile // Path or name of the FontFIle containing the font data.
Comment: You can call this method more than once to load multiple fonts. The fonts
loaded by this method are effective only during the session.
Example:
TerLoadExtFont("Pirulen","pirulen.ttf",true);
Page 202
TerSetDefDir
String dir; // The default directory. Set to "" to use the program
directory.
Description: This function is used to set the initial directory and the file type display by the
File Open dialog.
See Also
TerSetLinkPictDir
Page 203
TerSetDocTextFlow
int TextFlow; // The text flow constant can be one of the following:
See Also:
TerSetParaTextFlow
TerSetSectTextFlow
TerSetRowTextFlow
Page 204
TerSetRtfDocInfo
Comment: Information text specified by this function is saved with the document, only if
the document is saved in the RTF format. This information is not saved in the native format
document.
Return Value: This function returns true when successful, otherwise it returns false.
See Also:
TerGetRtfDocInfo
Page 205
Text Selection
In This Chapter
DeselectTerText
SelectTerText
TerGetSelection
TerGetTextSel
TerLineSelected
TerNormalizeBlock
Page 206
DeselectTerText
See Also
SelectTerText
Page 207
SelectTerText
Description: This function is used to select a block of text. When the 'repaint' flag is set,
the selected block is shown with a highlight.
The FirstLine and FirstCol determine the beginning of the block. To specify the beginning
location in absolute terms (character position from the beginning of the file), set the
FirstCol to -1, and specify the absolute location using the FirstLine argument.
The LastLine and LastCol (exclusive) determine the end of the block. To specify the ending
location in absolute terms (character position from the beginning of the file), set the LastCol
to -1, and specify the absolute location using the LastLine argument.
Note that all characters starting from the beginning location until the last character before
the ending location are included in the block.
See Also:
DeselectTerText
TerGetSelection
Page 208
TerGetSelection
Upon a successful return from this method, the TerGetOutInt method can be used
to retrieve the temporarily saved values for these variables:
int FirstLine; // Beginning line number of the block. To retrieve this value
after calling this method:
FirstLine=tej.TerGetOutInt("BegLine")
FirstCol=tej.TerGetOutInt("BegCol")
int EndLine; // Last line number of the block. To retrieve this value after
calling this method:
EndLine=tej.TerGetOutInt("EndLine")
EndCol=tej.TerGetOutInt("EndCol")
Return Value: This function returns true if a text block is selected, otherwise it returns
false.
See Also:
DeselectTerText
SelectTerText
TerIsTableSelected
Page 209
TerGetTextSel
Retrieve the selected text.
String TerGetTextSel()
Return Value: This function returns the String containing the selected data as plain text
(excluding any hidden text).
See Also:
TerGetRtfSel
GetTerBuffer
SetTerBuffer
ReadTerFile
SaveTerFile
TerSearchReplace
Page 210
TerLineSelected
Return Value: This function returns true if a text block is highlighted in the control and the
given line is also highlighted. It also returns true if no text block is highlighted in the editor.
It returns false if a text block is highlighted but the given line is not.
Page 211
TerNormalizeBlock
Normalize selected text block.
boolean TerNormalizeBlock()
Description: This function is used to adjust the beginning and ending of a selected text
block, such that the beginning position is smaller than the ending position.
Page 212
Cursor and Text Position
In This Chapter
GetTerCursorPos
SetTerCursorPos
TerAbsToRowCol
TerEngageCaret
TerGetCaretPos
TerGetVisibleCol
TerPixToTextPos
TerPosLineAtTop
TerPosBodyText
TerRowColToAbs
TerScrToTwipsX
TerScrToTwipsY
TerSetCaretPos
TerTextPosToPix
Page 213
GetTerCursorPos
boolean GetTerCursorPos(CurCol)
int CurCol; // The integer variable where the current column number is
returned.
if (tej.GetTerCursorPos(CurCol) {
CurCol=tej.TerGetOutInt("Col");
int CurLine; // After a successful return from this method, you can
retrieve the the current-line value using:
if (tej.GetTerCursorPos(CurCol) {
CurLine=TerGetOutInt("Line");
Description: This function returns the current cursor position. The cursor position can be
retrieved as the absolute position or in terms of the line number and column number.To get
the absolute cursor position, set the CurCol variable to -1 before calling this function. The
absolute position (base 0) is returned in the CurLine variable.
if (tej.GetTerCursorPos(CurCol) {
CurLine=TerGetOutInt("Line");
To get the line (base 0) and column (base 0) position of the cursor, set the CurCol variable
to a value other than -1 before calling this function.
int CurCol=0;
int CurLine;
Page 214
GetTerCursorPos(CurCol); // The current line number is returned in the
CurLine variable, the current column is returned in
the CurCol variable.
if (tej.GetTerCursorPos(CurCol) {
CurLine=TerGetOutInt("Line");
CurCol=TerGetOutInt("Col");
See Also
SetTerCursorPos
Page 215
SetTerCursorPos
To specify the absolute cursor position, set the 'column' argument to -1, and specify the
absolute position using the 'line' argument.
See Also:
GetTerCursorPos
Page 216
TerAbsToRowCol
Convert the given character position to the row and column position
Upon a successful return from this method, the following information can be
retrieved by using TerGetOutInt method:
int row; // To retrieve this value after a successful return from this
method:
row=tej.TerGetOutInt("Line");
int col; // To retrieve this value after a successful return from this
method:
col=tej.TerGetOutInt("Col");
Description: This function converts the text position given in a number of characters from
the beginning of the file to the row and column position.
Return Value: The line and column numbers can retrieved as following:
Example:
tej.TerAbsToRowCol(abs)
row=tej.TerGetOutInt("Line");
col=tej.TerGetOutInt("Col");
See Also:
TerRowColToAbs
Page 217
TerEngageCaret
boolean AtCursorLoc; // Set to true to engage the caret at the current 'cursor'
location. Set to false to engage the caret at the current
'caret' location.
Description: The caret position indicates the text insertion point, whereas the cursor
position indicates a position within currently visible text on the screen. Normally, these
positions are the same. However, when the user clicks on the scrollbar, the caret can
become disengaged from the cursor position. The editor will reengage the caret
automatically when the user conducts any text editing operation. This function allows you
to engage the caret manually. This function does not have any effect if the caret is already
engaged.
Page 218
TerGetCaretPos
Get the current text insertion position.
int TerGetCaretPos()
Description: This function returns the current text insertion position or the caret position.
Please note that the editor differentiates between the text insertion position and the current
cursor position as returned by the GetTerCursorPos function. When the user scrolls the
text, the caret position (where the next text input will be inserted) remains the same.
However, the cursor position changes in such a way that the cursor position is always
maintained within the current visible text on the screen.
Return Value: This function returns the caret position. This value is returned as the
character position since the beginning of the file. You can use the TerRowColToAbs
function to convert this position in to line/column position. This function returns -1 if an error
occurs.
See Also:
GetTerCursorPos
SetTerCursorPos
TerRowColToAbs
TerSetCaretPos
Page 219
TerGetVisibleCol
int LineNo; // The text line number (zero based). Set this parameter to
-1 to specify the current line number.
int ColNo // The text column number. Set to -1 to specify the current
column number.
Description: This function calculates the visible column number (zero based) by ignoring
the character not visible on the screen. These characters might include the hidden text
when the hidden text is not displayed, field name when field name is not displayed, field
data when the field data is not displayed, etc.
Return Value: This function returns the visible column number. It returns -1 to indicate an
error condition.
Page 220
TerPixToTextPos
Upon a successful return from this method, the following information can be
retrieved by using TerGetOutInt method:
line=tej.TerGetOutInt("Line");
col=tej.TerGetOutInt("Col");
Example: The example below retrieves the text position at a pixel position x=100, y=100.
int line;
// line/column format.
line=tej.TerGetOutInt("Line");
Page 221
col=tej.TerGetOutInt("Col");
See Also:
TerTextPosToPix
Page 222
TerPosLineAtTop
boolean WinTop; // true to position the specified line at the top of the
window, false to position the line at the middle of the
window.
Page 223
TerPosBodyText
Position the cursor at the body text outside of header or footer text.
See Also:
TerPosHdrFtr
TerPosFrame
TerPosTable
TerGetSeqSect
Page 224
TerRowColToAbs
int row; // text line number. The text line number must be between
0 and TotalLines - 1.
int col; // text column position. The text column position must be
between 0 and line length minus 1.
Description: This function translates the text position given in line number and column
number to the character position from the beginning of the file.
Return Value: The function returns the text position from the beginning of the file.
See Also:
TerAbsToRowCol
Page 225
TerScrToTwipsX
Upon a successful return from this method, the following information can be
retrieved by using TerGetOutInt method:
int MargX; // The variable to receive the left margin relative position in
twips units. Upon a successful return from this method,
the MagX value can be retrieve as following:
MargX=tej.TerGetOutInt("TwipsX")
See Also:
TerScrToTwipsY
Page 226
TerScrToTwipsY
Upon a successful return from this method, the following information can be
retrieved by using TerGetOutInt method:
int PageY; // The variable to receive the position (twips) relative to the
top of the page. Upon a successful return from this
method, the MagX value can be retrieve as following:
PageY=tej.TerGetOutInt("TwipsY")
See Also:
TerScrToTwipsX
Page 227
TerSetCaretPos
Description: When the caret is engaged, this function simply calls the SetTerCursorPos
function to set the cursor position. When the caret is disengaged from the cursor, this
value updates an intejal variable. When the caret is eventually engaged, the cursor is
positioned at the new caret position.
See Also:
TerGetCaretPos
Page 228
TerTextPosToPix
int line; // The line number of the text to find position. Set this
parameter to -1 to retrieve the pixel position of the text at
the current caret location.
Upon a successful return from this method, the following information can be
retrieved by using TerGetOutInt method:
x=tej.TerGetOutInt("X")
y=tej.TerGetOutInt("Y")
Example: The example below retrieves the pixel position at the current cursor location
relative to the top of the text box.
int x,y,
x=tej.TerGetOutInt("X")
y=tej.TerGetOutInt("Y")
Page 229
}
See Also
TerPixToTextPos
Page 230
Table
In This Chapter
TerAdustHtmlTable
TerCellBorder
TerCellBorderColor
TerCellColor
TerCellShading
TerCellVertAlign
TerCellRotateText
TerCellWidth
TerCreateCellId
TerCreateTable
TerDeleteCells
TerDeleteCellText
TerGetCellBorderColor
TerGetCellBorderWidth
TerGetCellInfo
TerGetCellInfo2
TerGetCellParam
TerGetRowCellCount
TerGetRowInfo
TerGetTableId
TerGetTableLevel
TerGetTablePos
TerHtmlCellWidthFlag
TerInsertTableCol
TerInsertTableRow
TerIsTableSelected
TerMarkCells
TerPosAfterTable
TerPosTable
TerReformatTable
TerRowHeight
TerRowPosition
TerSelectCellText
TerSelectCol
TerSelectRow
TerSelectTable
TerSetCellInfo2
TerSetCellParam
TerSetHdrRow
TerSetRowKeep
TerSetRowTextFlow
TerSetTableColWidth
TerSetTableId
Page 231
TerAdustHtmlTable
Adjust the HTML table width.
boolean TerAdjustHtmlTable()
Description: This function is used in conjunction with HTML add-on product. When you
add/delete a column or change a column width, you can call this function to recalculate the
cell width. The cell width is calculated using the html table width specification, cell
contents, and the current editor window width.
Page 232
TerCellBorder
boolean outline; Set to True to draw the outline around the selected cells.
Description: The cursor must be positioned in a table cell before calling this function.
The maximum border width should be less than the cell text margin. Any width
parameter can be set to -1 to leave the current value unchanged.
See Also:
TerPosTable
TerSetTableColWidth
TerInsertTableRow
TerCellShading
TerCellBorderColor
Page 233
TerCellBorderColor
Color top; // Color for the top border. Set the this parameter to
CLR_ERROR to leave it unchanged.
Color bot; // Color for the bottom border. Set the this parameter to
CLR_ERROR to leave it unchanged.
Color leftr; // Color for the left border. Set the this parameter to
CLR_ERROR to leave it unchanged.
Color right; // Color for the right border. Set the this parameter to
CLR_ERROR to leave it unchanged.
Description: The cursor must be positioned in a table cell before calling this function.
Page 234
See Also:
TerPosTable
TerSetTableColWidth
TerInsertTableRow
TerCellShading
TerCellBorder
Page 235
TerCellColor
Set the 'select' parameter to 0 to invoke the user selection dialog box.
Description: The cursor must be positioned in a table cell before calling this function.
See Also:
TerPosTable
TerCellBorder
TerCellShading
TerCellWidth
Page 236
TerCellShading
Set the 'select' parameter to 0 to invoke the user selection dialog box
Description: The cursor must be positioned in a table cell before calling this function.
See Also:
TerPosTable
TerCellBorder
TerCellColor
TerCellWidth
Page 237
TerCellVertAlign
Set the vertical alignment for the text inside a table cell.
Set the 'select' parameter to 0 to invoke the user selection dialog box.
Description: The cursor must be positioned in a table cell before calling this function.
See Also:
TerPosTable
TerCellBorder
TerCellColor
Page 238
TerCellRotateText
Set the 'select' parameter to 0 to invoke the user selection dialog box.
Description: The cursor must be positioned in a table cell before calling this function.
Page 239
TerCellWidth
Set the 'select' parameter to 0 to invoke the user selection dialog box.
int width; // Cell width in twips unit. Set to -1 to leave this value
unchanged.
int margin; // Cell Margin in twips unit. Set to -1 to leave this value
unchanged.
Description: The cursor must be positioned in a table cell before calling this function.
See Also:
TerPosTable
TerCellBorder
TerCellColor
Page 240
TerCreateCellId
boolean NewRow; // Set to true when creating the first cell of a new row.
int PrevCell; // Set this value to 0 when creating the first cell id for first
row of the table. Otherwise set it to the cell id of the
previous cell in the table.
int flags; // CFLAG_ constants defined in the tej.h file (set to 0 for
default).
Description: This function is used to create a new cell id. This function is useful for
creating tables very efficiently.
int PrevCell,CellId;
boolean NewRow;
String str;
PrevCell=CellId=0;
Page 241
for (int row=0;row<3;row++) {
if (col==0) NewRow=true;
else NewRow=false;
CellId=tej.TerCreateCellId(NewRow,PrevCell,0,0,0,
2000,0,0,0,0,0,1,1,0);
tej.TerAppendTextEx(str,-1,-1,CellId,-1,false);
PrevCell=CellId;
tej.TerAppendTextEx(str,-1,-1,CellId,-1,false);
Return Value: When successful, this function returns the id of the new cell. Otherwise it
returns 0
See Also:
TerCreateParaId
TerAppendTextEx
TerSetCellInfo2
Page 242
TerCreateTable
boolean AutoWidth; // Set to TRUE to let the table cell automatically expand
as the user types text into a table cell. This parameter is
applicable to only the TerCreateTable2 method.
Description: This function is used to create a text table. The number of rows and columns
are specified by the 'row' and 'col' arguments. Specify a -1 value for the 'row' if you wish to
activate a user dialog for the row and column selection.
The table is inserted after the current line. After this operation the cursor is placed in the
first cell of the table.
Please note that the PageMode must be turned on at the design-time for this function to
work properly. If the PageMode is not turned on, the tables are displayed as a series of
dashed lines.
Page 243
TerDeleteCells
int select; // This flag can be set to one of the following values:
See Also
TerDeleteCellText
Page 244
TerDeleteCellText
int select; // This flag can be set to one of the following values:
Comment: This function deletes the contents of the table cell, but the table structure is
not affected.
See Also
TerDeleteBlock
TerDeleteCells
Page 245
TerGetCellBorderColor
int CellId; // Cell id to retrieve the information for. Set to -1 to select the
current table cell.
Upon a successful return from this method, the following information can be retrieved by
using TerGetOutColor method:
Upon a successful return from this method, the color value can
be retrieve as following:
LeftColor=tej.TerGetOutColor("LeftColor")
Upon a successful return from this method, the color value can
be retrieve as following:
RightColor=tej.TerGetOutColor("RightColor")
Upon a successful return from this method, the color value can
be retrieve as following:
TopColor=tej.TerGetOutColor("TopColor")
Upon a successful return from this method, the color value can
be retrieve as following:
BottomColor=tej.TerGetOutColor("BotColor")
See Also:
TerGetCellInfo
Page 246
TerGetCellBorderWidth
int TerGetCellBorderWidth( CellId, out pLeft, out pRight, out pTop, out pBottom);
int CellId; // Cell id to retrieve the information for. Set to -1 to select the
current table cell.
Upon a successful return from this method, the following information can be retrieved by
using TerGetOutInt method:
Upon a successful return from this method, the color value can
be retrieve as following:
LeftWidth=tej.TerGetOutInt("LeftWidth")
Upon a successful return from this method, the color value can
be retrieve as following:
RightWidth=tej.TerGetOutInt("RightWidth")
Upon a successful return from this method, the color value can
be retrieve as following:
TopWidth=tej.TerGetOutInt("TopWidth")
Upon a successful return from this method, the color value can
be retrieve as following:
BotWidth=tej.TerGetOutInt("BotWidth")
See Also:
TerGetCellInfo
Page 247
TerGetCellInfo
int TerGetCellInfo(CellId);
Upon a successful return from this method, the following information can be
retrieved by using TerGetOutInt method:
RowId=tej.TerGetOutInt("RowId")
PrevCell=tej.TerGetOutInt("PrevCell")
NextCell=tej.TerGetOutInt("NextCell")
width=tej.TerGetOutInt("CellWidth")
border=tej.TerGetOutInt("CellBorder")
shading=tej.TerGetOutInt("CellShading")
Page 248
Upon a successful return from this method, the cell-width
value can be retrieve as following:
RowSpan=tej.TerGetOutInt("RowSpan")
ColSpan=tej.TerGetOutInt("ColSpan")
flags=tej.TerGetOutInt("CellFlags")
See Also:
TerGetCellBorderWidth
TerGetRowCellCount
Page 249
TerGetCellInfo2
Upon a successful return from this method, the following information can be
retrieved by using TerGetOutInt and TerGetOutColor methods:
BackColor=tej.TerGetOutColor("CellBackColor")
margin=tej.TerGetOutInt("CellMargin")
Page 250
TerGetCellParam
TEXT_HORZ: Horizontal
int id; // Cell id to retrieve parameters. Set to -1 to use the cell id of the current
line.
Page 251
Return Value: If successful, the TerGetCellParam method returns the value of the
requested parameter. A return value of CP_ERROR indicates an error.
Page 252
TerGetRowCellCount
boolean GetRowCount; // Set to true to return the number of rows in the current
table. Set to false to get the number of cells in the current
row.
Return Value: The return value is as described above. A value of 0 indicates an error.
See Also
TerGetCellInfo
Page 253
TerGetRowInfo
Upon a successful return from this method, the following information can be retrieved by
using TerGetOutInt method:
height=tej.TerGetOutInt("RowHeight")
int MinHeight; // The minimum height specification for the row. This value is a
negative number to indicate exact row height in twips, or a
positive number to indicate the minimum row height in twips, or
zero to indicate auto row height.
MinHeight=tej.TerGetOutInt("RowMinHeight")
int FixWidth; // The width specification for the table. This value is negative
number to indicate the row with as percentage of the current
screen width. A positive value indicates the row width in twips.
FixWidth=tej.TerGetOutInt("FixWidth")
height=tej.TerGetOutInt("RowHeight")
Upon a successful return from this method, the row-id value can
be retrieve as following:
height=tej.TerGetOutInt("RowHeight")
Page 254
can be retrieve as following:
indent=tej.TerGetOutInt("RowIndent")
int flags; // The row flags. The row flags (ROWFLAG_?) constants are
defined in the tej.h file.
Upon a successful return from this method, the flag value can be
retrieve as following:
flags=tej.TerGetOutInt("RowFlags")
int border; // The table border specification. This parameter is reserved for
future.
Upon a successful return from this method, the border value can
be retrieve as following:
border=tej.TerGetOutInt("RowBorder")
CurWidth=tej.TerGetOutInt("RowCurWidth")
See Also:
TerRowHeight
Page 255
TerGetTableId
int row; // A table row id within a table for which to retrieve the
table id. You can set this parameter to -1 to indicate the
current table
Return Value: This function returns 0 or a positive value for the table id. A value of -1
indicates an error.
See Also:
TerSetTableId
Page 256
TerGetTableLevel
int LineNo; // The line number to get the table level. Set to a negative
value to specify a cell id instead of a line number.
Return Value: This function returns 0 or a positive value to indicate the table level number.
It returns 0 if the line (or cell id) is at outer most table or if the line does not beint to a table.
Page 257
TerGetTablePos
int ParentCell; // The parent cell id to locate a nested table. Set to 0 for default.
Upon a successful return from this method, the following information can be retrieved by
using TerGetOutInt method:
int TableNo; // The current table number. The tables are assigned a
sequential number starting with 0 from the beginning of the
document.
Upon a successful return from this method, the table number can
be retrieve as following:
TableNo=tej.TerGetOutInt("TableNo")
int RowNo; // The current table row number. The table rows are assigned a
sequential number starting with 0 from the beginning of the
current table.
Upon a successful return from this method, the row number can
be retrieve as following:
RowNo=tej.TerGetOutInt("RowNo")
int ColNo; // The current table column number. The table columns are
assigned a sequential number starting with 0 from the beginning
of the current table row.
ColNo=tej.TerGetOutInt("ColNo")
Return Value: This function returns true when successful. It returns a false value if the cursor is
not positioned inside a table.
See Also:
TerPosTable
Page 258
TerHtmlCellWidthFlag
Set the cell width flag when using the HTML add-on.
Set the 'select' parameter to 0 to invoke the user selection dialog box.
0: Best Fit
Description: The cursor must be positioned in a table cell before calling this function.
Page 259
TerInsertTableCol
boolean insert; // true to insert a table column before the current column,
or false to append a column to the table.
Description: The cursor must be positioned in a table cell before calling this function.
See Also:
TerPosTable
TerSetTableColWidth
TerInsertTableRow
TerCellBorder
TerCellShading
Page 260
TerInsertTableRow
boolean insert; // true to insert a table row before the current row, or false
to append a row to the table.
Description: The cursor must be positioned in a table cell before calling this function.
See Also:
TerPosTable
TerSetTableColWidth
TerInsertTableCol
TerCellBorder
TerCellShading
Page 261
TerIsTableSelected
Check if any table row or cell is selected.
boolean TerIsTableSelected()
Return Value: This function returns a true value if a table row or cell is selected.
See Also
TerGetSelection
Page 262
TerMarkCells
Description: This function can be called after selecting the table cells to set the cell
selection flags (CFLAG_SEL1 and CFLAG_SEL2). You can then use the TerGetCellInfo
function to retrieve the cell flags and then test against the CFLAG_SEL1 and
CFLAG_SEL2 constants to check if the cell is selected:
selected.
Page 263
TerPosAfterTable
boolean OuterMost; // Set to true to position after the outer-most table, or set
to false to position after the current nested table. Set to
true for default.
Description: This function is available in the Page Mode only. This function places the
cursor after the current table. The cursor must already be placed inside a table before
calling this function.
See Also:
TerPosHdrFtr
TerPosTable
TerPosBodyText
Page 264
TerPosTable
int TableNo; // The table number of the table to position on. The first
table in the document is considered the table number
zero. You can also set the TableNo to -1 to specify the
current table.
Int ParentCell; // Parent cell id for the nested tables. Set to 0 for default.
See Also:
TerPosHdrFtr
TerGetTablePos
TerPosAfterTable
TerGetTableId
Page 265
TerReformatTable
Recalculate the widths for the auto-width tables cells and repaginate the
document.
boolean TerReformatTable(repaint)
Page 266
TerRowHeight
boolean AllRows; // true to apply the given height to all the rows in the table.
false to apply the height to the current row or all the
highlighted rows.
See Also:
TerRowPosition
TerGetRowInfo
Page 267
TerRowPosition
CENTER: Centered
boolean AllRows; // true to apply the given position to all the rows in the
table. false to apply the position to the current row or the
all highlighted rows.
See Also:
TerRowHeight
Page 268
TerSelectCellText
See Also
TerSelectCol
TerSelectTable
Page 269
TerSelectCol
See Also:
TerSelectRow
TerSelectCellText
TerSelectTable
Page 270
TerSelectRow
See Also:
TerSelectCol
TerSelectTable
Page 271
TerSelectTable
int level; // Table level number. Set this value to -1 to specify the
current level. Set this value to 0 to specify the outmost
table.
See Also
TerSelectCellText
TerSelectRow
TerSelectCol
Page 272
TerSetCellInfo2
int margin; // The cell margin in twips. Set to -1 to leave this value
unchanged.
int ParentCell; // The parent cell id for this cell. Set to -1 to leave this
value unchanged.
See Also:
TerCreateCellId
Page 273
TerSetCellParam
int val; New value for the parameter specified by the 'type'
parameter.
Page 274
TerSetHdrRow
int CellId; // A cell id for a cell in the row. Set to 0 to assume the
current table row.
boolean set; // Set to true to turn the current table row (or selected
rows) into a header row. Set to false to remove this
attribute.
boolean repaint; // Set to true to repaint the screen after this operation
See Also:
TerSetRowKeep
Page 275
TerSetRowKeep
int CellId; // A cell id for a cell in the row. Set to 0 to assume the
current table row.
boolean set; // true to set this flag, or false to reset this flag.
boolean repaint; // Set to true to repaint the screen after this operation.
Description: The editor moves the entire table row to the next page when this flag is set for
the row and the page break occurs within the row.
_______________________________________________________________________
See Also:
TerSetHdrRow
Page 276
TerSetRowTextFlow
Set the right-to-left/left-to-right text flow option for the table row.
boolean AllRows; // Set totrue to apply the changes to all the rows in the
table. Set to false to apply the changes to the current row
or the selected rows
int TextFlow; // The text flow constant can be one of the following:
See Also:
TerSetDocTextFlow
TerSetSectTextFlow
Page 277
TerSetTableColWidth
Description: This function sets the width of the table column where the cursor is
positioned.
See Also:
TerPosTable
TerInsertTableCol
TerInsertTableRow
TerCellBorder
TerCellShading
Page 278
TerSetTableId
int row; // A table row id within a table for which to set the table id.
You can set this parameter to -1 to indicate the current
table.
int id; // The table id. Use a negative number to place the id on
the current table row instead of the entire table. A value of
0 assigns the default table id.
See Also:
TerGetTableId
Page 279
Hyperlink
In This Chapter
TerApplyHyperlink
TerDeleteHypertext
TerFindHlinkField
TerGetHypertextEx
TerInsertHyperlink
TerSetLinkDblClick
TerUpdateHyperlinkCode
TerUpdateHyperlinkText
Page 280
TerApplyHyperlink
Comment: Please note that the hyperlink cursor must be enabled using the
ID_SHOW_HYPERLINK_CURSOR to show the hyperlink cursor.
See Also:
TerInsertHyperlink
TerUpdateHyperlinkText
TerUpdateHyperlinkCod
e
TerFindHlinkField
Page 281
TerDeleteHypertext
Return Value: This function returns true if a hypertext phrase is found at the given
location and is deleted successfully.
Page 282
TerFindHlinkField
String CodePart1; // The part of the hyperlink code or url to search for
String CodePart2; // Another part of the hyperlink code or url to search for
line=tej.TerGetOutInt("Line");
Col=tej.TerGetOutInt("Col");
Return Value: This function returns true when a hyperlink is located. On successful
search, the line and column number of the located hyperlink can be retrieved as following:
if (tej.TerFindHlinkField("www.mysite.com","",0,0) {
line=tej.TerGetOutInt("Line");
column=tej.TerGetOutInt("Col");
see Also:
TerInsertHyperlink
TerUpdateHyperlinkCod
e
TerUpdateHyperlinkText
Page 283
TerGetHypertextEx
boolean TerGetHypertextEx(select)
int LineNo; // The line number to examine. Set to -1 to use the current
line and current column number. The TerGetHypertextEx
function automatically examines the current text position.
boolean select; // true to select (highlight) the current hypertext code and
phrase.
Upon a successful return from this method, the following information can be
retrieved by using TerGetOutStr method:
text=tej.TerGetOutStr("Text");
code=tej.TerGetOutStr("FieldCode");
Return Value: This function returns true if hypertext is found at the current cursor
location.
Page 284
TerInsertHyperlink
Insert hyperlink.
The style and color for the hyperlink can be modified by changing the LinkStyle and
LinkColor variables using the GetTerFields/SetTerFields function before inserting the
hyperlink.
String code; // The url or other information for the hyperlink. This
information is not displayed on the screen.
int PictId; // The picture id for the hyperlink if this a picture link. Set
this parameter to 0 to insert text type hyperlink.
Comment: Please note that the hyperlink cursor must be enabled using the
ID_SHOW_HYPERLINK_CURSOR to show the hyperlink cursor.
Return Value: This function returns the font id or the picture id for the newly inserted
hyperlink. It returns -1 to indicate an error condition.
See Also:
TerApplyHyperlink
TerUpdateHyperlinkTex
t
TerUpdateHyperlinkCo
de
TerFindHlinkField
Page 285
TerSetLinkDblClick
boolean TerSetLinkDblClick(DblClick)
Return Value: This function returns the previous value of the DblClick variable.
Page 286
TerUpdateHyperlinkCode
String code; // New code or url information for the hyperlink. Set the
'code' parameter to "" to convert the hyperlink text to
normal text.
Description: This function is used to modify the hyperlink code or url for the hyperlink
under the cursor.
See Also
TerInsertHyperlink
TerUpdateHyperlinkText
TerFindHlinkField
Page 287
TerUpdateHyperlinkText
Description: This function is used to modify the hyperlink text for the hyperlink under the
cursor.
See Also
TerInsertHyperlink
TerUpdateHyperlinkCod
e
TerFindHlinkField
Page 288
Mail-merge
This chapter includes the mail-merge APIs. Please refer to the Mail Merge Support chapter
for additional information.
In This Chapter
TerChangeField
TerChangeFieldPicture
TerChangeFieldRtf
TerDeleteField
TerGetField
TerInsertField
TerLocateField
TerMergeFields
TerSelectField
Page 289
TerChangeField
Description: This function changes the data for all occurrence of the specified field name.
See Also:
TerInsertField
TerDeleteField
Page 290
TerChangeFieldPicture
Description: This function applies the picture to all occurrence of the specified field name.
Page 291
TerChangeFieldRtf
Description: This function changes the data for all occurrence of the specified field name.
Page 292
TerDeleteField
See Also:
TerInsertField
TerLocateField
TerChangeField
Page 293
TerGetField
int LineNo; // The line number to examine. Set to -1 to use the current
line and current column number.
Upon a successful return from this method, the following information can be
retrieved by using TerGetOutStr method:
String text; // sting to receive the text part for the field name or field
data.
text=tej.TerGetOutStr("Text");
Return Value: This function returns the length of the retrieved text.
See Also:
TerInsertField
TerLocateField
Page 294
TerInsertField
String data; // Field data. Set to null to insert a field without field data.
Description: This function inserts a field name and field data in the document. Please note
that a data field is different from a mail merge field. A field inserted using this function can
not be used for mail merge. Refer to 'Mail Merge Support' chapter for information about mail
merge fields.
See Also:
TerGetField
TerLocateField
TerChangeField
TerDeleteField
Page 295
TerLocateField
boolean exact: // Set to true to match the field names in the document
exactly to the field name given by the 'name' parameter.
Set to false to match only the length of the name
parameter. Consider a document containing two fields
'company1' and 'company2'. If the name parameter is set
to 'company' and the 'exact' parameter is set to false,
then both the fields will be matched.
To match any field name, set the 'name' argument to "" and the 'exact' argument to false.
boolean repaint: // Set to true to repaint the screen after this operation.
Please note that the repaint operation can change the cursor position to adjust
for any invisible text in the line. Therefore, the 'repaint' parameter should be set
to false if your application relies on the cursor position set by this function for
subsequent APIs.
Return Value: This function returns a true value when successful. When successful, it
positions the cursor on the field name.
See Also:
TerGetField
TerInsertField
TerChangeField
TerLocateFieldChar
Page 296
TerMergeFields
boolean TerMergeFields(names,data,repaint)
String names; // This argument points to a list of field names. The field
names must be separated by a '|' character. The list must
be null terminated.
String data; // This argument points to a list containing data strings for
the corresponding field names in the 'names' argument.
The data strings must be separated by a '|' character. The
list must be null terminated.
Description: This function is used to replace the field names in the current editing window
with the corresponding field data strings. Refer to the 'Mail/Merge Support' chapter on how
to denote field names during the editing session.
If the document uses a field name which is not contained in the field name table, the editor
sends a TER_MERGE message to the parent window. The 'lParam' parameter for this
message contains the variable to the field name string. If your application processes this
message, it should return the variable to the field data string.
See Also:
TerMergePrint
Page 297
TerSelectField
Page 298
Picture and Embedded Controls
In This Chapter
TerDeleteObject
TerGetControlId
TerGetImage
TerGetPictCropping
TerGetPictInfo
TerGetPictOffset
TerInsertControl
TerInsertObjectId
TerInsertPictureFile
TerPastePicture
TerPictAltInfo
TerPictLinkName
TerPictureFromFile
TerPictureFromWmf
TerSetBkPictId
TerSetLinkPictDir
TerSetPictCropping
TerSetPictFrame2
TerSetPictInfo
TerSetPictOffset
TerSetPictSize
TerSetPlaceHolderPict
TerXlateControl
TerSetWatermarkPict
TerShrinkPictureToPage
TerXlateControlId
Page 299
TerDeleteObject
See Also:
TerInsertPictureFile
Page 300
TerGetControlId
Return Value: This function returns the control id for the picture id. It returns -1 when
unsuccessful.
See Also:
TerInsertControl
TerXlateControlId
Page 301
TerGetImage
Image TerGetImage(pict)
Return Value: This function returns the requested Image object when successful. A null
value indicates an error condition.
Page 302
TerGetPictCropping
Return Value: This function returns the picture cropping value (in twips unit) for the
selected side of the picture. The function returns -1 to indicate an error condition.
See Also
TerSetPictCropping
Page 303
TerGetPictInfo
boolean TerGetPictInfo( pict, out style, out rect, out align, out aux)
Upon a successful return from this method, the following information can be
retrieved by using TerGetOutInt and TerGetOutRect methods:
style=tej.TerGetOutInt("Style");
Rectangle rect; // variable to receive the current screen location and size
(in device units) of the picture. The rectangle is relative to
the client area of the control.
rect=tej.TerGetOutRect("Rectangle");
align=tej.TerGetOutInt("Align");
aux=tej.TerGetOutInt("AuxId");
See Also:
TerSetPictInfo
TerPastePicture
TerInsertPictureFile
TerPictureFromFile
TerGetPictOffset
TerGetCurFont
TerGetFontParam
Page 304
Page 305
TerGetPictOffset
Return Value: This function returns picture offset when successful. A value of -1 indicates
an error condition.
See Also:
TerGetPictInfo
TerSetPictInfo
TerSetPictOffset
Page 306
TerInsertControl
int id; // control id. Specify a unique id with a value above 2000.
boolean insert; // true to insert the control into text. false to simply return
the object id without inserting the control into text.
Description: This function inserts a control of the specifiedclass into the current text
position.
When the 'insert' argument is true, the object is inserted at the current cursor location.
Return Value: This function returns a non-zero object id, if successful. Otherwise it
returns zero.
See Also:
TerInsertObjectId
TerGetPictInfo
TerSetPictInfo
TerGetControlId
Page 307
TerInsertObjectId
Description: This function inserts the specified object at the current cursor location.
Page 308
TerInsertPictureFile
boolean embed; // true to embed the picture in the document file, false to
create a link to the picture file.
boolean insert; // true to insert the picture into text. false to simply return
the picture id without inserting the picture into text.
Description: A file selection dialog box is displayed if the FileName argument is set to
null. The TerInsertPictureFile function inserts the picture at the current text position. The
Page 309
TerInsertPictureFileXY function inserts the picture at the pixel location given by the x,y
position. The x,y pixel location is relative to the top left corner of the client area of the
window. The TerInsertPictureFileXY2 method is used to insert a page or paragraph relative
picture.
Return Value: This function returns a non-zero picture id, if successful. Otherwise it
returns zero.
See Also:
TerPastePicture
TerPictureFromFile
TerPictureFromWmf
TerInsertObjectId
TerSetBkPictId
TerSetPictFrame2
TerShrinkPictureToPag
e
Page 310
TerPastePicture
Image image // Image to paste. Set this parameter to null to paste the
picture from the clipboard.
int ParaFrameId; // Id of the frame to insert the picture into. Set 0 for default.
boolean insert; // true to insert the picture into text. false to simply return
the picture id without inserting the picture into text.
Return Value: This function returns a non-zero picture id, if successful. Otherwise it
returns zero.
See Also:
TerInsertPictureFile
TerPictureFromFile
TerInsertObjectId
TerGetPictInfo
TerSetPictInfo
TerSetBkPictId
Page 311
TerPictAltInfo
boolean get; // true to retrieve the alternate string, false to set a new alternate
string.
String AltInfo; // The new alternate name String for the picture when the get
parameter is set to false.
if (tej.TerPictAltInfo(id,true,"")) {
String AltInfo=tej.TerGetOutStr("Info")
Comment: The alternate String is saved using the 'alt' tag when the file is saved in the HTML
format.
Page 312
TerPictLinkName
boolean get; // true to retrieve the file name, false to set a new name.
String FileName; // The new link file name for the picture if the 'get' parameter is set to
false.
If the 'get' parameter is set to 'true', the link file name can be retrieved
upon a successful return from this method as following:
if (tej.TerPictLinkName(id,true,"")) {
String FileName=tej.TerGetOutStr("Name")
Page 313
TerPictureFromFile
This function has been discontinued. Please use the TerInsertPictureFile function
instead.
See Also:
TerPastePicture
TerInsertPictureFile
TerInsertObjectId
TerSetBkPictId
Page 314
TerPictureFromWmf
This function has been discontinued. Please use the TerInsertPictureFile function instead.
See Also:
TerPastePicture
TerInsertPictureFile
TerInsertObjectId
TerSetBkPictId
Page 315
TerSetBkPictId
See Also:
TerPastePicture
TerInsertPictureFile
TerPictureFromFile
TerPictureFromWmf
TerSetWatermarkPict
Page 316
TerSetLinkPictDir
Set the default directory to read linked pictures from an RTF file.
boolean TerSetLinkPictDir(dir)
String dir; // The default directory. Set to "" to use the program
directory.
Description: This directory is used to located the linked pictures which do not contain full
path specification.
Page 317
TerSetPictCropping
See Also
TerGetPictCropping
Page 318
TerSetPictFrame2
int x; // The x location (in twips units) of the frame relative to the
left edge of the page. This value is used only when frame
type is set to PFRAME_FLOAT.
int y; // The y location (in twips units) of the frame relative to the
top edge of the page. This value is used only when frame
type is set to PFRAME_FLOAT.
Description: This function enclosed the give picture in a frame. The document text wraps
around the frame.
Return Value: This function returns the frame id of the picture frame when successful. It
returns a value of -1 to indicate an error condition.
See Also:
TerGetPictInfo
TerSetPictSize
TerPastePicture
TerInsertPictureFile
Page 319
TerSetPictInfo
See Also:
TerGetPictInfo
TerSetPictSize
TerPastePicture
TerInsertPictureFile
TerPictureFromFile
Page 320
TerSetPictOffset
Set the offset from the baseline to place the picture in the text.
int offset; // The offset (twips) for the picture. This value is used to
depress the bottom of the picture against the text
baseline.
See Also:
TerGetPictInfo
TerSetPictInfo
TerGetPictOffset
Page 321
TerSetPictSize
int width; // New picture width in the screen units. Use the negative
values to specify in twips units. Set to -1 to leave the
picture width unchanged.
int height; // New picture height in the screen units. Use the negative
values to specify in twips units. Set to -1 to leave the
picture height unchanged.
See Also:
TerGetPictInfo
TerSetPictInfo
Page 322
TerSetPlaceHolderPict
String path; // Name of the picture file, or path-name of the picture file
to insert when a linked picture is missing during the RTF
read process.
Page 323
TerXlateControl
Retrieve the picture id for an embedded component, or get the component object
for a picture id.
Return Value: This function returns the picture id for the embedded component object, or
returns the component object for the picture id. It returns -1 when component is not found,
or null when the picture id is not found.
Page 324
TerSetWatermarkPict
See Also
TerSetBkPictId
Page 325
TerShrinkPictureToPage
long line; // The document line number where the picture is located.
Set to -1 to specify the current line number.
See Also
TerInsertPictureFile
Page 326
TerXlateControlId
Return Value: This function returns the picture id for the component id. It returns -1 when
unsuccessful.
See Also
TerInsertControl
TerGetControlId
Page 327
Page Header/Footer
In This Chapter
TerCreateFirstHdrFtr
TerDeleteFirstHdrFtr
TerCreateLeftRightHdrFtr
TerDeleteHdrFtr
TerGetHdrFtrPos
TerHdrFtrExists
TerPosHdrFtr
Page 328
TerCreateFirstHdrFtr
boolean HdrFtr; // Set to true to create a first page header area. Set to
false to create a first page footer area.
See Also:
TerDeleteFirstHdrFtr
Page 329
TerDeleteFirstHdrFtr
boolean HdrFtr; // Set to true to delete a first page header area. Set to
false to delete a first page footer area.
See Also:
TerCreateFirstHdrFtr
Page 330
TerCreateLeftRightHdrFtr
Page 331
TerDeleteHdrFtr
char HdrFtr; // Use one of the following constants to specify the type of
the header/footer area to delete:
See Also:
TerCreateFirstHdrFtr
Page 332
TerGetHdrFtrPos
See Also
TerPosHdrFtr
TerHdrFtrExists
int TerGetHdrFtrPos(line)
long line; // The line number to find the position. Set to -1 to find the
location for the current line.
Return Value: This function returns the following values to indicate the line position:
Page 333
TerHdrFtrExists
See Also
TerGetHdrFtrPos
TerGetSeqSect
int TerHdrFtrExists(SectId)
Return Value: This function returns a flag value. The following constant bits in the flag
value indicate the existence of the headers and footers. You can use the 'And' operator to
check if a particular header or footer exists.
A zero return value indicates that no header or footer exists in the document.
Example:
int flag=tej.TerHdrFtrExists(tej.SECT_ALL);
found.
Page 334
TerPosHdrFtr
boolean TerPosHdrFtrEx(section,HdrFtr,pos,repaint)
int section; // section number for the header. Specify a number between
0 (first section) and total section -1.
char HdrFtr; // Use one of the following constants to specify the type of
the header/footer area to position at (used by the
TerPosHdrFtrEx function only):
Description: This function is available in the Page Mode only. The function toggles the
header/footer edit mode before positioning the cursor.
Please note that this function automatically turns on the editing of header/footers, if not
already enabled.
Page 335
See Also:
TerPosTable
TerGetSeqSect
TerGetHdrFtrPos
Page 336
Frame and Drawing Objects
In This Chapter
TerConnectTextBoxes
TerCreateParaFrameId
TerGetDrawObjectInfo
TerGetFrameParam
TerGetFrameSize
TerInsertDrawObject
TerInsertLineObject
TerInsertParaFrame
TerMoveParaFrame
TerMovePictFrame
TerPosFrame
TerRotateFrameText
TerSelectFrameText
TerSetFrameMarginDist
TerSetFrameTextDist
TerSetNewFrameDim
TerSetObjectAttrib
TerSetObjectWrapStyle
TerSetFrameYBase
Page 337
TerConnectTextBoxes
int FromFID; // Source frame id. Specify a number between 1 and total
frames -1.
int ToFID; // Target frame id. Specify a number between 1 and total
frames -1.
Comment: This method is used to link two text boxes. The text overflow from the first text
box is displayed in the target text-box. You can use this method to construct a linked list
of two or more than two text boxes.
Page 338
See Also:
TerMoveParaFrame
TerPosFrame
TerSetNewFrameDim
TerInsertParaFrame
TerCreateParaFrameId
int width; // Initial width of the frame rectangle in the Twips unit.
Specify -1 to use the default value.
int height; // Initial height of the frame rectangle in the Twips unit.
Specify -1 to use the default value.
Return Value: When successful this function returns the paragraph frame id of the new
paragraph frame. Otherwise it return 0.
Page 339
TerGetDrawObjectInfo
Upon a successful return from this method, the following information can be retrieved by
using TerGetOutInt or TerGetOutColor methods:
int width; // The width (twips) of the text box or the rectangle object.
width=tej.TerGetOutInt("Width")
int height; // The height (twips) of the text box or the rectangle object.
Height=tej.TerGetOutInt("Height")
Upon a successful return from this method, the line width can be
retrieve as following:
LineWidth=tej.TerGetOutInt("LineWidth")
Upon a successful return from this method, the line color value
can be retrieve as following:
LineColor=tej.TerGetOutColor("LineColor")
Color FillColor; // The fill color for the text box or the rectangle object.
Upon a successful return from this method, the fill-color value can
be retrieve as following:
FillColor=tej.TerGetOutColor("BackColor")
Page 340
PARA_FRAME_BOXED: The text box or the rectangle object is boxed.
Upon a successful return from this method, the row-id flag can be
retrieve as following:
flags=tej.TerGetOutInt("flags")
See Also:
TerInsertDrawObject
Page 341
TerGetFrameParam
Return Value: The function returns the value for the requested parameter. It returns
FP_ERROR to indicate an error condition.
Page 342
TerGetFrameSize
Upon a successful return from this method, the following information can be
retrieved by using TerGetOutInt method:
x=tej.TerGetOutInt("X")
y=tej.TerGetOutInt("Y")
width=tej.TerGetOutInt("Width")
height=tej.TerGetOutInt("Height")
See Also:
TerMoveParaFrame
Page 343
TerInsertDrawObject
DOB_RECT: A rectangle
int width; // Initial width of the frame rectangle in the Twips unit.
Specify -1 to use the default value.
int height; // Initial height of the frame rectangle in the Twips unit.
Specify -1 to use the default value.
Return Value: When successful this function returns the paragraph frame id of the new
object. Otherwise it returns 0.
See Also:
TerSetObjectAttrib
TerSetFrameYBase
TerPosFrame
TerSetNewFrameDim
TerInsertLineObject
TerGetDrawObjectInfo
Page 344
TerInsertLineObject
Comments: The point positions are specified in the twips units. The x locations are relative
to the left margin of the page. The Y positions are relative to the beginning of the current
paragraph.
Return Value: When successful this function returns the paragraph frame id of the new
line object. Otherwise it returns 0.
Page 345
TerInsertParaFrame
int width; // Initial width of the frame rectangle in the Twips unit.
Specify -1 to use the default value.
int height; // Initial height of the frame rectangle in the Twips unit.
Specify -1 to use the default value.
Description: This function creates an empty paragraph frame and positions the cursor
inside the frame.
Return Value: When successful this function returns the paragraph frame id of the new
paragraph frame. Otherwise it returns 0.
See Also:
TerMoveParaFrame
TerPosFrame
TerSetNewFrameDim
TerCreateParaFrameId
TerSetFrameMarginDist
Page 346
TerMoveParaFrame
int width; // New width of the frame rectangle in the Twips unit.
Specify -1 to use the current value.
int height; // New height of the frame rectangle in the Twips unit.
Specify -1 to use the current value.
See Also:
TerInsertParaFrame
TerInsertDrawObject
TerGetFrameSize
TerMovePictFrame
Page 347
TerMovePictFrame
boolean TerMovePictFrame(PictId, x, y)
See Also
TerSetPictSize
Page 348
TerPosFrame
See Also:
TerPosBodyText
TerInsertParaFrame
TerInsertDrawObject
Page 349
TerRotateFrameText
int LineNo; // The line number within a frame. You can also specify
the frame id by specifying a negative value.
int direction: // Text flow direction. Choose one of the following values:
boolean repaint; // Set to true to repaint the screen after this operation.
Return Value: The function returns true when successful. Otherwise, it returns a false
value.
See Also:
TerSetObjectAttrib
TerGetFrameParam
TerSelectFrameText
Page 350
TerSelectFrameText
Page 351
TerSetFrameMarginDist
boolean TerSetFrameMarginDist(dist)
int dist; // The frame margin distance in twips unit (default 1440
twips)
Description: The dist argument controls the minimum distance between a frame and the
left or right margin at which the text starts flowing around the frame.
See Also:
TerInsertParaFrame
Page 352
TerSetFrameTextDist
int dist; // The frame text distance in twips unit (default 180 twips)
Description: The dist argument controls the minimum distance between a frame and the
text flowing around the frame.
Page 353
TerSetNewFrameDim
boolean TerSetNewFrameDim(x,y,width,height,PageTop)
int x; // The default x location for the new frame. Set this
parameter to -1 to insert the new frame at the current
cursor location.
int y; // The default y location for the new frame. Set this
parameter to -1 to insert the new frame at the current
cursor location.
int width; // The default width for the new frame. Set this parameter
to 0 to leave it unchanged.
int height; // The default height for the new frame. Set this parameter
to 0 to leave it unchnaged.
boolean PageTop; // Set to true to create the frames relative to the top of the
page.
Description: The values passed by this function are used by any subsequent calls to the
TerInsertParaFrame and TerInsertDrawObject functions as default values.
See Also:
TerInsertParaFrame
TerInsertDrawObject
Page 354
TerSetObjectAttrib
int ObjectId; // id of the drawing object. Set to -1, to display the user
selection dialog box. This dialog box is displayed only if
the cursor is positioned on a drawing object.
DOB_LINE_NONE: No border
boolean FillSolid; // true to fill the background, false to leave the text box
transparent. This option is available for a text box type
drawing object only.
int ZOrder; // Z Order for the object. Set to -9999 to leave this value
unchanged.
See Also:
TerInsertDrawObject
TerSetFrameYBase
TerRotateFrameText
TerSetObjectWrapStyle
Page 355
TerSetObjectWrapStyle
int ObjectId; // id of the drawing object. Set to -1, to specify the object
at the current cursor position.
See Also
TerSetObjectAttrib
Page 356
TerSetFrameYBase
This function sets the vertical base position for a frame or a drawing object.
See Also:
TerInsertDrawObject
TerSetObjectAttrib
Page 357
Footnote, Endnote, Bookmark, Tag
In This Chapter
TerDeleteBookmark
TerGetBookmark
TerDeleteTag
TerGetTag
TerGetTagPos
TerInsertBookmark
TerInsertFootnote
TerPosTag
TerPosBookmark
TerSetTag
Page 358
TerDeleteBookmark
Delete a bookmark.
See Also:
TerInsertBookmark
TerPosBookmark
Page 359
TerGetBookmark
Upon a successful return from this method, the following information can be
retrieved by using TerGetOutStr method:
name=tej.TerGetOutStr("Name")
Return Value: This function returns the total number of bookmarks in the
document.
See Also:
TerInsertBookmark
TerPosBookmark
TerDeleteBookmark
Page 360
TerDeleteTag
long line; // The line position of the text. Set to -1 to use the current
cursor position.
Return Value: This function deletes the specified tag and return the tag id of the deleted
tag. It returns 0 if no tag is found at the location, or if an error is encountered.
Page 361
TerGetTag
int line; // The line position of the text. Set to -1 to use the current
cursor position.
int col; // The column position of the text. This parameter is ignored
if the 'line' parameter is set to -1.
Upon a successful return from this method, the following information can be
retrieved by using TerGetOutInt and related methods:
name=tej.TerGetOutStr("Name")
String AuxText; // The auxiliary text String associated with the tag.
AuxText=tej.TerGetOutInt("AuxText")
int AuxInt; // The auxiliary numeric data associated with the tag.
RowId=tej.TerGetOutInt("RowId")
obj=tej.TerGetOutObject("Object")
Return Value: This function returns the unique tag id at the specified location. It returns 0
if no tag is found at the location, or if an error is encountered.
Page 362
See Also:
TerPosTag
TerSetTag
Page 363
TerGetTagPos
String name; // The tag name to search for. Please note that tag
names are not unique within a document.
line=tej.TerGetOutInt("Line")
col=tej.TerGetOutInt("Col")
Return Value: The TerGetTagPos method searches the given tag to return the absolute
character position of the tag. The function returns -1 if the tag is not found in the document.
The TerGetTagPos2 method searches the given tag to return the line/column position of the
tag. The function returns a false value if the tag is not found in the document.
Page 364
TerInsertBookmark
Insert a bookmark.
int line; // The text line number where to insert the bookmark. Set
to -1 to insert the bookmark at the current cursor location.
int col; // The text column position to insert the bookmark. This
argument is ignored if the 'line' argument is set to -1.
Return Value: This function returns a non-zero bookmark id, if successful. Otherwise it
returns zero.
Page 365
TerInsertFootnote
Insert a footnote.
int style; // footnote marker style. The style can be any combination
of BOLD, ULINE, ITALIC, and SUPSCR. Typically, the
style is set to SUPSCR.
Description: This function inserts a footnote at the current cursor location. The cursor is
positioned after the footnote text upon the completion of this operation.
Page 366
TerPosTag
int TagId; // The tag id to search for. This parameter is ignored if the
'name' parameter is specified.
String name; // The tag name to search for. Please note that tag
names are not unique within a document.
See Also:
TerSetTab
TerGetTag
Page 367
TerPosBookmark
Position at a bookmark.
boolean repaint; // Set to true to refresh the screen after this operation
See Also:
TerInsertBookmark
TerGetBookmark
TerDeleteBookmark
Page 368
TerSetTag
int line; // The line position of the text. Set to -1 to use the current
cursor position.
String name; // The tag name string. A tag name does not need to be
unique within the document.
String AuxText; // Any auxiliary text String associated with the tag.
int AuxInt; // Any auxiliary numeric data associated with the tag
Description: Use this function to set a tag at the specified character position. If a tag
already exists at the current text position, then the existing tag is updated with the new
information.
Return Value: This function returns the unique tag id if successful. Otherwise it returns 0.
See Also:
TerPosTag
TerGetTag
Page 369
Stylesheet
In This Chapter
TerCancelEditStyle
TerDeleteStyle
TerEditStyle
TerGetStyleId
TerGetStyleInfo
TerGetStyleParam
TerSetStyleParam
Page 370
TerCancelEditStyle
Cancel the editing of the current style and restore its original value.
boolean TerCancelEditStyle()
See Also
TerEditStyle
Page 371
TerDeleteStyle
int StyleId; // Style id to delete. Please note that the default style ids
0 and 1 can not be deleted. Set this parameter to -1 to
specify the name of the style item to delete.
See Also:
TerEditStyle
Page 372
TerEditStyle
Description: This function is used to create a new stylesheet item or to modify an existing
stylesheet item. The name and the type of the stylesheet item are specified by the 'name'
and the 'type' arguments. Call this function with the 'BeginRecording' argument set to true
to begin recording the properties for a stylesheet item. To apply the paragraph and
character formatting properties to a stylesheet being recorded, use the menu, toolbar, ruler
or any of the APIs (example: SetTerParaFmt) which modifies these properties. While a
character stylesheet item is being recorded, only the character properties should be edited.
When a paragraph stylesheet item is being recorded, both the character and the paragraph
attributes can be edited.
To end the property recording of the current stylesheet item, call this function again with
the 'BeginRecording' argument set to false.
Return Value: This function returns the new style id if successful. Otherwise, it returns -1.
See Also:
TerSelectCharStyle
TerSelectParaStyle
TerGetFontStyleId
TerDeleteStyle
TerGetParaInfo
TerCancelEditStyle
Page 373
TerGetStyleId
Return Value: The function returns the style id for the given style name when successful.
Otherwise it returns -1.
See Also:
TerDeleteStyle
TerGetStyleInfo
Page 374
TerGetStyleInfo
Upon a successful return from this method, the following information can be
retrieved by using the TerGetOutInt and TerGetOutStr methods:
name=tej.TerGetOutStr("Name")
int type; // The style type. The style type can be one of the following
constants:
type=tej.TerGetOutInt("Type")
Return Value: The function returns total number of style items available in the document A
return value of -1 indicates an error.
See Also:
TerGetStyleId
Page 375
TerGetStyleParam
Return Value: The function returns the value for the requested parameter. It returns -1 to
indicate an error condition.
Page 376
TerSetStyleParam
int IntParam; The value for the numeric type parameter. This value is
ignored for the String type parameters.
LPBYTE TextParam; The value for the String type parameter. This value is
ignored for the numeric type parameters.
Page 377
Control Flags
In This Chapter
TerSetFlags
TerSetFlags2
TerSetFlags3
TerSetFlags4
TerSetFlags5
TerSetFlags6
TerSetFlags7
TerSetFlags8
TerSetFlags9
TerSetFlags10
Page 378
TerSetFlags
boolean set; // true to set the given flags, false to reset the given flags
int flags; // Flags (bits) to set or reset. Currently, the following flag
values are available:
Page 379
TFLAG_KEEP_FRAME_ASPECT: This flag maintains the frame aspect ratio
when being resized using the mouse.
Return value: This function returns the new value of all the flags. Call this function with the
'flags' parameter set to zero to retrieve flag values without modifying it.
See Also:
TerSetFlags2
TerSetFlags3
TerSetFlags4
Page 380
TerSetFlags2
boolean set; // true to set the given flags, false to reset the given flags
int flags; // Flags (bits) to set or reset. Currently, the following flag
values are available:
Page 381
TFLAG2_NO_SHADE_FIELD_TEXT: Do not apply shading to the field text.
TFLAG2_KEEP_PRINTER_OPEN: Keep the printer driver open after the last edit
window is closed. When this flag is set, your
application should call the TerClosePriner
function to close the printer driver manually
after the last edit window is closed.
Return value: This function returns the new value of all the flags. Call this function with the
'flags' parameter set to zero to retrieve flag values without modifying it.
See Also:
TerSetFlags
TerSetFlags3
TerSetFlags4
Page 382
Page 383
TerSetFlags3
boolean set; // true to set the given flags, false to reset the given flags
int flags; // Flags (bits) to set or reset. Currently, the following flag
values are available:
Page 384
name from replacement during text input to
the data field.
See Also:
TerSetFlags
TerSetFlags2
TerSetFlags4
Page 385
TerSetFlags4
boolean set; // true to set the given flags, false to reset the given flags
int flags; // Flags (bits) to set or reset. Currently, the following flag
values are available:
Page 386
format to the RTF output file.
See Also:
TerSetFlags
TerSetFlags2
TerSetFlags3
Page 387
TerSetFlags5
boolean set; // true to set the given flags, FALSE to reset the given
flags
int flags; // Flags (bits) to set or reset. Currently, the following flag
values are available:
Page 388
text.
Page 389
TerSetFlags6
boolean set; // true to set the given flags, FALSE to reset the given
flags
int flags; // Flags (bits) to set or reset. Currently, the following flag
values are available:
Page 390
TerSetFlags7
boolean set; // TRUE to set the given flags, FALSE to reset the given
flags
int flags; // Flags (bits) to set or reset. Currently, the following flag
values are available:
TFLAG7_SET_BOX_CLIPPING Draw the table cell and frame text within its
boundaries.
Return value: This function returns the new value of all the flags. Call this function with the
'flags' parameter set to zero to retrieve flag values without modifying it.
Page 391
Page 392
TerSetFlags8
boolean set; // TRUE to set the given flags, FALSE to reset the given
flags
int flags; // Flags (bits) to set or reset. Currently, the following flag
values are available:
Return value: This function returns the new value of all the flags. Call this function with the
'flags' parameter set to zero to retrieve flag values without modifying it.
Page 393
TerSetFlags9
boolean set; // TRUE to set the given flags, FALSE to reset the given
flags
int flags; // Flags (bits) to set or reset. Currently, the following flag
values are available:
Return value: This function returns the new value of all the flags. Call this function with the
'flags' parameter set to zero to retrieve flag values without modifying it.
Page 394
TerSetFlags10
boolean set; // TRUE to set the given flags, FALSE to reset the given flags
int flags; // Flags (bits) to set or reset. Currently, the following flag values are
available:
TFLAG10_DONT_PAD_TABLE_HEIGHT Don't add the bottom padding to the exact height table
rows
TFLAG10_NO_LAST_PARA_MARKER Don't read or write the last para-markte to the rtf file
TFLAG10_DOTTED_GRID_LINES Show the dotted table grid lines (instead of light blue
lines)
Page 395
Return value: This function returns the new value of all the flags. Call this function with the 'flags'
parameter set to zero to retrieve flag values without modifying it.
Page 396
List Numbering
The list mechanism allows you create very complex lists. Here we will described how to
create simple lists.
The list mechanism consists of a list id and a list-or (list override id). These ids can be
created using the TerEditList and TerEditListOr functions. One or more list-or ids can be
created for a list id. However, it is sufficient in most cases to create just one or two list-or
ids for each list id. The list and list-or id can have multiple levels. Each level can designate
its own list numbering format (decimal, alpha, etc).
To apply list numbering to text, you would first create a list and its corresponding list-or id.
Then you would apply the list-or id to the selected text (one or more paragraphs) using the
TerSetParaList function. You also specify the list level when calling the TerSetParaList
function.
When a list needs to be restarted from 1, it is simpler to create another list-id (and
associated list-or ids).
The product also includes a function called TerSetBulletList which is a wrapper for the basic
list functions in an easy to use method call.
In This Chapter
TerEditList
TerEditListLevel
TerEditListOr
TerGetBulletInfo
TerGetListInfo
TerGetListLevelInfo
TerGetListOrInfo
TerSetDefListFormat
TerSetListBullet
TerSetListLevel
Page 397
TerEditList
boolean NewList; // Set to true to create a new list item. Set to false to
modify an existing list item.
boolean PropDialog; // Show a dialog box for the user to enter the list
properties. When this parameter is set to true, the values
for the remaining parameters are ignored.
Example:
ListId= tej.TerEditList( true, 0, false, "MyFirstList",true, 0); // create a new multi-level list
ListOrId=tej.TerEditListOr( true, 0, false, ListId, false, 0); // create a list-override id for our
list
Page 398
tej.TerSetParaList(false,-1, ListOrId, 0, true); // apply top level numbering to this line
See Also:
TerEditListOr
TerEditListLevel
TerSetParaList
TerCreateListBullet
Page 399
TerEditListLevel
boolean TerEditListLevel( IsList, id, level, StartAt, NumType, CharAft, ListText, FontId,
flags)
boolean IsList; // Set to true to modify the level properties for a list item.
Set to false to modify the level properties for a list-override
item. A list-override item is allowed only if it has the
'OverrideLevels' flag set (please refer to the TerEditListOr
function).
int level; // A valid level number. A simple list has only one level (level
number 0). A nested list has 9 levels (0 to 8).
int StartAt; // The starting number for a level. A typical value would be
1.
LIST_NO_NUM Hidden
int CharAft; // The character between the bullet text and the body
text:
LISTAFT_NONE No space
String ListText. // The text printed for the paragraph number. The level
number information can be embedded in this text
surrounded by a pair or '~' characters.
Page 400
~1~.~2~
The editor will replace the ~1~ String by the current number
value for level 1. Similarly, the editor will replace the ~2~
String by the current number value for level 2. The result
might as following:
1.1 Item 1
1.2 Item 2
1.3 Item 3
(1) Item 1
(2) Item 2
(3) Item 3
DWORD flags; // One or more of the following flags bits can be specified:
Description: This function allows you edit the default properties for a list or list-override
level.
See Also:
TerEditList
TerEditListOr
Page 401
TerSetParaList
TerCreateListBullet
Page 402
TerEditListOr
boolean PropDialog; // Show a dialog box for the user to enter the list-override
properties. When this parameter is set to true, the values
for the remaining parameters are ignored.
boolean OverrideLevels; // Set to true to create a new set of level information for
the list-override. The level information includes properties
such as number-format, starting-number, fonts, etc. When
this parameter is false, the list-override item simply points
to the corresponding list item without any modification.
DWORD flags; // Set to Zero. This parameters is reserved for future use.
Description: The list-override items are used to override the list items. Multiple list
overrides can be created for a list item. This allows for various fragments of a continuous
list to be displayed in different formats. Please refer to the TerEditList function for further
description of list numbering mechanism..
Return Value: When successful, this function returns a valid list-override id. A return value
of -1 indicates an error condition.
See Also:
TerEditList
TerEditListLevel
TerSetParaList
TerCreateListBullet
Page 403
TerGetBulletInfo
int QueryType; // This parameter can be set to one of the following values:
int id; // The value for this parameter depends upon the value
specified for the 'QueryType' parameter. When the
'QueryType' is set to PID_LINE, the 'id' parameter must
contain a text line number. You can set the line number
value to -1 to specify the current line. when the
'QueryType' is set to PID_PARA, then the 'id' parameter
must contain a paragraph id. When the 'QueryType' is set
to PID_BULLET, then the 'id' parameter must contain a
valid bullet id. When the 'QueryType' is set to
PID_STYLE, the 'id' parameter must contain a stylesheet
style id.
Upon a successful return from this method, the following information can be
retrieved by using TerGetOutInt and related methods:
boolean IsBullet; // This flag is true if the paragraph has bullets. It is false if
the paragraph numbering is turned on.
IsBullet=tej.TerGetOutBool("IsBullet")
start=tej.TerGetOutInt("ListStart")
Page 404
int level; // The level number when paragraph numbering is turned
on.
level=tej.TerGetOutInt("ListLevel")
int symbol; // For a bullet list, the symbol can be one of the following:
BLT_ROUND Round
BLT_DIAMOND Diamond
BLT_SQUARE Square
BLT_ARROW Arrow
BLT_CHECK Check
symbol=tej.TerGetOutInt("ListSymbol")
int ListOrId; // The list override id if this bullet is created using the list
table. A zero return value for this parameter indicates a
regular bullet or a regular paragraph number.
Page 405
ListOrId=tej.TerGetOutInt("ListOrId")
ListText=tej.TerGetOutInt("ListText")
Return Value: This function returns the current bullet id. A value of 0 indicates that the
bullet/numbering is not turned on for the paragraph. A value of -1 indicates an error
condition.
See Also:
TerCreateBulletId
TerSetBulletEx
Page 406
TerGetListInfo
int ListId; // The id of the list item. Set this parameter to -1 to retrieve the
information about the list id for the current line.
Upon a successful return from this method, the following information can be retrieved by
using TerGetOutInt and related methods:
Upon a successful return from this method, this value can be retrieve
as following:
ListName=tej.TerGetOutStr("ListName")
int LevelCount; // The number of list levels supported by the list. A nested list
supports 9 levels. A simple list supports one level.
Upon a successful return from this method, this value can be retrieve
as following:
LevelCount=tej.TerGetOutInt("ListLevelCount")
int flags; // The list flag (LISTFLAG_?). Please refer to the TerEditList for an
available list of list flags.
Upon a successful return from this method, this value can be retrieve
as following:
flags=tej.TerGetOutInt("ListFlags")
Upon a successful return from this method, this value can be retrieve
Page 407
as following:
RtfId=tej.TerGetOutInt("ListRtfId")
Upon a successful return from this method, this value can be retrieve
as following:
TmplId=tej.TerGetOutBool("TmplId")
See Also:
TerEditList
TerGetListOrInfo
TerGetListLevelInfo
Page 408
TerGetListLevelInfo
boolean IsList; // Set to true to retrieve the level properties for a list item.
Set to false to retrieve the level properties for a list-override
item. A list-override item is allowed only if it has non-zero
list levels (please refer to the TerGetListOrInfo function).
int id; // The id of the list or list-override item to retrieve. You can
set this parameter to -1 to retrieve the information about
the list level for the current line.
int level; // A valid level number. A simple list has only one level
(level number 0). A nested list has 9 levels (0 to 8). This
parameter is ignored when the 'id' parameter is set to -1.
Upon a successful return from this method, the following information can be
retrieved by using TerGetOutInt and related methods:
StartAt=tej.TerGetOutInt("ListStart")
int NumType; // The lnumber type used for the bullet. Please refer to the
TerEditListLevel function for a list of number type
constants.
NumType=tej.TerGetOutInt("ListNumType")
int CharAft; // The character between the bullet text and the body text.
Please refer to the TerEditListLevel function for a list of
values returned by this parameter.
CharAft=tej.TerGetOutInt("ListCharAft")
String ListText. // The text printed for the paragraph number. Please refer
to the TerEditListLevel function for the description of this
parameter.
ListText=tej.TerGetOutStr("ListText")
Page 409
int FontId; // The font id to print the paragraph number text.
FontId=tej.TerGetOutInt("ListFontId")
int flags; // The list level flags. Please refer to the TerEditListLevel
function for a description of the list level flags.
flags=tej.TerGetOutInt("ListFlags")
See Also:
TerGetListInfo
TerGetListOrInfo
TerEditListLevel
Page 410
TerGetListOrInfo
int ListOrId; // The id of the list override item. Set this parameter to -1 to retrieve
the information about the list override id for the current line.
Upon a successful return from this method, the following information can be retrieved by
using TerGetOutInt and related methods:
ListId=tej.TerGetOutInt("ListId")
int LevelCount; // The number of list levels supported by the list override id. A
non-zero value indicates that this list override id actually overrides
the level information for the underlying list id.
LevelCount=tej.TerGetOutInt("ListLevelCount")
int flags; // The list override flags. This parameter is not used currently and
always returns a zero value.
flags=tej.TerGetOutInt("ListFlags")
See Also:
TerGetBulletInfo
TerEditListOr
TerGetListInfo
TerGetListLevelInfo
Page 411
TerSetDefListFormat
Specify default list level properties to apply when creating a new list.
LIST_NO_NUM Hidden
String ListText. // The text printed for the paragraph number. The level
number information can be embedded in this text
surrounded by a pair or '~' characters.
~1~.~2~
1.1 Item 1
1.2 Item 2
1.3 Item 3
(1) Item 1
Page 412
(2) Item 2
(3) Item 3
Description: The properties specified using this method is applicable only to a new list
subsequently created using any of the list creation methods.
Page 413
TerSetListBullet
int level; // list level (0 to 8). The default value for this parameter is
0.
String TextBef; // Text before the paragraph number. Set to "" for default.
This parameter is ignored when the ListText parameter is
non-blank.
String TextAft; // Text After the paragraph number. Set to "" for default.
This parameter is ignored when the ListText parameter is
non-blank.
Description:
Examples:
Create a decimal numbered list of level 0 where the numbering prints as:
tej.TerSetListBullet2(true,tej.LIST_DEC,0,1,"","","(~1~)",true);
Create a decimal numbered list of level 0 where the numbering prints as:
Page 414
1., 2., 3., Etc.
tej.TerSetListBullet2(true,tej.LIST_DEC,0,1,"","","~1~.",true);
Create a decimal numbered list of level 1 where the numbering prints as:
tej.TerSetListBullet2(true,tej.LIST_DEC,1,1,"","","~1~.~2~",true);
tej.TerSetListBullet2(true,tej.LIST_BLT,1,1,"","","",true);
tej.TerSetListBullet2(true,tej.LIST_BLT,1,1,"","",new string((char)61607,1),true);
tej.TerSetListBullet2(true,tej.LIST_BLT,1,1,"","",new string((char)61656,1),true);
You can also any character value between 33 and 255 in the Wingdings character
set to display a bullet.
See Also
TerSetListLevel
Page 415
TerSetListLevel
int level; // list level (0 to 8). The outmost level is 0. Set this
parameter to -1 to increase or decrease the level using the
'increment' parameter.
See Also
TerSetListBullet
Page 416
Toolbar
In This Chapter
TerEditTooltip
TerAddToolbarIcon
TerHideToolbarIcon
TerRecreateToolbar
TerSetToolbarComboWidth
TerUpdateToobar
Page 417
TerEditTooltip
int id; // The toolbar icon id. The following is a list of toolbar icon
ids:
TLB_PRINT Print
Page 418
TLB_HELP Help
TLB_UNDO Undo
TLB_REDO Redo
Page 419
TerAddToolbarIcon
int LineNo; // Set to 0 to add the icon to the top row of the toolbar. Set
to 1 to add this icon to the bottom row of the toolbar.
int TlbId; // Set this parameter to one of the toolbar ids. Please refer
to TerEditTooltip function for a list of toolbar icon ids. This
would add an existing toolbar icon. The CmdId and
BmpFile parameters are ignored when this parameter is
non-zero.
int CmdId; // When the TlbId parameter is set to zero, use the CmdId
parameter to specify the command id for the new toolbar
icon. Please refer to the 'Command' property for a list of
existing command ids.
String BmpFile; // The bitmap file to draw the toolbar icon. The toolbar icon
consists of 24x24 pixels. Therefore, the picture must be at
least 24 pixels wide and 24 pixels tall. Only first 24x24
pixels are used. The remaining pixels are ignored. This
parameter is used by the TerAddToolbarIcon method only.
Image image // The image object to draw the toolbar icon. The toolbar
icon consists of 24x24 pixels. Therefore, the picture must
be at least 24 pixels wide and 24 pixels tall. Only first
24x24 pixels are used. The remaining pixels are ignored.
This parameter is used by the TerAddToolbarIcon3 method
only.
Example:
Page 420
tej.TerAddToolbarIcon(0,0,tej.ID_PARA_KEEP,"pict.bmp","Keep");
tej.TerAddToolbarIcon(0,tej.TLB_SPACER,0,null,null);
tej.TerAddToolbarIcon(0,tej.TLB_LINE,0,null,null);
tej.TerAddToolbarIcon(0,tej.TLB_SPACER,0,null,null);
tej.TerAddToolbarIcon(0,tej.TLB_PASTE,0,null,null);
tej.TerAddToolbarIcon(0,tej.TLB_SPACER,0,null,null);
tej.TerAddToolbarIcon(0,tej.TLB_LINE,0,null,null);
tej.TerRecreateToolbar(true);
Page 421
TerHideToolbarIcon
boolean hide; // Set to true to hide the icon, or set to false to redisplay a
previously hidden icon.
Description: Please note that the changes made by this function are not displayed on an
'existing' TE control window until the toolbar is recreated using the TerRecreateToolbar
function. You would typically call this function multiple times to hide more than one icons
and then call the TerReceateToolbar function once to redisplay the modified toolbar. When
a new control is created, it would automatically hide the icons flagged by this function.
See Also:
TerRecreateToolbar
TerEditTooltip
Page 422
TerRecreateToolbar
boolean TerRecreateToolbart(show)
See Also:
TerHideToolbarIcon
Page 423
TerSetToolbarComboWidth
Page 424
TerUpdateToobar
Update toolbar.
boolean TerUpdateToolbar()
Description: This function should be called to update the toolbar after calling an API
function which might need refreshing of the toolbar.
Page 425
Undo
In This Chapter
TerFlushUndo
TerSetMaxUndo
TerSetUndoRef
Page 426
TerFlushUndo
Flush undo/redo buffer.
boolean TerFlushUndo()
See Also:
TerSetUndoRef
Page 427
TerSetMaxUndo
Page 428
TerSetUndoRef
Comment: This function can be used to connect multiple API calls to one undo buffer. You
would first call this function before any API is called to retrieve the current undo reference
count. You would then call this function before each API call to reset the undo reference to
the initial value.
Return Value: This function returns the previous value of the undo reference id when
successful. Otherwise it returns -1.
See Also:
TerFlushUndo
TerSetMaxUndo
Page 429
Input Field
In This Chapter
TerGetCheckboxInfo
TerGetComboboxInfo
TerGetInputFieldInfo
TerGetTextFieldInfo
TerInsertCheckBoxField
TerInsertComboBoxField
TerInsertTextInputField
TerLocateInputField
TerSetCheckboxInfo
TerSetComboboxInfo
TerSetInputFieldInfo
TerSetTextFieldInfo
Page 430
TerGetCheckboxInfo
Upon a successful return from this method, the following information can be
retrieved by using TerGetOutBool method:
checked=tej.TerGetOutBool("IsChecked")
See Also:
TerLocateInputField
TerGetInputFieldInfo
TerGetTextFieldInfo
TerSetCheckboxInfo
Page 431
TerGetComboboxInfo
Upon a successful return from this method, the following information can be
retrieved by using TerGetOutStr method:
String items; // String containing the combo-box items. Each item in the
list is delimited by a '|' character.
items=tej.TerGetOutStr("Items")
Return Value: This function returns a zero based index of the selected item when
successful. A value of -1 indicates an error condition.
Page 432
TerGetInputFieldInfo
Upon a successful return from this method, the following information can be
retrieved by using TerGetOutStr and related methods:
name=tej.TerGetOutStr("Name")
type=tej.TerGetOutInt("Type")
border=tej.TerGetOutBool("HasBorder")
See Also:
TerLocateInputField
TerGetCheckboxInfo
TerGetTextFieldInfo
TerSetInputFieldInfo
Page 433
TerGetTextFieldInfo
Upon a successful return from this method, the following information can be
retrieved by using TerGetOutStr and related methods:
data=tej.TerGetOutStr("Data")
int MaxChars; // The current maximum text length for the text box.
MaxChars=tej.TerGetOutInt("MaxChars")
width=tej.TerGetOutInt("Width")
String typeface; // The font typeface for the text in the text box.
typeface=tej.TerGetOutStr("Typeface")
int TwipsSize; // The font typeface size in twips (20 twips = 1 point).
TwipsSize=tej.TerGetOutInt("TwipsSize")
Page 434
Upon a successful return from this method, this value can
be retrieve as following:
style=tej.TerGetOutInt("Style")
See Also:
TerLocateInputField
TerGetInputFieldInfo
TerGetCheckboxInfo
TerSetTextFieldInfo
Page 435
TerInsertCheckBoxField
boolean Insert; // Set to true to insert the checkbox. Set to false to create
a check-box object, but do not insert it in the text.
Return Value: This function returns the picture id of the field. It returns 0 to indicate an
error condition.
See Also:
TerInsertTextInputField
TerLocateInputField
TerGetCheckboxInfo
Page 436
TerInsertComboBoxField
Return Value: This function returns the picture id of the field. It returns 0 to indicate an
error condition.
Page 437
TerInsertTextInputField
int TerInsertTextInputField( name, InitText, MaxLen, border, typeface, twipsize, style, color,
insert, repaint)
boolean border; // Set to true to draw the box around the text field.
int style; // Style (BOLD, ULINE, ITALIC) for the text. Use the
logical OR operator to specify more than one style
constants.
boolean insert; // Set to true to insert the new input field into the
document. Set to false to simply return the picture id of
the new field without inserting into the text.
Description: This function inserts a text box. The user can input data into the text box.
Return Value: This function returns the picture id of the text input field. It returns 0 to
indicate an error condition.
See Also:
TerInsertCheckBoxField
TerLocateInputField
TerGetInputFieldInfo
TerGetTextFieldInfo
Page 438
TerLocateInputField
boolean repaint: // Set to true to repaint the screen after this operation.
Return Value: This function returns the object id of the located field when successful.
Otherwise, it return 0.
See Also:
TerInsertCheckBoxFiel
d
TerGetInputFieldInfo
TerSetInputFieldInfo
Page 439
TerSetCheckboxInfo
See Also:
TerLocateInputField
TerSetInputFieldInfo
TerSetTextFieldInfo
TerGetCheckboxInfo
Page 440
TerSetComboboxInfo
int SelItemIdx; // A zero based index of the item in the 'items' parameter
to be selected automatically. For example, to select the
item 'Blue', you would pass a value of 1 for this parameter.
boolean repaint; // Set to TRUE to repaint the control after this operation.
Page 441
TerSetInputFieldInfo
boolean border; // Set to true to set the border around the field. This
argument is applicable to the textbox input field only.
See Also:
TerLocateInputField
TerSetCheckboxInfo
TerSetTextFieldInfo
TerGetInputFieldInfo
Page 442
TerSetTextFieldInfo
String data; // The new text data for the text box.
int MaxChars; // The maximum text length for the text box. Set to 0 for
no maximum limit.
String typeface; // The font typeface for the text in the text box.
int TwipsSize; // The font typeface size in twips (20 twips = 1 point).
int style; // The style information for the font. Set to 0 for default.
The following styles can be selected for the text box.
See Also:
TerLocateInputField
TerSetInputFieldInfo
TerSetCheckboxInfo
Page 443
Page
This chapter includes page manipulation functions. Please also refer to the Section
Formatting page for other related functions.
In This Chapter
TerGetDispPageNo
TerGetPageBorderDim
TerGetPageCount
TerGetPageFirstLine
TerGetPageNumFmt
TerGetPageOffset
TerGetPageParam
TerGetPagePos
TerGetPageSect
TerPageBreak
TerInsertPageRef
TerPageFromLine
TerPageBitmap
TerPosPage
TerRepaginate
TerSetPageBkColor
TerSetPageNumFmt
TerSetPagePos
Page 444
TerGetDispPageNo
Return Value: The display page number can be different from the actual page number
since the display page number can be reset at the section breaks.
See Also:
TerGetPagePos
TerGetField
Page 445
TerGetPageBorderDim
int TerGetPageBorderDim()
Upon a successful return from this method, the following information can be
retrieved by using TerGetOutInt method:
int width; // The page border width (left and right) in twips.
width=tej.TerGetOutInt("Width")
height=tej.TerGetOutInt("Height")
Page 446
TerGetPageCount
Upon a successful return from this method, the following information can be
retrieved by using TerGetOutInt method:
TotalPages=tej.TerGetOutInt("TotalPages"
)
CurPage=tej.TerGetOutInt("CurPage")
See Also:
TerSetPagePos
TerGetDispPageNo
Page 447
TerGetPageFirstLine
Return Value: This function returns the first line of the specified page number.
See Also:
TerPageFromLine
Page 448
TerGetPageNumFmt
See Also
TerSetPageNumFmt
Page 449
TerGetPageOffset
int rel; This variable can be set to one of the following constants:
Upon a successful return from this method, the following information can be
retrieved by using TerGetOutInt methods:
x=tej.TerGetOutInt("X")
y=tej.TerGetOutInt("Y")
width=tej.TerGetOutInt("Width")
height=tej.TerGetOutInt("Height")
Page 450
TerGetPageParam
Return Value: The function returns the value for the requested parameter. It returns
FP_ERROR to indicate an error condition.
Page 451
TerGetPagePos
Upon a successful return from this method, the following information can be
retrieved by using TerGetOutInt methods:
page=tej.TerGetOutInt("CurPage")
int y; // The offset of the top of the window relative to the top of
the page. This value is returned in twips unit.
y=tej.TerGetOutInt("PageOffset")
See Also:
TerGetPageCount
TerSetPagePos
TerGetDispPageNo
Page 452
TerGetPageSect
Return Value: This function returns the section number containing the first line of a page.
Page 453
TerPageBreak
boolean TerPageBreak(repaint)
Description: This function is used to place the following text on the new page. The page
break is created before the current line. Please note that a page break can not be created
inside an object such as table, frame, text box, etc.
See Also:
TerColBreak
TerSectBreak
Page 454
TerInsertPageRef
boolean IsAlphabetic; // Set to True to display the page number in the alphabetic
format.
Comment: The page-reference field displays the page number where the referenced
bookmark is located.
Return Value: This function returns a True value when successful, otherwise it returns a
false value.
See Also
TerInsertBookmark
TerInsertToc
Page 455
TerPageFromLine
int TerPageFromLine(LineNo)
Return Value: This function returns the page number that contains the given text line
number. A value of -1 indicates an error condition.
See Also:
TerGetPageFirstLine
Page 456
TerPageBitmap
Bitmap TerPageBitmap(PageNo)
Return Value: This function returns the Bitmap object containing the text for the page. A
null values indicates an error condition.
When creating bitmaps for multiple pages, it is efficient to sandwich multiple calls to the
TerPageBitmap function between the calls to the TerSetPrintPreview function:
int TotalPages=tej.TerGetParam(tej.TP_TOTAL_PAGES);
output
tej.TerPageBitmap(page);
TotalPages=tej.TerGetParam(tej.TP_TOTAL_PAGES);
tej.TerSetPrintPreview(false);
Page 457
TerPosPage
See Also:
TerPosTable
TerGetSeqSect
Page 458
TerRepaginate
Description: This function rewraps and repaginates a document. This function should be
used instead of the TerRewrap function in the PrintView, Page mode, and Fitted View
modes.
See Also:
TerRewrap
TerReformatTable
Page 459
TerSetPageBkColor
boolean TerSetPageBkColor(BkColor)
Description: This function is used set a background color for the page. If the page borders
are active, then the color is applied to the area inside the page borders.
Use the TerGetParam function to retrieve the current page background color.
Example:
Page 460
TerSetPageNumFmt
int sect; // Section id to apply changes. You can also set this
parameter to SECT_CUR to edit the current section, or
set it to SECT_ALL to apply changes to all sections in
the document.
See Also
TerGetPageNumFmt
Page 461
TerSetPagePos
Position at the specified page number and at the specified display offset with the
page.
int y; // This variable specifies the offset of the top of the window
relative to the top of the page. This value is specified in the
twips unit.
See Also:
TerGetPagePos
Page 462
Search, Replace, Locate
In This Chapter
TerLocateFieldChar
TerSearchReplace
TerSetSearchString
Page 463
TerLocateFieldChar
String FieldCode; // Field code associated with Field Id. Pass a null value
for the field ids (such as FIELD_NAME and FIELD_DATA)
that do not use field code.
boolean present; // true to test for the presence of the given field id, or false
to test for the absence of the given field id.
line=tej.TerGetOutInt("StartLine")
col=tej.TerGetOutInt("StartCol")
boolean forward; // true to scan the text in the forward direction, or false to
scan the text in the backward direction.
See Also:
TerLocateField
Page 464
TerSearchReplace
int pEndPos; // variable to the end text position. This parameter is not
used by the TerSearchReplace2 function.
int EndPos; // The end position of the String to replace. This parameter
is not used by the TerSearchReplace function.
int BufSize; // variable to the size of the retrieved text. This parameter
is not used by the TerSearchReplace2 function.
Description: This function has three operational modes: search, replace and retrieve.
Search Mode: To initiate this mode, set the SRCH_SEARCH flag in the 'flags' parameter.
You can also set the following bits in the 'flags' parameter:
The search String is passed via the 'search' parameter. The search String consists of
regular text and certain special characters. The special characters are inserted using the '^'
prefix:
^p Paragraph character
^t Tab character
^b Section break
^+ Em dash
Page 465
^- En dash
^^ ^ character.
The initial search location is specified by the 'StartPos' parameter. This parameter specifies
the absolute character position since the beginning of the file.
If the search String is located using the TerSearchReplace function, the absolute character
position of the located text can be retrieved as following:
EndPos=tej.TerGetOutInt("EndPos")
If the search String is located using TerSearchReplace2 function, then the absolute
character position is returned via function return value. If the String is not found, then this
function returns -1.
Replace Mode: To initiate this mode, set the SRCH_REPLACE flag in the 'flags'
parameter. This function replaces the text between the 'StartPos' and 'pEndPos' (or
EndPos for the TerSearchReplace2 function) absolute character positions by the specified
replacement text. The replacement text is specified by the 'replace' argument.
Retrieve Mode: To initiate this mode, set the SRCH_RETRIEVE flag in the 'flags'
parameter. This function retrieves the text between the 'StartPos' and 'EndPos' absolute
character positions. This function returns even the hidden text. The text between the
StartPos and EndPos can be subsequently retrieved upon the successful return from this
method as following
String RetrievedText=tej.TerGetOutStr("Search")
When the SRCH_SEARCH flag is specified, the return value indicates the absolute
character position of the String found. It returns -1 if the String is not found.
When the SRCH_REPLACE flag is specified, this function returns true if successful.
Otherwise, it returns a false value
Example:
pos=0;
while (pos>=0) {
pos=tej.TerSearchReplace2(SearchString, "",
Page 466
tej.SRCH_SEARCH+tej.SRCH_WORD+ tej.SRCH_CASE, pos,
0);
Page 467
TerSetSearchString
Set the String for backward and forward search menu commands.
Page 468
Track Changes
This chapter includes document modification tracking functions. TE can track modification
made by multiple reviewers. You can search for each modified text string. You can accept
individual modification, or you can accept all modification at once. The process of
acceptance merges the modification to the main document.
In This Chapter
TerAcceptChanges
TerDeleteReviewer
TerEnableTracking
TerFindNextChange
TerGetReviewerInfo
TerRejectChanges
Page 469
TerAcceptChanges
Description: This function merges the modified text to the document. The 'deleted' text is
removed from the document. The 'inserted' text attribute is set to normal.
The tracking mode should be turned off to enable the use of this function.
Return Value: This function returns the number of text strings accepted. It returns -1 to
indicate an error condition.
Page 470
TerDeleteReviewer
Delete a reviewer
boolean TerDeleteReviewer(RevId)
Comment: This function deletes the specified reviewer id from the current document. The
reviewer id should be deleted only if the document does not contain any changes
associated with the reviewer.
Page 471
TerEnableTracking
String name; // The reviewer name. Set to "" to assume currently logged
user name.
boolean UseDefaultClrStyle; // Use the default value for color and style for the deleted
and inserted text. When this parameter is set to TRUE,
the following color and style parameters are ignored.
int InsStyle; // The style to apply to the newly inserted text. Please
refer to the SetTerCharStyle function for the list of available
character style.
int DelStyle; // The style to apply to the deleted text. Please refer to
the SetTerCharStyle function for the list of available
character style.
Comment: The ID_TRACK_CHANGES id can also be used with the TerCommand method
or the Command property to enable/disable tracking of modification.
Page 472
TerFindNextChange
boolean forward; // Set to TRUE to find the next modified string. Set to false
to find the previous modified string.
Comment: The ID_NEXT_CHANGE and ID_PREV_CHANGE ids can also be used with the
TerCommand function or the Command property to locate modified text.
Return Value: This function returns TRUE if the String is located, otherwise it returns
FALSE.
Page 473
TerGetReviewerInfo
Upon a successful return from this method, the following information can be
retrieved by using TerGetOutStr methods:
RevName=tej.TerGetOutStr("Name")
Page 474
TerRejectChanges
boolean all; // Set to TRUE to reject all changes. Set to false to reject
the current change.
Description: This function annuls the modification to the document. The 'inserted' text is
removed from the document. The 'deleted' text is reinstated in the document.
The tracking mode should be turned off to enable the use of this function.
The ID_REJECT_CHANGE and ID_REJECT_ALL_CHANGES ids can also be used with the
TerCommand function or the Command property to reject modified text.
Return Value: This function returns the number of text strings rejected. It returns -1 to
indicate an error condition.
Page 475
Comment
Page 476
TerApplyComment
Comment: Some text must be selected before calling this method. The comment is
applied to the selected text. The selected text is highlighted and pointed to the comment
text in the right-margin area. The comments are displayed horizontally when the
right-margin is sufficiently wide. Otherwise, it is displayed vertically.
Return Value: This function returns the comment-id when successful, otherwise it returns
a -1 value.
Page 477
TerEditComment
boolean ShowDialog; // Set to TRUE to show a dialog to accept the new author
information and the comment text. Set to false to use the
information from the remaining parameters passed to this
method
String CommentText; // New Comment text. Use the cr/lf sequence to include a
paragraph break.
Page 478
Menu Command
In This Chapter
TerCommand
TerMenuEnable
TerMenuSelect
TerIgnoreCommand
Page 479
TerCommand
int CommandId; // Please refer to the 'command' property under the Control
Properties chapter for a list of available command ids.
Page 480
TerMenuEnable
int MenuId; // menu id. Please refer to the 'command' property for a
list of menu (or command) ids.
Description: If your program creates a menu outside the editor window, you can use this
function to test if a menu item should be enabled or grayed.
Return Value: The TerMenuEnable function returns one of the following constants:
The TerMenuEnable2 function returns true when a menu item is enabled. Otherwise it
returns a false value.
Example:
boolean status;
status = tej.TerMenuEnable2(tej.ID_CUT);
// The 'status' variable will be true if a text block is highlighted to be copied to the clipboard.
See Also:
TerMenuSelect
Page 481
TerMenuSelect
int MenuId; // menu id. Please refer to the 'command' property for a
list of menu (or command) ids.
Description: If your program creates a menu outside the editor window, you can use this
function to test if a menu item should be checked.
Return Value: The TerMenuSelect function returns one of the following constants:
Example:
boolean status;
status = tej.TerMenuSelect2(tej.ID_BOLD);
// The 'status' variable will be true if the current character has the bold style.
See Also:
TerMenuEnable
Page 482
TerIgnoreCommand
Ignore the current preprocess command.
boolean TerIgnoreCommand()
Description: This function can be used while processing the 'Preprocess' event. This
function sets a flag which instructs the editor to skip processing the current command.
Page 483
Screen Drawing
In This Chapter
TerEnableRefresh
TerGetTextHeight
TerRepaint
TerRewrap
TerScrLineHeight
TerSetBorderColor
TerSetBorderLineColor
TerSetFocus
TerSetWrapWidth
TerSetZoom
TerSetStatusColor
Page 484
TerEnableRefresh
boolean TerEnableRefresh(enable)
Page 485
TerGetTextHeight
Return the total text height in twips.
int TerGetTextHeight()
Description: This function returns the total body text height of all pages in the document.
The body text height does not include the header/footer text, or the table header text.
See Also
TerScrLineHeight
Page 486
TerRepaint
Page 487
TerRewrap
Word wrap the entire document on demand.
int TerRewrap()
Description: This function can be used to rewrap the entire document on demand.
See Also:
TerRepaginate
Page 488
TerScrLineHeight
int line; // line number (0 to TotalLines -1) to return the height for.
Return Value: This function returns the line height in the screen pixels.
See Also
TerGetTextHeight
Page 489
TerSetBorderColor
Set the color of the border area around the text window.
Color color; // Color of the border area. The border color gets reset
when you set the text background color using the
or, SetTerFields function.
Page 490
TerSetBorderLineColor
Set the color of the border line around the page in the page-layout mode.
Page 491
TerSetFocus
Set the focus cursor.
boolean TerSetFocus()
Description: Normally, when the editor window is activated, the caret (cursor) shows up in
the editor window. However, within certain programming environment, the caret does not
appear in the editor window automatically. This function can be used to display the caret in
this situation.
Page 492
TerSetWrapWidth
int WidthTwips; // This parameter specifies the length of the line in twips
for word wrapping. The actual width of the text line is
calculated as following:
Description: This function is available in simple word-wrap mode only (not available when
the PrintView or Page Mode is turned on). To specify the wrap width in terms of the number
of characters, set the WidthTwips parameter to 0. To specify the wrap width in terms of
'twips', set the WidthChars parameter to 0. To reset to regular word wrapping, set both the
WidthChars and WidthTwips parameters to 0.
Page 493
TerSetZoom
int ZoomPercent; // Specify a value between 10 and 1000, the 100 being the
normal display. You can set this argument to 2 to simply
retrieve the current zoom percent with changing it.
Return Value: This function returns the previous zoom percent. It returns -1 if an error
occurs.
Page 494
TerSetStatusColor
Set the color of the status, ruler and toolbar area around the text window.
Color color; // The foreground color for the status bar text.
Color BkColor; // The background color for the status, ruler and toolbar
area.
or,
The color value can be passed as a Color object, or an
String BkColor; HTML color string such as red, "#ff0000".
Page 495
Spell Checking
*************************************************************************************************
SPELL TIME is NOT available for TE Edit Control for Java yet. The methods
described in this topic are for future use only (not available at present).
************************************************************************************************
SpellTime must be installed to use these functions. The SpellTIme.DLL and the SpellTime
dictionaries (dict25.* files) should be placed where the tej.dll file is located.
After a Tej control is created, please call the TerSetStLicenseKey function to set the
product key for SpellTime.
You can use the ID_SPELL (not available for TE for HTML/Javascript) and ID_AUTO_SPELL
commands to use on-demand or as-you-type spell-checking.
You can also use the TerSpellCheck function to invoke on-demand spell-checking.
If you need the spell-time dictionaries to be accessed from a different directory, then create
an instance of SpellTime class providing the dictionary path to the constructor. For this,
you will need to include a reference to SpellTime.dll in your project. Once you get the
SpellTime object, you can pass the SpellTime object to the current instance of Tej using
the TerInitSpellTime function. This technique can also be used to share one instance of
SpellTime with more than one instances of Tej. By default, each instance of Tej creates its
own SpellTime object.
In This Chapter
TerInitSpellTime
TerSetStLicenseKey
TerSpellCheck
Page 496
TerInitSpellTime
Initialize SpellTime.
boolean TerInitSpellTime(st)
The following example creates an instance of SpellTime specifying a dictionary file path. It
then pass this object to TE.
tej1.TerInitSpellTime(st)
Page 497
TerSetStLicenseKey
String LicenseKey // The license key for SpellTime is e-mailed to you after
your order for SpellTime is processed.
The license key for SpellTime is e-mailed to you after your order for SpellTime is
processed. You would set the license key for SpellTime using the TerSetStLicenseKey
static function. This should be done after creating an instance of the editor control.
Tej.TerSetStLicenseKey("xxxxx-yyyyy-zzzzz")
Replace the 'xxxxx-yyyyy-zzzzz' by your license key for SpellTime. Please note that the
your license key for Tej is not valid for SpellTime.
Page 498
TerSpellCheck
boolean StopAfterFirst; // true to stop the spell check session after the first
misspelled word is found.
Return Value: This function returns true if document contains no misspelled words. It
returns false if the StopAfterFirst parameter is set to true and a one misspelled word is
found. Otherwise, the false return values indicates one or more misspelled words. A false
value is also returned when SpellTime is not installed.
Page 499
HTML Add-on Interface
*************************************************************************************************
HTML Add-on is NOT available for TE Edit Control for Java yet. The methods described in
this topic are for future use only (not available at present).
************************************************************************************************
You do not necessarily need to create a Htn object to do standard import and export of HTML data
within TE Edit Control. Simply copy htn.dll to the application directory containing tej.dll.
Now use the TerSetHtnLicenseKey method to set the license key for HTML Add-on. The license key
for HTML Add-on is e-mailed to you after your order for HTML Add-on is processed. Please note that
your license key for TE Edit Control is not valid for HTML Add-on.
tej1.TerSetHtnLicenseKey("xxxxx-yyyyy-zzzzz")
First set the output format to SAVE_HTML using the TerSetOutputFormat method:
tej1.TerSetOutputFormat(tej.SAVE_HTML)
Now you can use any of the TE's output methods or properties to extract the data in the HTML
format:
String HtmlText=tej1.Data
tej1.TerSetFlags4(True,tej.TFLAG4_HTML_INPUT)
Now you can use any of the TE's input methods or properties to insert html data into TE:
tej1.Data = HtmlText
In the above examples, TE automatically creates an HTML object for you to do input or output of
html data. However, you can also create the HTML object explicitly. The later method is suitable if
you need to call the html methods (such as HtsSetFlags) prior to doing export or import of html data.
Page 500
Imports SubSystems.TE ' VBN syntax
HTN htn1=new Htn(tej1) // pass the Tej class object to bind to the
// set the license key. Your license k ey for HTML Add-on is e-mailed to you after your order for HTML
Add-on is processed.
Htn.HtsSetLicenseKey(xxxx-yyyy-zzzz)
tej1.TerSetHtnObject(htn1)
Now TE can use this Htn object to do import or export of HTML data as described earlier in this topic.
In This Chapter
TerSetHtnLicenseKey
TerSetHtnObject
Page 501
TerSetHtnLicenseKey
Your license k ey for HTML Add-On is e-mailed to you after your order for HTML Add-on is
processed.
Example:
tej1.TerSetHtnLicenseKey("xxxxx-yyyyy-zzzzz")
Replace the 'xxxxx-yyyyy-zzzzz' by your license key for HTML Add-on. Please note that
the your license key for Tej is not valid for HTML Add-on.
See Also
TerSetHtnObject
Page 502
TerSetHtnObject
boolean TerSetHtnObject(htn)
Example:
// set the license key. The license key for HTML Add-on is e-mailed to you after your order
for HTML Add-on is processed.
Htn.HtsSetLicenseKey(xxxx-yyyy-zzzz)
htn1.HtsSetFlags(True, hc.HFLAG_NO_FONT)
tej1.TerSetHtnObject(htn1)
Now TE can use this Htn object to do import or export of HTML data using the
SAVE_HTML and TFLAG4_HTML_INPUT flags.
Page 503
See Also
TerSetHtnLicenseKey
Page 504
Miscellaneous
In This Chapter
TerAnd
TerEnableSpeedKey
TerGetBufferGr
TerGetLastMessage
TerGetOutBool
TerGetOutColor
TerGetOutInt
TerGetOutMediaTray
TerGetOutIntArray
TerGetOutStr
TerGetOutObject
TerGetOutRect
TerInsertUserField
TerOr
TerResetLastMessage
TerSetCtlColor
TerSetCustomMessage
TerSetLicenseKey
TerSetUserField
TerUpdateDynField
Page 505
TerAnd
Description: This function is useful in the programming environments which does not
provide a built-in bitwise AND operator.
Return Value: The function returns the bitwise AND value of the input variables.
See Also:
TerOr
Page 506
TerEnableSpeedKey
int CommandId; // Id of the command to set the key for. Here are the list of
command ids and corresponding speed-key combination:
ID_PGUP :Keys.PageUp
ID_PGUP :Keys.PageUp|Keys.Shift
ID_PGDN :Keys.PageDown
ID_PGDN :Keys.PageDown|Keys.Shift
ID_UP :Keys.Up
ID_UP :Keys.Up|Keys.Shift
ID_DOWN :Keys.Down
ID_DOWN :Keys.Down|Keys.Shift
ID_LEFT :Keys.Left
ID_LEFT :Keys.Left|Keys.Shift
ID_RIGHT :Keys.Right
ID_RIGHT :Keys.Right|Keys.Shift
ID_LINE_BEGIN :Keys.Home
ID_LINE_BEGIN :Keys.Home|Keys.Shift
ID_LINE_END :Keys.End
ID_LINE_END :Keys.End|Keys.Shift
ID_CTRL_UP :Keys.Up|Keys.Control
ID_CTRL_UP :Keys.Up|Keys.Control
|Keys.Shift
ID_CTRL_DOWN :Keys.Down|Keys.Control
ID_CTRL_DOWN :Keys.Down|Keys.Control
|Keys.Shift
ID_FILE_BEGIN :Keys.PageUp|Keys.Control
ID_FILE_BEGIN :Keys.PageUp|Keys.Control
Page 507
|Keys.Shift
ID_FILE_BEGIN :Keys.Home|Keys.Control
ID_FILE_BEGIN :Keys.Home|Keys.Control
|Keys.Shift
ID_FILE_END :Keys.PageDown
|Keys.Control
ID_FILE_END :Keys.PageDown
|Keys.Control|Keys.Shift
ID_FILE_END :Keys.End|Keys.Control
ID_FILE_END :Keys.End|Keys.Control
|Keys.Shift
ID_NEXT_WORD :Keys.Right|Keys.Control
ID_NEXT_WORD :Keys.Right|Keys.Control
|Keys.Shift
ID_PREV_WORD :Keys.Left|Keys.Control
ID_PREV_WORD :Keys.Left|Keys.Control
|Keys.Shift
ID_DEL_PREV_WORD:Keys.Back|Keys.Control
ID_DEL :Keys.Delete
ID_BACK_SPACE :Keys.Back
ID_BACK_TAB :Keys.Tab|Keys.Shift
ID_CTRL_TAB :Keys.Tab|Keys.Control
ID_TAB :Keys.Tab
ID_TAB :Keys.T|Keys.Control
ID_HILIGHT_LINE:Keys.F8
ID_SELECT_ALL :Keys.A|Keys.Control
ID_CUT :Keys.X|Keys.Control
ID_CUT :Keys.Delete|Keys.Shift
ID_COPY :Keys.C|Keys.Control
ID_COPY :Keys.Insert|Keys.Control
Page 508
ID_PASTE :Keys.V|Keys.Control
ID_PASTE :Keys.Insert|Keys.Shift
ID_PICT_FROM_FILE:Keys.F8|Keys.Alt
ID_BLOCK_COPY :Keys.C|Keys.Alt
ID_BLOCK_MOVE :Keys.M|Keys.Alt
ID_SEARCH :Keys.F5
ID_SEARCH_FOR :Keys.F|Keys.Control
ID_SEARCH_BACK :Keys.F|Keys.Control
|Keys.Shift
ID_REPLACE :Keys.F6
ID_TER_HELP :Keys.F1
ID_UNDO :Keys.F8|Keys.Shift
ID_UNDO :Keys.Back|Keys.Alt
ID_UNDO :Keys.Z|Keys.Control
ID_REDO :Keys.Y|Keys.Control
ID_INSERT :Keys.Insert
ID_SAVE :Keys.F3
ID_SAVEAS :Keys.F3|Keys.Shift
ID_QUIT :Keys.F3|Keys.Control
ID_PRINT :Keys.F4
ID_PRINT_OPTIONS:Keys.F4|Keys.Shift
ID_JUMP :Keys.F10
ID_CHAR_NORMAL :Keys.D0|Keys.Alt
ID_BOLD_ON :Keys.B|Keys.Control
ID_ULINE_ON :Keys.U|Keys.Control
ID_ULINED_ON :Keys.D|Keys.Control
ID_ITALIC_ON :Keys.I|Keys.Control
ID_HIDDEN_ON :Keys.H|Keys.Control
Page 509
ID_HLINK_ON :Keys.H|Keys.Alt
ID_PROTECT_ON :Keys.D3|Keys.Alt
ID_SUPSCR_ON :Keys.D4|Keys.Alt
ID_SUBSCR_ON :Keys.D5|Keys.Alt
ID_STRIKE_ON :Keys.D6|Keys.Alt
ID_COLOR :Keys.D7|Keys.Alt
ID_FONTS :Keys.F10|Keys.Alt
ID_CENTER :Keys.D8|Keys.Alt
ID_RIGHT_JUSTIFY:Keys.D9|Keys.Alt
ID_LEFT_INDENT :Keys.L|Keys.Alt
ID_RIGHT_INDENT:Keys.R|Keys.Alt
ID_HANGING_INDENT:Keys.T|Keys.Alt
ID_BULLET :Keys.B|Keys.Alt
ID_PARA_NBR :Keys.N|Keys.Alt
ID_EDIT_STYLE :Keys.S|Keys.Alt
ID_CHAR_STYLE :Keys.D1|Keys.Alt
ID_PARA_STYLE :Keys.D2|Keys.Alt
ID_PAGE_BREAK :Keys.Enter|Keys.Control
ID_RETURN :Keys.Enter
ID_RETURN :Keys.Enter|Keys.Shift
ID_NEXT_CHANGE :Keys.N|Keys.Control
ID_PREV_CHANGE :Keys.P|Keys.Control
Return Value: The function returns the previous status of the speed key
Page 510
TerGetBufferGr
Get the handle of the buffer Graphics object.
Graphics TerGetBufferGr()
Return Value: This function returns the intejal buffer Graphics object. This Graphics object
is used intejally to create a temporary image of the screen before actually transferring to
the window. It returns null to indicate an error condition. It can also return null when the
intejal buffer is disabled by using the TerSetFlags function.
Please call the GetTerFields function to retrieve the actual Graphics object of the
editor window.
Page 511
TerGetLastMessage
Get the last message.
int TerGetLastMessageCode();
String TerGetLastMessage();
Return Value: These methods return the last message generated by the editor. The
TerGetLastMessageCode returns the numeric message code, and the TerGetLastMessage
method returns the corresponding message text.
The return value is valid only if saving of the messages is enabled by setting the
TFLAG_RETURN_MSG_ID flag. This flag is set using the TerSetFlags function.
The description for the message codes can be found in the TER_MSG.java file.
See Also:
TerResetLastMessage
Page 512
TerGetOutBool
boolean TerGetOutBool(param)
String param; // The name of the parameter for which to return the boolean value. The value to
pass for this method is specific to individual methods, such as TerGetSectInfo.
Description: Certain methods save a boolean value to a boolean parameter before returning. This boolean value
can be retrieved by using this method right after calling the previous method. Example:
if (TerGetSectInfo(LineNo)) {
// TerGetSectInfo method
Return Value: This method returns a boolean value after a method call.
Page 513
TerGetOutColor
Color TerGetOutColor(param)
String param; // The name of the parameter for which to return the color value. The value to pass
this method is specific to individual methods, such as TerGetTextColor.
Description: Certain methods save a color value to an internal parameter before returning. This color value can be
retrieved using this method right after calling the previous method. Example:
if (TerGetTextColor(FontId)) {
// TerGetTextColor method
Return Value: This method returns a color value after a method call.
Page 514
TerGetOutInt
int TerGetOutInt(param)
String param; // The name of the parameter for which to return the integer value. The value to
pass for this method is specific to individual methods, such as TerGetLineInfo.
Description: Certain methods save an integer value to an internal parameter before returning. This integer value
can be retrieved using this method right after calling the previous method. Example:
if (TerGetLineInfo(LineNo)) {
// TerGetLineInfo method
Return Value: This method returns an integer value after a method call.
Page 515
TerGetOutMediaTray
MediaTray TerGetOutMediaTray(param)
String param; // The name of the parameter for which to return the MediaTray
object. The value to pass for this method is specific to individual
methods.
Description: Certain methods save a MediaTray object to an internal parameter before returning.
This MediaTray can be retrieved using this method right after calling the previous method.
Example:
MediaTray tray=tej.TerGetOutMediaTray("FirstPageBin");
Return Value: This method returns the MediaTray object after a method call.
Page 516
TerGetOutIntArray
int[] TerGetOutIntArray(param)
String param; // The name of the parameter for which to return the integer array.
The value to pass for this method is specific to individual methods,
such as TerGetLine.
Description: Certain methods save an integer array to an internal parameter before returning. This
integer array can be retrieved using this method right after calling the previous method. Example:
if (TerGetLine(LineNo)>0) {
// TerGetLine method
Return Value: This method returns the integer array after a method call.
Page 517
TerGetOutStr
String TerGetOutStr(param)
String param; // The name of the parameter for which to return the string value.
The value to pass for this method is specific to individual methods,
such as TerDocName.
Description: Certain methods save a string value to an internal parameter before returning. This
string value can be retrieved using this method right after calling the previous method. Example:
if (TerDocName(true,"")) {
// TerDocName method
Return Value: This method returns the String value after a method call.
Page 518
TerGetOutObject
Object TerGetOutMediaTray(param)
String param; // The name of the parameter for which to return the Object. The
value to pass for this method is specific to individual methods.
Description: Certain methods save an object to an internal parameter before returning. This Object
can be retrieved using this method right after calling the previous method.
Return Value: This method returns the output Object after a method call.
Page 519
TerGetOutRect
Rectangle TerGetOutRect(param)
String param; // The name of the parameter for which to return the Rectangle
object. The value to pass for this method is specific to individual
methods.
Description: Certain methods save a Rectangle object to an internal parameter before returning.
This Rectangle can be retrieved using this method right after calling the previous method. Example:
Rectangle rect=tej.TerGetOutRect("Rectangle");
Return Value: This method returns the Rectangle object after a method call.
Page 520
See Also
TerSetUserField
TerInsertUserField
Description: This function inserts a dynamic user field. The editor fires an event called
SetUserField when it encounters a user-field in the document as the page is being
rendered. Your application can specify the content of the user field by using the
TerSetUserField function within this event.
The text length of the user field should not exceed one text line. When the user-field is
placed in a header/footer area, the text length of the field should not change from one call
to another.
Page 521
TerOr
Description: This function is useful in the programming environments which does not
provide a built-in bitwise OR operator.
Return Value: The function returns the bitwise OR value of the input variables.
See Also:
TerAnd
Page 522
TerResetLastMessage
Reset the last editor message.
boolean TerResetLastMessage()
Description: This function can be called before calling any other TEJ function to reset the
last error message.
See Also:
TerGetLastMessage
Page 523
TerSetCtlColor
boolean TerSetCtlColor(color,repaint)
Page 524
TerSetCustomMessage
int id; // The message id to set the custom text. The message id
constants (MSG_) are defined in the SubSystems.tc
class. The original English version of the message text is
available in the ter_msg.cs file.
Page 525
TerSetLicenseKey
boolean TerSetLicenseKey(key);
Description: This function should be called before creating any TE control to avoid pop-up
nag screens.
Tej.TerSetLicenseKey("xxxxx-yyyyy-zzzzz")
Return Value: This function returns true if successful. Otherwise it indicates an invalid
license key.
Page 526
See Also
TerInsertUserField
TerSetUserField
Set the text for the user field at the current cursor position.
boolean TerSetUserField(text)
Description: The editor fires an event called SetUserField when it encounters a user-field
in the document as the page is being rendered. Your application can specify the content of
the user field by using the TerSetUserField function within this event.
The text length of the user field should not exceed one text line. When the user-field is
placed in a header/footer area, the text length of the field should not change from one call
to another.
Page 527
TerUpdateDynField
boolean TerUpdateDynField(repaint)
boolean repaint; // Set to TRUE to refresh the screen after the operation.
Return Value: The function returns the previous status of the speed key
Page 528
Control Properties:
Although Java does not employ the term 'property', we use this term here to maintain the conceptual continuity with the
Win32 and .NET versions of this control with which Tej control maintenance a certain level of compatibility
Also, the Tejw applet included with this product does use the concept of property. With each property description below,
you will also find the equivalent Tej class method to set the design-time or run-time properties.
Design-time properties:
Print View: setPrintView(boolean) Edit document in the Print View mode. In this mode the lines
are wrapped as they would be wrapped when printed to the
selected printer (see 'Editing Mode' chapter). (Default: True)
Page Mode: setPageMode(boolean) Edit document one page at a time. This mode is useful when
editing the documents containing multiple columns. (Default:
True)
FittedView: setFittedView(boolean) Special case of the page mode in which the text wraps to the
window width and the soft page breaks are not displayed.
(Default: False)
Vertical Scroll: setVertScrollBar(boolean) Enable the vertical scroll bar. (Default: True)
Horizontal Scroll: setHorzScrollBar(boolean Enable the horizontal scroll bar. (Default: False)
)
Show Status Bar: setShowStatusBar(boolea Show status bar indicating the cursor position. (Default: False)
n)
Show Ruler: setShowRuler(boolean) Show the ruler with tab stops and indentation indicators.
(Default: False)
Border Margin: setBorderMargin(boolean Reserves a think blank area around the text box. (Default:
) True)
Read Only: setReadOnlyMode(boolea The editor displays the text, but modifications are not allowed.
n)
Page 529
TejKey setTejKey(String) The Tej license key. Your license k ey is e-mailed to you after
your order is processed.
(Not applicable to
the
HTML/Javascript
version)
HtmlAddOnKey setHtmlAddOnKey(String) HTML Add-on license key if HTML Add-on is installed. Your
license k ey for HTML Add-on is e-mailed to you after your
order for HTML Add-on is processed.
DictPath setDictPath(String) The directory where the SpellTime dictionary files are copied.
UseWindow setUseWindow(boolean) Set this property to False (window-less operation) when using
the control within an ASP.NET server application. (Default:
True)
FireEvents None This property can be set for a Tejw applet to specify the name
of the events to fire. The event names must be separated by
(Not applicable to the comma character.
the
HTML/Javascript Example:
version)
<param name="FireEvents"
value="ControlCreated,Preprocess">
<script language="javascript">
function ControlCreated() {
ActionId = tej.ID_OPEN) {
Page 530
....
....
</script>
Please refer to the Control Events topic for the list of available
events
Other properties:
Data setData(String) Description: Use this property to assign or retrieve text from
the control. Usage:
control.Data = String or
String = control.Data
Example:
Usage:
control.Command=Command_id
Example:
tej.command = ID_PASTE
or
tej.Command(ID_PASTE)
Page 531
ID_ACCEPT_ALL_CHANGES Accept all modifications
ID_AUTO_SPELL Invoke automatic spell checking. (SpellTime required for this feature)
Page 532
ID_CUT Cut text to clipboard
Page 533
ID_HIDDEN_ON Set the hidden attribute on
ID_HIDE_CHANGES Suppress the track-change display effects for text insertion and
deletion.
Page 534
ID_JUMP Jump to a line number
Page 535
ID_PASTE_SPEC Paste special clipboard formats
ID_PGUP Page up
ID_PROTECT_FORM Toggle the 'form protection' mode. This mode allows the user to input
data into the input fields.
Page 536
ID_SEARCH_BACK Search for the previous text string
ID_SPELL Invoke a spell checking session (SpellTime required for this feature)
ID_TABLE_CELL_VALIGN Set the vertical alignment for the text inside a table cell.
Page 537
ID_TABLE_CELL_VTEXT Set text rotation for a table cell text.
ID_UP Arrow up
ID_USER1 to ID_USER9 Unused command ids to be used with new toolbar icons. It is
generally used to implement functionality not provided by the
existing command ids. For example, you can use ID_USER1 to
implement PDF output icon. You would intercept ID_USER1 using
the PreProcess event and execute your code there. Then call the
TerIgnoreCommand method to tell the editor to ignore this
command.
Page 538
ID_ZOOM Enable Zoom
Page 539
Control Events
Java Version: The simplest method to capture the events from Tej control is to use the TejAdapter class. Please
refer to Creating an Editor Window topic an example of using this class.
As you would notice, these methods use the TejEvent class to pass the parameters. The description for each
event includes the relevant TejEvent fields populated for the event.
HTML/Javascript version: The HTML/Javascript version also supports most of these events. The event must be
Page 540
caught within the ControlCreated function during initialization using the TerSetEvent function. Unlike the Java
version, there is no TejEvent input parameter. Instead, the event parameters are passed to your script directly.
Example:
te1.TerSetEvent("Hypertext",Hypertext);
function PreprocessEvent(obj,ActionType,ActionId) {
function Hypertext(obj,HText,HCode) {
if (HCode.indexOf("http://")==0) window.open(HCode);
Page 541
Action
This event is sent after an user initiated action is completed.
if (ev.ActionType = tej.ACTION_COMMAND
...
Please refer to the the Preprocess event for the description of the ActionType and ActionId
parameters.
Page 542
ControlCreated
This event is sent after the control is fully created and the initial file/data is read
into the control.
....
This event can be used to do the initial setup tasks such as adding or removing toolbar
icons, showing the page borders, etc.
Page 543
Hypertext
This event is sent after the user clicks on a hyperlink.
....
Please note that the hyperlink cursor must be toggled on to display the 'hand' cursor:
if (!tej.TerMenuSelect2(tej.ID_SHOW_HYPERLINK_CURSOR))
tej.TerCommand(tej.ID_SHOW_HYPERLINK_CURSOR)
Page 544
MergeData
This event is sent to prompt your application for the data for a merge field.
....
This event may be called when using the TerMergeFields function. Normally, you would
provide the field name and field data array to the TerMergeFields function. This event is fired
when the editor finds a field name in the document which is not included in the field-name
array provide to the TerMergeFields function. Your application can then provide the data for
the field within this event.
The 'name' parameter indicates the field name for which the data is sought.
You would use the 'data' parameter to pass the field data for the given field.
This event should return true if data is available for the specified field. Otherwise, it should
return a false value.
Please also refer to the Mail/Merge Support chapter for further information.
Page 545
Modified
This event is sent when the text is modified.
....
Page 546
OpenFile
This event is sent after a new file is read into the control.
....
This event can be used to update the file name on your application's title bar.
Page 547
PageCount
This event is sent when page count changes as text is added or removed.
Page 548
PageSizeChanging
This event is sent before TE adjusts the page size.
....
int NewPageSize;
This event is fired only when the TFLAG5_VARIABLE_PAGE_SIZE flag is set. When this
flag is set, TE calculates the new page size to contain the entire content of the control.
Then the control fires this event to allow your application to override or modified the
suggested page size. The page size is provided by the 'NewPageSize' parameter in the
twips unit. You can set the 'NewPageSize' parameter to 0 to disable the current page
adjustment. You can also set it to another value to make the page bigger than the
suggested size. However, you can not set this parameter to a lower value because TE
needs to display the entire content on one page.
Page 549
PostPaint
This event is sent after TE draw the text area.
....
Page 550
Preprocess
if (ev.ActionType = tej.ACTION_COMMAND
...
ACTION_COMMAND: This action indicates any of the menu or the accelerator key
generated commands. The actual command id is given by
the ActionId argument. For a list of command ids, please
refer to the 'command' property in the Control Properties
chapter.
ACTION_VSCROLL: This action message is sent when the vertical scroll bar is
clicked. The ActionId argument for this message identifies
the actual scrollbar operation and is given by the SB_xxxxx
SDK constants.
ACTION_HSCROLL This action message is sent when the horizontal scroll bar is
clicked. The ActionId argument for this message identifies
the actual scrollbar operation and is given by the SB_xxxxx
SDK constants.
ACTION_LBUTTONDOW Left mouse button down. The ActionId contains the x and y
Page 551
N mouse position in the pixel units. The x position is given by
the low 16 bits and the y position is given by the high 16 bits.
ACTION_RBUTTONDO Right mouse button down. The ActionId parameter holds the
WN: mouse position as described for the
ACTION_LBUTTONDOWN message.
ACTION_LBUTTONUP: Left mouse button up. The ActionId parameter holds the
mouse position as described for the
ACTION_LBUTTONDOWN message.
ACTION_RBUTTONUP: Right mouse button up. The ActionId parameter holds the
mouse position as described for the
ACTION_LBUTTONDOWN message.
ACTION_LBUTTONDBL Left mouse double click. The ActionId parameter holds the
CLICK: mouse position as described for the
ACTION_LBUTTONDOWN message.
ACTION_RBUTTONDBL Right mouse double click. The ActionId parameter holds the
CLICK: mouse position as described for the
ACTION_LBUTTONDOWN message.
ACTION_QUERYENDSE This message is sent before asking the user to end the
SSION editing session.
ACTION_STYLE This message is sent when the user selects a different style
from the style combo-box. The ActionId specifies the
selected style id.
Page 552
ReplaceLastWord
This event is fired during keyboard text entry after the user completes a word. It lets you
provide a replacement word for the word just entered.
ev.replace=true;
ev.NewText="";
else ev.replace=false;
just completed.
Page 553
SetUserField
This event is fired when a user-field is encountered when the text is being
rendered.
....
This event uses two arguments. The PageNo argument specifies the page number (zero
based) where the user-field was encountered. The TextPos argument provides the absolute
text position of the field. The absolute text position can be converted into the line/column
position using the TerAbsToRowCol method.
Typically your application would set the text value of the current user field when this event
is encountered. The text for the field is set using the TerSetUserField method.
Page 554
SpellWordReplaced
This event is fired when the spell-checker replaces a misspelled word.
....
The 'CharPos' parameter indicates the character position of the replaced word. You can use the
TerAbsToRowCol method to convert the character position to a line/column value.
Page 555
UpdateStatusbar
This event is sent when an external status bar needs to be repainted.
....
Page 556
UpdateToolbar
This event is sent when an external toolbar needs to be repainted.
....
Page 557
CreateEmbeddedControl
This event is sent when an embedded control is encountered during RTF input.
JComponent ctl=null;
if (ev.ClassName.equals("TextBox")) {
if (id==1) tb.setText("Name");
else tb.setText("Address");
return (Component)tb;
String ClassName;
int id;
Your application would use the event to recreate the embedded control which was originally
inserted into the input RTF file using the TerInsertControl method. The value of the 'id'
parameter is the same the 'id' parameter value specified when calling the TerInsertControl
method.
Tej control already incluses a built-in support for these components: JTextArea,
JCheckBox, JComboBox, JButton, JRadioButton, and JLabel. This event is needed to
support additional component classes.
Page 558
Tejw Applet
This package includes a Tejw applet which can be inserted into your web page. The operating system must
support standard Java to be able to use this applet.
If you are using ASP.NET, then please follow the ASP.NET Interface topic for the relevant instructions.
You can also insert the applet into the html page by simply using the <applet> tag. Here is an example:
style="border-width:0px; border-style:none;
height:416px;width:755px;Z-INDEX: 2;
<Param name="WordWrap"value=True>
<Param name="PageMode"value=True>
<Param name="PrintViewMode"value=True>
<Param name="FittedView"value=False>
<Param name="ShowStatusBar"value=True>
<Param name="ShowRuler"value=True>
<Param name="ShowVertRuler"value=True>
<Param name="ShowToolBar"value=True>
<Param name="BorderMargin"value=False>
<Param name="RTFOutput"value=True>
<Param name="ReadOnlyMode"value=False>
<Param name="VertScrollBar"value=True>
<Param name="HorzScrollBar"value=True>
<Param name="InWebPage"value=True>
</applet>
Please refer to the included WebEdit.zip file for a demo using the applet tag in an html page.
Page 559
Page 560
ASP.NET Interface
The ASP.NET wrapper allows you to drop a TE Edit Control into your ASP.NET page.
The ASP.NET wrapper dll for HTML/Javascript is named WebTeh, whereas the ASP.NET
wrapper for the Java version is named WebTej. Please refer to one of the following two
topics depending upon the platform version of the editor control you are using.
In This Chapter
TE Edit Control for HTML/Javascript
TE Edit Control for Java - Applet
Page 561
TE Edit Control for HTML/Javascript
This section describes the ASP.NET wrapper for TE Edit Control for HTML/Javascript
If you are using TE Edit Control for Java (applet), then please refer the subsequent
chapter.
The ASP.NET wrapper for TE Edit Control for HTML/Javascript is contained in a dll called
WebTeh.dll.
You can drop a WebTeh object as you design a web page in Visual Studio. As the page
is loaded on the client machine, the resulting html page will include an 'canvas' tag to
contain the edit control.
In This Chapter
Demo Application
WebTeh Control
WebTeh Control Propeties
Teh Control Events
Page 562
Demo Application
DmoTeh application included with the product shows the usage of the WebTeh and TE Edit
for HTML/Javascript component.
To run the demo application, please unzip the dmo_web_teh.zip file to a folder under the
c:\Inetpub\wwwroot directory. Let us say for example that you would unzip this file in the
following directory:
c:\Inetpub\wwwroot\demo
Now copy the WebTeh.dll file from the demo directory to the c:\Inetpub\wwwroot\demo\bin
directory.
Also copy the tejh24.js, ter_hlp.pdf, ter_tlb.gif and wait.gif files to the
c:\Inetpub\wwwroot\demo directory (not the bin directory) These files include the code and
the support files for the editor. These files gets downloaded by the browser as the client
page shows the editor control.
Now you can access the demo from the client machine:
http://www.myserver.com/demo
You can also access the demo application from your own machine:
http://localhost/demo
Page 563
WebTeh Control
WebTeh.dll control is a simple drop-in control to be used within an ASP.NET web application.
This dll is included in the demo_web_teh.zip file. Please unzip this file and copy the WebTeh.dll file to the
c:\Inetpub\wwwroot\bin directory.
To use the WebTeh.dll in a web application, create a new web application (or open an existing one) and
right click on the 'Web Forms' tab in the Toolbox. Now select the 'Add/Remove new items...' and add the
WebTeh.dll control. Now the control will be available for selection in the toolbox.
Now you can select and drop an instances of the WebTeh control on your web application page. The
control properties should be set in the PageLoaded method of your ASP.NET app:
WebTeh1.Left = 25;
WebTeh1.Top = 40;
WebTeh1.Width = 800;
WebTeh1.Height = 410;
The WebTeh control generates the 'canvas' tag to host the TE edit control in the web page. Here is an
example of the 'canvas' tag generated by this control:
<script src="terh28.js"></script>
data-word-wrap="true"
data-page-mode="true"
data-print-view-mode="true"
data-fitted-view="false"
data-show-menu="true"
data-show-status-bar="true"
data-show-ruler="true"
data-show-vert-ruler="true"
data-show-tool-bar="true"
Page 564
data-border-margin="true"
data-rtf-output="true"
data-read-only-mode="false"
data-vert-scroll-bar="true"
data-horz-scroll-bar="true"
data-spell-time-dict-path=""
</canvas>
The terh28.js, ter_hlp.pdf, ter_tlb.gif and wait.gif files must be copied to the application directory for the
page to be loaded properly.
The License Key delivered must be copied to a file and placed in your project folder as described in your
order delivery e-mail.
Page 565
WebTeh Control Propeties
There are some common properties between the Teh and WebTeh controls. There
properties include: WordWrap, PageMode, PrintViewMode, FittedView,
ShowStatusBar, BorderMargin, ShowRuler, ShowToolBar, ReadOnlyMode, VertScrollBar,
HorzScrollBar, and Data. Please refer to the Control Properties section for a description
of these common properties.
The control properties should be set in the PageLoaded method of your ASP.NET app:
WebTeh1.Left = 25;
WebTeh1.Top = 40;
WebTeh1.Width = 800;
WebTeh1.Height = 410;
Page 566
Teh Control Events
WebTeh control does not support any server-side events. However, WehTeh automatically generates a call to the
ControlCreated function so as to provide an opportunity to perform further initialization. So your web page must
include a Control Created function to catch this event. You would add code for further initialization and code to
catch other events within this function. Here is an example:
<script>
tej = WebTej;
console.log("Page is loaded!");
tej.TerAddToolbarIcon(0,0,tc.ID_SUPSCR_ON,
"images/icon1.bmp","superscript");
tej.TerAddToolbarIcon(0,0,tc.ID_SUBSCR_ON,
"images/icon2.bmp","subscript");
tej.TerRecreateToolbar(true);
tej1.TerSetEvent("Preprocess",PreprocessEvent); // an example of
tej1.TerSetEvent("Hypertext",Hypertext);
Page 567
</script>
In addition, you can catch all the events support by the Teh Control.
The embedded Teh control fires the regular events within the WebPage. A full description of the available event
names and corresponding input parameter can be found in the Control Events topic.
Please see the example above to catch the Preprocess and Hypertext event. The first parameter specifies the
name of the event to catch, and the second parameter specify the function to call. So, you would define two script
function to resolve the references to the PreprocessEvent and Hypertext event. Example:
<script>
function PreprocessEvent(obj, ActionType, ActionId) {
ActionType,"id: ",ActionId);
function Hypertext(obj,HText,HCode) {
if (HCode.indexOf("http://")==0) window.open(HCode);
</script>
In the examples above, WebTej refers the 'canvas' hosting the Teh control.
Please refer to the included Default.aspx and terh.htm files for a complete example.
Page 568
TE Edit Control for Java - Applet
This section describes the ASP.NET wrapper for TE Edit Control for Java.
If you are using TE Edit Control for HTML/Javascript, then please refer the subsequent
chapter.
The ASP.NET wrapper for TE Edit Control for Java is contained in a dll called WebTej.dll.
You can drop a WebTej object as you design a web page in Visual Studio. As the page
is loaded on the client machine, the resulting html page will include an 'applet' tag which
refers to the Tej control.
In This Chapter
Demo Application
WebTej Control
WebTej Control Properties
WebTej Control Events
Page 569
Demo Application
DmoTej application included with the product shows the usage of the WebTej and Tej
component.
To run the demo application, please unzip the dmo_web_tej.zip file to a folder under the
c:\Inetpub\wwwroot directory. Let us say for example that you would unzip this file in the
following directory:
c:\Inetpub\wwwroot\demo
Now copy the WebTej.dll file from the demo directory to the c:\Inetpub\wwwroot\demo\bin
directory.
Also copy the tej28.jar and tej28.jar.pack.gz files to the c:\Inetpub\wwwroot\demo directory
(not the bin directory)
Now you can access the demo from the client machine:
http://www.myserver.com/demo/DmoTej.aspx
You can also access the demo application from your own machine:
http://localhost/demo/DmoTej.aspx
Page 570
WebTej Control
WebTej.dll control is a simple drop-in control to be used within an ASP.NET web application.
This dll is included in the demo_web_tej.zip file. Please unzip this file and copy the WebTej.dll file to the
c:\Inetpub\wwwroot\bin directory.
To use the WebTej.dll in a web application, create a new web application (or open an existing one) and
right click on the 'Web Forms' tab in the Toolbox. Now select the 'Add/Remove new items...' and add the
WebTej.dll control. Now the control will be available for selection in the toolbox.
Now you can select and drop an instances of the WebTej control on your web application page. Right
click on the control to set the control properties as desired.
The WebTej control generates the 'applet' tag to host the Tej edit control in the web page. Here is an
example of the 'applet' tag generated by this control:
top: 0px">
<Param name="WordWrap"value=True>
<Param name="PageMode"value=True>
<Param name="PrintViewMode"value=True>
<Param name="FittedView"value=False>
<Param name="ShowMenu"value=True>
<Param name="ShowStatusBar"value=True>
<Param name="ShowRuler"value=True>
<Param name="ShowVertRuler"value=True>
<Param name="ShowToolBar"value=True>
<Param name="BorderMargin"value=True>
<Param name="RTFOutput"value=True>
Page 571
<Param name="ReadOnlyMode"value=False>
<Param name="VertScrollBar"value=True>
<Param name="HorzScrollBar"value=True>
<Param name="InWeb"value=True>
</applet>
The tej28.jar file must be copied to the application directory for the page to be loaded properly.
Your license keys must be assigned to the TejKey property using the property box. This control requires a
Server license (not a Desktop license).
Page 572
WebTej Control Properties
There are some common properties between the Tej and WebTej controls. There properties
include: WordWrap, PageMode, PrintViewMode, FittedView, ShowStatusBar,
BorderMargin, ShowRuler, ShowToolBar, ReadOnlyMode, VertScrollBar, HorzScrollBar,
TejKey, and Data. Please refer to the Tej Control Properties section for a description of
these common properties.
In addition to the common properties listed above, the WebTej control supports the
following new properties:
HtnKey The license key for the HTML Add-on product, if HTML
Add-on is installed.
DictPath The name of the folder on the client machine which contains
the SpellTime dictionary files.
Page 573
WebTej Control Events
WebTej control does not support any server-side events.
The embedded Tej control fires the regular events within the WebPage. The names of the events to handle is
specified using the FireEvents property. You can set this property using the property-box in VisualStudio. A full
description of the available event names and corresponding input parameter can be found in the Control Events
topic.
For example, if you set the FireEvents property to "ControlCreated,Preprocess", the following property statement
would be created in the page generated by IIS:
You would also need to include the corresponding function definition in your html page:
<SCRIPT type="text/javascript">
<!--
function ControlCreated()
// events
tej.TerAddToolbarIcon(0,0,tej.ID_SUPSCR_ON,
"http://localhost/DmoTej/images/icon1.bmp","superscript");
tej.TerAddToolbarIcon(0,0,tej.ID_SUBSCR_ON,
"http://localhost/DmoTej/images/icon2.bmp","subscript");
tej.TerRecreateToolbar(true);
Page 574
// Alt+1 keycommand
// this command
//-->
</SCRIPT>
In the examples above, WebTej1 refers the the 'object' hosting the Tej control.
Page 575
Mail/Merge Support
The product supports two kinds of mail-merge fields.
First, the RTF type of mail-merge is created using the TerInsertField function, and
populated using the TerChangeField function for each field in the document. The
TerLocateField function is used to locate the RTF type of fields in the document. The
advantage of using the RTF type of mail-merge field is that the field-name is stored
separately from the field-data. Therefore, when the data is applied to the field using the
TerChangeField field, you can still use the field-name to locate the field again. Click here
for the detail description of these Mail-merge functions.
The second type of fields are created by simply typing the field name and then underlining
it. Please refer to the merge.rtf file for an example. The advantage of using this type of
fields is that you can merge all fields in one call to the TerMergeFields function. The
second advantage is that you are able to do merge and print as one step without opening a
TE window using the TerMergePrint or TerMergePrintVB functions. In this topic we will
explore this simple type of mail merge operation.
The simple mail/merge method consists of two components. The first component involves
the user who creates a document containing the data field names. The second component
is your application which calls the mail/merge print API to print a mail/merge document
replacing the field names with field data.
Printing a Mail/Merge Document: A mail merge document must be printed within your
program's control. (The 'Print' option in the 'File' menu can not be used to print a
mail/merge document).
Your program initiates a mail/merge printing by using the 'TerMergePrint' function. Please
refer to the 'Application Interface Functions' chapter for the complete description of this
function.
Your application passes the print specification to the 'TerMergePrint' function using the
'TejPrint' class variable. The 'TerMergePrint' function is called for each record that you wish
to merge and print in the document. The following two member variables within the 'TejPrint'
class are used for supplying data for the field names:
MergeFields: This field specifies the variable to a list of mail merge field names. Each field
name must be separated by a '|' character. The list must be terminated by a null character.
If you do not wish to merge field data, set this field to null.
MergeData: This field specifies the variable to a list of mail merge data strings. Each data
String must be separated by a '|' character. The number of data elements in the
'MergeData' array MUST be the same as the number of elements in the 'MergeFields' array.
Page 576
The list must be terminated by a null character. If you do not wish to merge field data, set
this field to null.
Example:
MergeFields="name|address|city|st|zip";
The 'TerMergePrint' function scans the document to extract the field names. If a field name
is found in the 'MergeFields' array, the corresponding String in the 'MergeData' is used to
replace the field name with the data String in the document.
If the field name is not found in the 'MergeFields' array, the 'TerMergePrint' function sends a
MergeData event to your application.
data="";
if (name=="date") {
data=DateTime.Today.Date.ToString();
return true;
return false;
This example returns today's date as a data String for the 'date' field. Please also refer to
the MergeData event for further information.
Page 577
Hyperlink Hooks
The editor provides the hooks to implement hyperlink facility.
Activation When the user double clicks on the text formatted with the double underline attribute,
the editor sends a Hypertext event to the parent window. The hyperlink text format can
be changed from double underline to any format of your choice by using the following
code.
GetTerFields(out field)
field.LinkStyle = style-constant
field.LinkColor = color
tej1.SetTerFields(field)
For a list of character styles, please refer to the SetTerCharStyle function. A special
style-constant called HLINK is also available. This style does not have any visible
attribute, but it allows the hyperlink text to have any mix of fonts and colors.
Event Example:
TejHyperlink link)
MessageBox.Show(link.text,link.code,
MessageBoxButtons.OK);
link.used=true;
Page 578
public boolean used; // the host sets it to true if
it
};
The 'text' member variable stores the text formatted with the double underline attribute.
The 'code' member variable stores the 'hidden' text found immediately before the link
text.
Your application should set the 'used' variable to a true value if it processes this
message. Otherwise it should return a false value.
Page 579
Editing Modes
Text Mode:
The text mode is initiated when the editor is called with word wrapping turned off. This
mode is most suitable for editing the text files such as computer programs and batch files.
In this mode, the lines are not wrapped automatically. This mode does not offer the
paragraph formatting features.
This mode is initiated when the routine is called with the word wrapping turned on. In this
mode, the text in a window is automatically formatted to wrap at the end of the line.
Therefore the complete line of text is always visible regardless of the window width. A
special character 'ParaChar' is used to delimit a paragraph. This character is not displayed
on the screen. Additionally, you have an option of suppressing this character when the file
is written out to the disk.
This mode also allows the character and paragraph formatting features.
This mode is initiated when the editor is called with both the Word Wrap and the Print View
flags turned on. In this mode, the text lines are wrapped as they would be wrapped when
printed to the selected printer. The horizontal scrolling is automatically provided when the
text goes beyond the current width of the window. This mode offers all the features of the
Word Wrap Mode. In addition, it provide automatic repagination. This mode also allows for
sections with multiple columns.
Page Mode:
This mode is initiated when the editor is called with both the Word Wrap and the Page
Mode flags turned on. As in the Print View mode, the text lines are wrapped as they would
be wrapped when printed to the selected printer. In this mode, however, the editor displays
one page at a time. This mode is most useful for the documents containing multiple
columns, as the columns are displayed side by side. In addition, this mode provides all the
features of the Print View mode
FittedView:
This is a special case of the page mode in which the text wraps to the window width and
the soft page breaks are not displayed
Page 580
Text Editor Commands
This chapter describes the editor commands by menu groups.
In This Chapter
How To Scroll Through The Text
File and Print Commands
Line Edit Commands
Block Edit Commands
Clipboard Commands
Picture Commands
Character Formatting Commands
Paragraph Formatting Commands
Paragraph Spacing, Borders and Shading
Tab Support
Page Break and Repagination
Page Header/Footer, Bookmark and Footnote
Commands
Table Commands
Section and Columns
Stylesheet and Table-of-contents
Text/Picture Frame and Drawing Objects
View Options
Navigation Commands
Search/Replace Commands
Highlighting Commands
Page 581
How To Scroll Through The Text
Keyboard:
Use Up, Down, Left and Right arrow keys to scroll up or down a line, or left or right one
character.
. Hit the Home key to position at the beginning of the current line.
Hit the End key to position at the end of the current line.
Hit Ctrl - Up arrow key to position at the first column of the current line (if not already on the
first column) or at the first column of the previous line.
Hit Ctrl - Down arrow key to position at the first column of the next line.
Hit the F10 key and type in the line number to jump to. This function is also available from
the Navigation menu.
Mouse:
You can click mouse on the vertical and horizontal scroll bar to accomplish various
scrolling function. These functions are available only if the horizontal or the vertical bar has
been enabled by the startup parameters:
Vertical Scroll Bar: Click the mouse on the arrows on either end to scroll the screen up or
down by one line. Click the mouse above the elevator to scroll the screen up by one page.
Similarly, click the mouse below the elevator to scroll the screen down by one page. You
may also drag the elevator to any position in the bar. As the elevator is dragged, the editor
will scroll the screen up or down accordingly to maintain the correct cursor position.
Horizontal Scroll Bar: Click the mouse on the arrows on either end to scroll the screen left
or right by one line. Click the mouse on either side of the elevator to scroll the screen left or
right by 1/2 screen. You may also drag the elevator to any position in the bar. As the
elevator is dragged, the editor will scroll the screen left or right accordingly to maintain the
correct cursor position.
Page 582
File and Print Commands
New File This function is used to clear the existing text from the edit window and start an
empty, unnamed document. The user is prompted to save any modification to the
previous document.
Open File This function is used to clear the exiting text from the edit window and open a
new document. The user is prompted to save any modification to the previous
document.
Save File Use this selection to save the text to the current file name. If a file is not yet
specified, the editor will prompt you for a file name. If a file with the same name
already exists on the disk, the editor will save the previous file with a backup
extension (.TE).
If the I/O is conducted through a buffer rather than a disk file, the editor creates a
new buffer with the updated text.
You can invoke this function by hitting the F3 function key (or select the option
from the menu).
Save File As.. This selection is similar to Save File. In addition, it allows you to specify a new
file name for saving the text.
This option is not available when the I/O is conducted through a buffer rather than
a disk file.
You can invoke this function by hitting the Shift F3 function keys together (or
select the option from the menu)
Exit Use this function to exit from the editor session. If the current file is modified, you
will have an option to save the modifications.
You can invoke this function by hitting the Ctrl F3 function keys together (or
select the option from the menu).
Print Use this option to print the contents of the current file. You may also choose to
print only the selected part of the file. To print a block of text, the desired text
must be highlighted before invoking the print function. This command supports
these highlighted blocks:
Line Block
Character Block
The print function will print on a default printer selected from the Windows' control
panel. You can alter the printer setup or Page Layout prior to invoking the print
option.
You can invoke the printing function by hitting the F4 function key (or select the
option from the menu). The editor will display a dialog box where you can select
the scope of the printing.
Page Layout Use this option before selecting the Print option to specify the page layout. You
can specify margin (left, right, top and bottom) in inches.
Page 583
You can invoke this function by hitting the Ctrl F4 function keys together (or
select the option from the menu).
Printer Setup This option invokes a printer specific dialog box for the default printer (the default
printer selection is made from the control panel of Windows) You select the
parameters from a set of printer specific options. These options include page
size, page orientation, resolution, fonts, etc.
You can invoke this function by hitting the Shift F4 function keys together (or
select the option from the menu).
Print Preview This option is used to preview the document before printing. The editor displays
up to 2 pages at a time. You can scroll to a different page by using the
PgUp/PgDn or the scroll bar.
By default the preview rectangle is sized to fit the current window. However, you
can use the zoom option to enlarge or shrink the preview rectangle as you wish.
Page 584
Line Edit Commands
Insert After Current In the text mode this function creates a blank line after the current line. Hit
Line the F9 function key to insert a line after the current line.
Insert Before Current In the text mode this function creates a blank line before the current line.
Line Hit the Ctrl F5 keys together to insert a line before the current line.
Delete Line Use this function to delete the current line. The remaining lines will be
scrolled up by one line. Hit the Shift F9 keys together to delete the current
line.
Join Lines In the text mode this function joins the next line at the end of the current
line. Hit the Alt J keys together to invoke this function.
Split Line In the text mode this function splits the current line at the current cursor
position. Hit the Alt S keys together to invoke this function.
Page 585
Block Edit Commands
Copy a Line Block Use this command to copy a highlighted block of text lines from one
location to another. This command provides a short alternative to using
clipboard copy/paste functions.
Highlight the lines of text to be copied, move the caret to the target
location and hit Alt C (or select the option from the menu). This function
does not delete the original block.
Move a Line Block Use this command to move a highlighted block of text lines from one
location to another. This command provides a short alternative to using
clipboard cut/paste functions.
Highlight a block of text to be moved, move the caret to the target location
and hit Alt M (or select the option from the menu). This function deletes
the original block.
Undo Previous Edit The editor remembers your last edit command. You can use this function
to undo the last edit command.
You can invoke this function by hitting the Shift F8 keys together (or select
the option from the menu). The editor will display a dialog box containing
the information about the edit command to be undone. The dialog box
displays the line number, column position, type of undo (delete/insert/edit)
and the contents of the undo buffer. You may modify the target line
number or column position. Confirm the operation by clicking on the OK
button.
This undo feature is not available for column block edits, block move and
replace String commands.
Redo Previous Undo This command reverses the previous undo operation.
Page 586
Clipboard Commands
Cut/Copy Text To Use this command to cut or copy a highlighted block of text to the
Clipboard clipboard. This function also copies the associated formatting information
using the RTF format and the native TEJ format.
Highlight a block of text to be copied to the clipboard and hit the Ctrl+X
(cut) or Ctrl+C (copy) keys, or select the option from the menu.
Paste Text From Use this command to paste the contents of the clipboard at the current
Clipboard caret location. The formatting information, if available, is also copied.
You can invoke this function by hitting the Ctrl+V keys together (or select
the option from the menu).
Paste Special Objects This function displays the clipboard data in a number of available formats:
Native Object Format If available this is the first format in the list box. The data in this format can
be later edited (by double clicking the object) using the original application.
This data can be embedded into your application by using the Paste
option, or you can create a link to the original file by using the Paste Link
option.
Formatted Text This is one of the text formats. This option offers the most suitable format if
the data is pasted by another text output application as the font and
formatting attributes are reproduced accurately.
Unformatted Text This is another text format. This option pastes the text without retaining
the formatting information.
Picture Format The data is available in the Picture format. This object can be later edited
(by double clicking the object) using the Microsofts MS Draw application.
This format is preferred over the bitmap and the device independent bitmap
formats.
Device Independent The data is available in the bitmap formats. The object can be later edited
and regular bitmap (by double clicking the object) using the Microsofts MS Draw application.
formats The editor converts these formats into the Picture format before calling the
drawing application.
Page 587
Picture Commands
Embed Picture Use this command to embed a picture bitmap or metafile from a disk file at
the current caret location. The embedded picture is saved within the
document.
Link Picture Use this command to link a picture bitmap or metafile to the document.
The linked picture appears at the current caret location. A linked picture
data is not saved with the document, only its name is store with the
document.
Edit Picture Use this command to change the width and height of a picture located at
the current caret position. The width and height is specified in inches. This
function also allows you to align (top, bottom, or middle) the picture relative
to the base line of the text.
Drag/Drop Function This is a method of inserting a file object into the text directly. To insert a
file, open the Windows File Manager and locate the file to be inserted. Now
click the mouse and keep the mouse button depressed as you move the
mouse cursor to the editor window. Release the mouse button at the
location where the object should be inserted. The editor shows an icon to
indicate the inserted object. You can edit this object by double clicked at
the icon.
The object inserted using this method makes use of Microsofts Packager
application to tie the file with the application that originally created it.
Background Picture This option, available from the 'Other' menu, is used to set a background
picture for the text. The background picture occupies the entire text area.
The picture file can be a Windows' bitmap (.BMP) or Metafile (.WMF).
Page 588
Character Formatting Commands
Character Styles The following character style commands are available:
Normal Alt 0
Underlining Ctrl U
Italic Ctrl I
Superscript Alt 4
Subscript Alt 5
Strike Alt 6
Character style options allows you to apply one or more style formats to
the current character or to all characters in a highlighted block of text.
TEJ allows multiple formats for a character. To apply more that one format,
repeat the procedure described in the previous paragraphs.
To reset all character formats, highlight the characters and select the
'Normal' option from the menu, or hit the Alt 0 keystroke.
Fonts Use this option to change the font typeface and point size of the current
character or of all characters in a highlighted block of text.
If you wish to change the font for a highlighted block of text, highlight the
block using the Line or Character highlight function. If you wish to change
the font of a single character, simply position the cursor on that character.
Now select the font option from the menu or hit the Alt F10 keys together.
A dialog box will appear that shows the list of typefaces and point sizes to
select from. Make the desired selection now.
Colors Use this selection to change the text color of the current character or of all
characters in a highlighted block of text.
If you wish to change the color of a highlighted block of text, highlight the
block using the Line or Character highlight function. If you wish to change
the color of a single character, simply position the cursor on that
character. Now select the color option from the menu. A dialog box will
appear that shows the color selection. Make the desired selection now.
Page 589
Hidden Text The text formatted with this attribute are treated as hidden text. Normally
the hidden text, as the name implies, does not appear on the screen or
printer. However you can display the hidden text by selecting the 'Show
Hidden Text' option from the 'View' menu.
Protected Text The text formatted with this attribute are protected from the editing
changes. The protected text appear with a light shade in the window. This
function is available only when the 'protection lock' is turned off. The
'protection lock' can be turned off by using an option from the 'Other' menu.
Page 590
Paragraph Formatting Commands
Reset Paragraph Use this selection to reset all paragraph formats for the current paragraph
Format or for all lines in a highlighted block of text.
To reset the paragraph formats for the current paragraph, simply hit the Alt
P keys together (or select the option from the menu). To reset the formats
for a block of lines, highlight a block and hit the Alt P Keys together (or
select the option from the menu).
Paragraph Centering Use this selection to center all lines in the current paragraph or all lines in
a highlighted block of text.
To center the current paragraph, simply hit the Alt 8 keys together (or
select the option from the menu). To center a block of lines, highlight a
block of text and hit the Alt 8 Keys together (or select the option from the
menu).
Paragraph Right Use this selection to right justify all lines in the current paragraph or all
Justification lines in a highlighted block of text.
To right justify the current paragraph, simply hit the Alt 9 keys together (or
select the option from the menu). To right justify a block of lines, highlight
a block of text and hit the Alt 9 Keys together (or select the option from
the menu).
Paragraph Justification Use this selection to justify the text on both left and right margins.
To justify the current paragraph, simply select the option from the
paragraph menu. To justify a block of lines, highlight a block of text and
then select this option from the menu.
Paragraph Double Use this selection to double space all lines in the current paragraph or all
Spacing lines in a highlighted block of text. A double spaced paragraph has a blank
line between each text line.
To double space the current paragraph, simply hit the Alt O keys together
(or select the option from the menu). To double space a block of lines,
highlight a block of text and hit the Alt O Keys together (or select the
option from the menu)
Paragraph Indentation Use this selection to create a left indentation for all lines in the current
(Left) paragraph or for all lines in a highlighted block of text. The successive use
of this option increases the amount of left indentation.
To apply the left indentation to the current paragraph, simply hit the Alt L
keys together (or select the option from the menu). To apply the left
indentation to a block of lines, highlight a block of text and hit the Alt L
Keys together (or select the option from the menu).
To create the left indentation using the mouse, click the left mouse button
on the indentation symbol on the lower left end of the ruler. While the
mouse button is depressed, drag the mouse to the desired location and
release the mouse button. The indentation created using this method is
applicable to every line in the paragraph except the first line.
Page 591
Paragraph Indentation Use this selection to create a right indentation for all lines in the current
(Right) paragraph or for all lines in a highlighted block of text. The successive use
of this option increases the amount of right indentation.
To apply the right indentation to the current paragraph, simply hit the Alt R
keys together (or select the option from the menu). To apply the right
indentation to a block of lines, highlight a block of text and hit the Alt R
Keys together (or select the option from the menu).
To create the right indentation using the mouse, click the left mouse
button on the indentation symbol on the lower right end of the ruler. While
the mouse button is depressed, drag the mouse to the desired location
and release the mouse button.
Paragraph Hanging This option is similar to paragraph left indentation, except that the
Indentation indentation is not applied to the first line of the paragraph.
To apply the hanging indentation to the current paragraph, simply hit the
Alt T keys together (or select the option from the menu). To apply the left
indentation to a block of lines, highlight a block of text and hit the Alt T
Keys together (or select the option from the menu).
To create the hanging indentation using the mouse, click the left mouse
button on the indentation symbol on the upper left end of the ruler. While
the mouse button is depressed, drag the mouse to the desired location
and release the mouse button.
Paragraph Keep When this attribute is turned on for a paragraph, the editor attempts to
Together keep all lines within the paragraph on the same page.
Paragraph Keep with When this attribute is turned on for a paragraph, the editor attempts to
Next keep the last line of the current paragraph and the first line of the next
paragraph on the same page.
Widow/Orphan Control When this attribute is turned on for a paragraph, the editor attempts to
avoid widow/orphan paragraphs. An 'orphan' paragraph results when the
last line of the paragraph lies on the next page. A 'widow' paragraph results
when the first line of the paragraph lies on the previous page
Page 592
Paragraph Spacing, Borders and Shading
This functionality is provided by two options in the paragraph menu, one to set the Border
and Shading parameters and the other to set the spacing parameters for a paragraph.
The 'Paragraph Spacing' menu option allows you to set the space before and after the
paragraph. You can also specify the mininum space between the paragraph lines. All
space parameters are specified in points.
The 'Border and Shading' option in the paragraph menu allows you to create the
paragraph borders and set the shading amount for the paragraph. You can draw all four
sides of the border, or you can draw only the selected sides. Additional two options allow
you to select a thick and double lined border.
When two or more contiguous paragraphs have identical paragraph formatting parameters,
a single border is drawn to enclose all such contiguous paragraphs.
The top line of the border is placed beneath the top of the first line. The bottom line of the
border is placed above the bottom of the last line. Create a blank line at the top and bottom
if you need additional clearance at the top or bottom. The left line of the border is placed
before the left indentation for the paragraph. Therefore, the left side may not be visible for
the paragraph with no left indentation. The right line of the border is placed after the right
indentation. Therefore, the right side may not be visible for the paragraph where the right
margin extends up to or beyond the width of the window.
Page 593
Tab Support
TE Editor supports left, right, center, and decimal tab stops. The tab stops are very useful
for creating columns and tables. A paragraph can have as many as 20 tab positions.
The 'left' tab stop begins the text following a tab character at the next tab position. To
create a left tab stop, click the left mouse button at the specified location on the ruler. The
left tab stop is indicated on the ruler by an arrow with a tail toward the right.
The 'right' tab stop aligns the text at the current tab stop such that the text ends at the tab
marker. To create a right tab stop, click the right mouse button at the specified location on
the ruler. The right tab stop is indicated on the ruler by an arrow with a tail toward the left.
The 'center' tab stop centers the text at the current tab position. To create a center tab
stop, hold the shift key and click the left mouse button at the specified location on the
ruler. The center tab stop is indicated on the ruler by a straight arrow.
The 'decimal' tab stop aligns the text at the decimal point. To create a decimal tab stop,
hold the shift key and click the right mouse button at the specified location on the ruler.
The decimal tab stop is indicated on the ruler by a dot under a straight arrow.
The tab stops can also be created by using the 'Set Tab' selection from the 'Paragraph'
menu. This option allows you to specify the tab position, tab type (left, right, center, or
decimal) and tab leader (dot, hyphen, underline, or none).
To move a tab position using the mouse, simply click the left mouse button on the tab
symbol on the ruler. While the mouse button is depressed, drag the mouse to the desired
location and release the mouse button.
To clear a tab position, simply click at the desired tab marker, or select the option from the
menu. You can also clear all tab stops for the selected text by selecting 'Clear All Tabs'
option from the menu.
The 'Snap To Grid' option in the 'Other' menu affects the movement of the tabs (and the
paragraph indentation markers) on the ruler. When this option is checked, the movements
of these markers are locked on to an invisble gird at an interval of 1/16 inch.
Normally, a tab command is applicable to every line of the current paragraph. However, if
you hightlight a block of text before initiating a tab command, the tab command is then
applicable to all the lines in the highlighted block of text.
Page 594
Page Break and Repagination
A hard page break can be inserted in the document by pressing the Control and Enter keys
together (or select the option from the menu: Edit->Break->Section Break). A hard page
break places the text after the page break on the following page. A hard page break is
indicated by a solid line in the editing window.
In the Print View editing mode, the editor also creates automatic page breaks when the
text overflows a page. An automatic page break is indicated by a dotted line in the editing
window. As the name implies, these page breaks are calculated automatically by the editor
between the keystrokes. The repagination process is time consuming. Sometimes there
may not be enough time for a large document to complete the repagination between the
edits. Therefore, the menu also provides an option to provide complete repagination on
demand.
Inserting Page Number The 'Page Number' selection from the 'Insert' menu allows you to insert the
page number into the document. The page number String is inserted at the
current cursor position. This String is displayed using a gray color.
Inserting Page Count The 'Page Count' selection from the 'Insert' menu allows you to insert the
total number of pages into the document. The page count String is inserted
at the current cursor position. This String is displayed using a gray color.
Show Page Border When option is turned on, the editor displays the borders around the text
on the screen. This option is available in the page mode only. The
'FittedView' option must be turned off.
Page 595
Page Header/Footer, Bookmark and Footnote Commands
The page header/footer functionality is available in the Page Mode only.
Show Page Normally, the editor does not show the header and footer for a page. You
Header/Footer can use this option from the 'View' menu to display the page header and
footer.
This option does not allow you to edit the text for the page header/footer.
Every section in a document can have its own page header and footer. If a
section does not have a page header/footer of its own, this option shows
the header/footer from the preceding section for the pages in this section.
Edit Page The user can use this option to edit the text for the page header and footer.
Header/Footer This option is available from the 'Edit' menu.
Insert Footnote This option allows you to insert a footnote at the current cursor location.
The footnote is displayed at the bottom of the page
Edit Footnote Text This option displays the footnote text in-line with the regular text. It allows
you to edit the footnote text. The modified footnote is displayed at the
bottom of the page.
Insert Bookmark This dialog box is activated from the 'Insert' menu. It allows you to place a
bookmark (new or existing) at the current text location. You can also
position the cursor at a specified bookmark. It also allows you to delete an
existing bookmark.
Page 596
Table Commands
The table menu is available in the Page mode or Print View modes only
(see Editing Modes). This menu contains the commands to create a new
table or to edit table attributes.
Insert Table Use this option to insert a new table in the document. This option prompts
the user for the initial number of rows and columns in the table. The editor
initially creates the cells of equal width. The user can, however, change the
cell width by dragging the cell borders using the mouse.
In the Page Mode, the table cells are arranged by rows. In the Print View
Mode, the table structure is not visible.
Insert Table Row Use this option to insert a new row before the current table row. The new
table row has the same number of columns as the current table row.
Merge Table Cells Use this option to merge together the highlighted cells. The width of the
resulting cells is equal to the sum of all merged cells. If the highlighted
cells span more than one table row, this operation creates multiple merged
cells each within its row.
Split Table Cell Use this option to split the current table cell into two cells of equal width.
The entire text of the original cell is assigned to the first cell. The second
cell is created empty.
Delete Table Cells Use this option to delete the selected cells from the table. A dialog box
allows the user to select the cells for the deletion.
The dialog box has three options: cells, columns, and rows. The first
option selects the current cell or all the cells in the highlighted block of
text. The second option selects all the cells in the current column or the
columns containing the cells in the highlighted block of text. The third
option selects all the cells in the current row or the rows containing the
cells in the highlighted block of text.
Table Row Position Use this option to position the table or a selected table rows. A dialog box
lets you position the table as left justified, centered, or right justified.
Table Cell Border Use this option to create the borders around the selected cells. A dialog
box allows the user to select the cells for this operation.
The dialog box has three options: cells, columns, and rows. The first
option selects the current cell or all the cells in the highlighted block of
text. The second option selects all the cells in the current column or the
columns containing the cells in the highlighted block of text. The third
option selects all the cells in the current row or the rows containing the
cells in the highlighted block of text.
The user can specify the width of each border (top, bottom, left and right).
The border width should be less than the cell text margin. The cell text
margin is the distance from the left edge of the cell to the beginning of the
text in the cell. The border width is specified in twips (1440 twips equal to
one inch).
Page 597
Table Cell Shading Use this option to shade the selected cells. A dialog box allows the user
to select the cells for this operation.
The dialog box has three options: cells, columns, and rows. The first
option selects the current cell or all the cells in the highlighted block of
text. The second option selects all the cells in the current column or the
columns containing the cells in the highlighted block of text. The third
option selects all the cells in the current row or the rows containing the
cells in the highlighted block of text.
Show Table Grid Lines Use this option to enable or disable the display of the table grid lines. The
table grid lines are for display purpose only, they are not drawn when
printing to a printer
Page 598
Section and Columns
The editor allows you to divide a document into multiple sections. A
multiple section document is useful when a) you need to vary the page
margins from one page to another and b) you need to create multiple
column text.
Creating a New To create a new section, select the 'Break' submenu option from the 'Edit'
Section menu. A section break line (double solid line) is created before the current
line. The new section begins at the text following the break line.
Page Margins
The first three parameters can be edited by selecting the 'Section Edit'
option from the 'Edit' menu. The last parameter can be edited by selecting
the 'Page Setup' option from the 'File' Menu.
Deleting a section To delete a section break line, simply position the cursor on the section
break line break line and hit the <DEL> key.
Multiple Column This option is available in the Print View and Page Modes only (See
Editing Editing Modes)
To create multiple columns for a section, select the 'Section Edit' option
from the menu and specify the number of columns to create. You can also
specify the space between the columns.
The text in the multiple column section wraps at the end of the column.
When the text reaches the end of the page, or the end of a section, the
new text is placed on the next column.
In the Print View mode, the multiple columns are not actually seen in the
window. In the Page Mode, the columns are visible as they would be when
the text is printed. Therefore, the Page Mode is useful when editing
multiple column text.
Column Break Normally in a multiple column section, the text flows to the next column at
the end of the current column. The column break option can be used to
force the text to the next column before the current column is completely
filled.
A column break can be inserted by selecting the option from the menu
(Edit->Insert Break...). A column break is indicated by a line with a 'dot
and dash' pattej. The text after the column break line is placed on the next
column. To delete the column break line, simply position the cursor on the
line and hit the <DEL> key
Page 599
Page 600
Stylesheet and Table-of-contents
The editor supports the character and paragraph type stylesheet style items. The character
stylesheet style constitutes a set of character formatting attributes and is applied to a
character string. The paragraph stylesheet style constitutes not only a set of character
formatting attributes, but also a set of paragraph formatting attributes. The paragraph style
is applied to one or more paragraphs.
Create and edit styles A stylesheet style is created and modified using the 'Edit Style' menu
option from the 'Edit' menu. This option displays a dialog box which allows
you to choose between a character style or a paragraph style. You can
select an existing style to modify from the list box or enter the name for
the new style. Once you click the 'Ok' button, the recording of the
stylesheet properties begins. You can use the ruler, toolbar, or the menu
selections to modify the stylesheet items. The ruler, toolbar, and menu
also reflect the currently selected properties for the stylesheet item.
Please note that the paragraph properties are allowed only for the
paragraph type of stylesheet item.
After you have selected the desired properties, terminate the stylesheet
editing mode by either selecting the 'Edit Style' selection from the menu
again or by clicking anywhere in the document. If the existing stylesheet
item was modified, the document automatically reflects the updated
stylesheet properties. If a new stylesheet item was created, your next step
is to apply the style to the desired text by choosing the 'style' option from
the 'Font' or the 'Paragraph' menu selection.
Apply character styles The 'style' menu selection in the 'Font' menu allows you to apply a
stylesheet style to the currently highlighted character string.
Apply paragraph styles The 'style' menu selection in the 'Paragraph' menu allows you to apply a
stylesheet style to the current paragraph. To apply a style to a range of
paragraphs, highlight the paragraphs before selecting the 'style' menu
option.
Table of Contents To insert a table of contents, first create the heading styles using the 'Edit
Style' option from the 'Edit' menu. For example, if you wish to insert a
three level deep table of contents, create heading styles 'heading 1',
'heading 2', and 'heading 3'. Then place the cursor at the heading lines and
apply a suitable heading style using 'style' menu selection from the
'Paragraph' menu. The last step would be to position the cursor where you
wish to insert the table of contents and select the 'Table of Contents' menu
selection from the 'Insert' menu.
Page 601
Text/Picture Frame and Drawing Objects
A frame is a rectangular area on the page. A frame can contain both text and picture. The
text outside the frame flows around the frame. A drawing object can be a text box,
rectangle or a line. The drawing object overlays on top of the text
The 'Frame' or 'Drawing Object' option from the 'Insert' menu is used to embed a frame or a
drawing object into the text. The new object is inserted at the current text position.
To insert text into the frame or a text box, click a mouse button inside the frame to select
the frame. Now type the text at the cursor position.
To size a frame, click a mouse button inside the frame to select the frame. Now click the
left mouse button on a sizing tab and move the mouse while the mouse button is
depressed. Release the mouse when done. The text inside the frame is automatically
rewrapped to adjust to the new width. If the new height of the frame is not enough to
contain all text lines, the frame height is automatically adjusted to include all lines. If the
frame contains only a picture, the picture size is automatically adjusted to fill the frame.
To move the frame, click a mouse button inside the frame to select the frame. Now move
the mouse cursor just outside the frame until a plus shaped cursor appears. Click the left
mouse button. While the mouse button is depressed, move the frame to the new location
and release the mouse button.
To edit the base vertical position of the frame, select the 'Vertical Frame Base...' option
from the edit->frame menu. The frame locked to the top of the page or the top of the margin
retain their vertical position when the text is inserted before them.
To edit the border and the background of a drawing object, select the 'Edit Drawing Object'
option from the edit->frame menu.
Page 602
View Options
This menu allows you to turn on and off the following viewing options:
Page Mode In this mode, the editor displays one page at a time. This mode is available
when the editor is called with both the Word Wrap and the Page Mode (or
the PageView flag) flags turned on. This mode is most useful for the
documents containing multiple columns, as the columns are displayed
side by side. In addition, this mode provides all the features of the Print
View mode.
FittedView Special case of the page mode in which the text wraps to the window
width and the soft page breaks are not displayed
Ruler The ruler shows tab stops and paragraph indentation marks. The ruler can
also be used to create or delete tab stops
Tool Bar The tool bar provides a convenient method of selecting fonts, point sizes,
character styles and paragraph properties. The tool bar also shows the
current selection for font, point size and character styles.
Show Status Ribbon The status ribbon displays the current page number, line number, column
number and row number. It also indicates the current insert/overtype mode.
Show Hidden Text This option displays the text formatted with the hidden attribute (see
Character Formatting Options) with a dotted underline. When this option is
turned off, the hidden text is not visible.
Show Paragraph Mark This option displays a symbol (an inverted 'P') at the end of each
paragraph. This option may be useful when working with lines with many
different heights
Hyperlink Cursor This option is used to display the hyperlink cursor when the cursor is
positioned on a hypertext phrase. The hyperlink cursor is an image of a
hand with a finger pointing to the text.
Zoom This feature allows you to compress or enlarge the display of the
document text. The editor allows a zoom percentage between 25 and 200.
Page 603
Navigation Commands
Jump Use this function to position on a desired line number.
You can invoke this function by hitting the F10 function key (or select the
option from the menu). The editor will then display a dialog box so that you
can enter the line number to jump to.
See 'How to Scrolling Through the Text' section for other navigation
functions.
Page 604
Search/Replace Commands
Search a Text String Use this function to locate a String of characters in the current file. The
editor will search for the first instance of the given character string. To find
the subsequent instances of the same character string, use Search
Forward or Search Backward commands.
You can invoke this function by hitting the F5 function key (or select the
option from the menu). The editor will display a dialog box where you enter
the character String to locate. You can specify the search to be in the
backward or the forward direction from the current cursor position or you
can specify the search to take place from the beginning of the file. You can
also force a non-casesensitive search, in which case the String is matched
irrespective of the case of the letters in the string.
Search Forward Use this function to locate the next instance of a previously located String
using the Search Function. If the Search Function is not yet invoked, this
function will call the Search Function instead.
You can invoke this function by hitting the Control F Keys together (or
select the option from the menu).
Search Backward Use this function to locate the previous instance of a previously located
String using the Search Function. If the Search Function is not yet
invoked, this function will call the Search Function instead.
You can invoke this function by hitting the Control Shift F Keys together (or
select the option from the menu).
Replace a Text String Use this function to replace a character String with another character
string.
You can invoke this function by hitting the F6 function key (or select the
option from the menu). The editor will show a dialog box where you will
enter the old and new character strings. You may also choose to conduct
the replace only within a selected part of the file. To choose such a block
of text, the desired text must be highlighted before invoking the replace
function.
The dialog box also offers you an option to force the editor to verify each
replace.
Page 605
Highlighting Commands
Highlight a Character Use this function to highlight a block of characters.
Block
Mouse: Position the mouse cursor on the first character of the block and
depress the left button. While the left button is depressed, drag the mouse
to the last character of the block and release the mouse.
Keystroke: Position the caret on the first character of the block and press
the shift key. While the shift key is pressed, use the position keys to move
the caret on the last character of the block and release the shift key.
Normally, you can also use any position key in combination with the Shift
key to create, expand, or shrink the text selection.
Mouse: Position the mouse cursor at any position on the first line of the
block and depress the right button. While the right button is depressed,
drag the mouse to the last line of the block and release the mouse.
Keystroke: Position the caret at any position on the first line of the block
and hit the F8 function key. Use the Up and Down arrow keys to position
the caret on the last line and hit F8 again.
Normally, a function that utilizes a line block, also erases the highlighting.
To explicitly erase the highlighting click a mouse button again or press the
F8 key again.
Highlight a Word Double click any mouse button on the desired word to highlight the word
Page 606