|
|
|||
© 2008 by CapeSoft Software (Pty) Ltd www.capesoft.com |
|||
![]() |
Microsoft Word Functionality |
| Add_MSWord_Object | ||||||||||||
|
||||||||||||
| Word_SpellChecking | |||
| Summary | |||
| Extension Template Important for Clarion 5.5 users Important for Clarion 6 users |
|||
| What does it do? | |||
| This template adds
Spell Checking support to a window. Simply add it to a window procedure
and you will be able to press F7 (or which ever key you select) and the
currently selected field will be "spell-checked". |
|||
| Prerequisites | |||
|
|||
| How do I implement it? | |||
|
|||
|
What are my options? |
|||
|
Keycode to alert for: This is the key that Office Inside will watch for, which will invoke the Spell Checker. Typically this defaults to 'F7Key'.
|
|||
| C55 RTF Controls | |||
For Clarion 5.5 you need to populate the 'Office Inside Spell Check for C55 RTF' control template onto your window for each RTF control. You must have added a Word object to your procedure in order to use this control template.
You can optionally specify the maximum size for the spelling checking string (this defaults to 256K), and whether or not a message should be shown to the user when spell checking is complete (defaults to on) |
|||
| Clarion RTF Controls | |||
A Checkbox has been added to the Global Extension that should be checked in order to use spell checking on a Clarion 6 RTF control. This has been added becuase in order to use spell checking on Clarion 6 RTF controls the RtfControlClass needs to have a line modified. If you have ticked this box to enable spell checking of Clarion 6 RTF controls, then open the rtfctl.inc file in your Clarion6\libsrc directory and change the lines that reads: CtlRTF SIGNED,PROTECTED to: CtlRTF SIGNED!,PROTECTED The PROTECTED attribute needs to be commented out in order to allow Office Inside to identify which control the object is associated with. |
|||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
AlignCenter
( ) ,byte,proc
|
|
AlignJustify ( ) ,byte,proc MyWord.AlignJustify () TempByte = MyWord.AlignJustify ()
|
|
AlignLeft ( ) ,byte,proc MyWord.AlignLeft () TempByte = MyWord.AlignLeft ()
|
|
AlignRight ( ) ,byte,proc MyWord.AlignRight () TempByte = MyWord.AlignRight ()
|
|
Bold
( byte pOption=oiw:BoldToggle ) ,byte,proc MyWord.Bold (oiw:BoldOn) TempByte = MyWord.Bold (oiw:BoldOn)
|
|
CentimetersToPoints ( string pCentimeters ) ,string loc:Points = MyWord.CentimetersToPoints(1.5) MyWord.Update(oiw:PageLeftMargin, MyWord.CentimetersToPoints(1.5))
|
|
CheckGrammar ( *string pText ) ,byte TempByte = MyWord.CheckGrammar (StringVar)
|
|
CheckSpelling
( string pText, byte pSilent ) ,byte,proc StringVar = 'This is spelld wrongg' TempByte = MyWord.CheckSpelling (StringVar) if MyWord.CheckSpelling (loc:Var1, false, false) = true
|
| Cut
( ) ,byte,proc MyWord.Cut() TempByte = MyWord.Cut()
|
| FindText
(string pText), long Searches the document for the passed strings and returns 1 and selects the string if found, or returns zero and does not change current selection if the string does not exist in the document. This can be called multiple times to find each instance of the string in the document (for example to make each instance of the string bold - see the example below). Parameters string pText: The string to search for in the document Return Values Returns 1 if successful and selects the string that was found, or if the string cannot be found it returns zero. Examples ! Find all instances of the
word 'Hello' and make them bold.
|
|
ErrorTrap( string pErrorString, string pFunctionName ) MyWord1.ErrorTrap
PROCEDURE (string
pErrorString, string
pFunctionName)
|
|
GetFontColor
( ) ,long TempLong = MyWord.GetFontColor()
|
|
GetFontName
( ) ,string TempString = MyWord.GetFontName()
|
|
GetFontNames
( ) ,byte,proc MyWord.GetFontNames ()
|
|
GetFontSize
( ) ,long TempLong = MyWord.GetFontSize()
|
| GetInfo
( byte pOption ) ,string,proc TempString = MyWord.GetInfo (oiw:GetUserName)
|
| GetNameOfDictionary
( ) ,string TempString = MyWord.GetNameOfDictionary()
|
|
GetSelectionEnd ( ) ,long
TempLong = MyWord.GetSelectionEnd()
|
|
GetSelectionStart
( ) ,long TempLong = MyWord.GetSelectionStart()
|
| GetText
( byte pScope=oiw:GetText_All ) ,byte,proc if MyWord1.GetText (oiw:GetText_CurrentSelection) = true stop(MyWord1.TempCString) end
|
|
Moves the cursor to the end of the current document. Return Values Returns true (1) if no problems were experienced. Examples MyWord.GotoEndOfDoc() See Also
|
|
GotoItem
(long pItem, <long pDirection>,
<long pName>, <long pCount>),
long, proc Moves the cursor to a location within the document, based on the parameters which you pass. Can be used to navigate to a position in the document based on a line, paragraph, bookmark, character position etc. The pItem parameter is used to specify which item to go to, and the pDirection parameter specifies which one of those items to go to (the first, last etc.). You can set the pDirection to oiw:GotoAbsolute and then use the pCount parameter to specify the number of the item to go to (for example the 4th line in a document). Note: If the pItem parameter is oiw:GoToBookmark, oiw:GoToComment, oiw:GoToField, or oiw:GoToObject, this parameter specifies a name and the pName field must be passed to specify which item is referred to. Parameters long pItem: The item to go to. Can be one of the GoTo equates:
long pDirection: Specifies which items to go to, can be used in combination with the pCount parameter. For example if pDirection is set to oiw:GoToPrevious, then the count parameter can specify how many previous to go to (setting it to 4 will go to 4 items previous to the current one). May be one of the following values:
Returns Values Returns true (1) if no problems were experienced and false (0) if an error occurs. In the case of an error the ErrorTrap method will be called with a string indicating what error occurred. Examples ! Go to the last line in the
document
|
|
HideToolbar
( long pToolbar ) ,byte,proc MyWord.HideToolbar (oiw:ToolbarStandard) TempByte = MyWord.HideToolbar (oiw:ToolbarStandard)
|
|
InchesToPoints
( string pInches ) ,string loc:Points = MyWord.InchesToPoints(1.6875) MyWord.Update(oiw:PageLeftMargin, MyWord.InchesToPoints(1.6875))
|
|
Init
( byte StartVisible=1, byte EnableEvents=1 ) ,byte,proc MyWord.Init() TempByte = MyWord.Init()
|
|
InsertBreak
( long pBreakType=oiw:PageBreak ) ,byte,proc MyWord.InsertBreak () MyWord.InsertBreak (oiw:PageBreak) MyWord.InsertBreak (oiw:TextWrappingBreak)
|
|
InsertPicture
( string FileName ) ,byte,proc MyWord.InsertPicture ('c:\mypic.bmp') TempByte = MyWord.InsertPicture ('c:\mypic.bmp')
|
|
InsertTable
( long NumColumns, long NumRows ) ,long,proc MyWord.InsertTable (6, 3) TempByte = MyWord.InsertTable (6, 3)
|
|
InsertText
( string pText, byte pOption=0 ) ,byte,proc or
( *cstring pText, byte pOption=0 ) ,byte,proc MyWord.InsertText ('Hello World') TempByte = MyWord.InsertText ('Hello World')
|
InsertTextbox ( string pText ) ,byte,proc Inserts a textbox into the current document. A Word textbox can be used to create complex layouts, and position blocks of text anywhere on the document. Before calling this method, you need to set up several properties, as shown in the example code above. This lets you set up exactly how the TextBox will be drawn when you finally call the InsertTextbox method. The self.Textbox.TextOrientation property
can be set to any equate listed here.
Return Values Returns true (1) if no problems were experienced. Example: MyWord.Textbox.BoxAlignment = oiw:ShapeCenter
|
| Italic
( byte pOption ) ,byte,proc MyWord.Italic (oiw:ItalicToggle) TempByte = MyWord.Italic (oiw:ItalicToggle)
|
| Kill
( byte UnloadCOM=1 ) ,byte,proc MyWord.Kill() TempByte = MyWord.Kill()
|
|
LinesToPoints ( string pLines ) ,string loc:Points = MyWord.LinesToPoints(5) MyWord.Update(oiw:PageLeftMargin, MyWord.LinesToPoints(5))
|
|
MailMergeGetRecord
( byte pOption=0 ) ,byte,proc MyWord.MailMergeGetRecord ()
|
|
MailMergeRun
( ) ,byte,proc MyWord.MailMergeRun() TempByte = MyWord.MailMergeRun()
|
| MailMergeSetDataSource
( string DataSourceName, string ConnectionString, string SQLStatement
) ,byte,proc MyWord.MailMergeSetDataSource ( (longpath() & '\Addresses.mdb'), 'TABLE Office_Address_List', 'SELECT * FROM [Office_Address_List]' )
|
|
MillimetersToPoints ( string pMillimeters ) ,string loc:Points = MyWord.MillimetersToPoints(10) MyWord.Update(oiw:PageLeftMargin, MyWord.MillimetersToPoints(1.10))
|
| MoveDown
( byte pUnit=oiw:UnitLine, long pCount=1, byte pExtend=oiw:Move
) ,byte,proc MyWord.MoveDown() ! move down one line
|
| MoveLeft
( byte pUnit=oiw:UnitCharacter, long pCount=1, byte pExtend=oiw:Move
) ,byte,proc MyWord.MoveLeft() ! move left one character
|
|
MoveRight
( byte pUnit=oiw:UnitCharacter, long pCount=1, byte pExtend=oiw:Move
) ,byte,proc MyWord.MoveRight() ! move right one character
|
| MoveUp
( byte pUnit=oiw:UnitLine, long pCount=1, byte pExtend=oiw:Move
) ,byte,proc MyWord.MoveUp() ! move up one line
|
| NewDoc
( <string TemplateName> ) ,byte,proc MyWord.NewDoc() TempByte = MyWord.NewDoc() MyWord.NewDoc ('MyTemplate.dot') ! assumes system default template directory MyWord.NewDoc (longpath() & '/templates/MyTemplate.dot')
|
| NextLine
( ) ,byte,proc MyWord.NextLine() TempByte = MyWord.NextLine()
|
| OpenDoc
( string pFileName, byte pReadOnly=false, byte pAddToRecentFiles=false,
<string pPassword> ) ,byte,proc MyWord.OpenDoc('c:\test.doc') TempByte = MyWord.OpenDoc('c:\test.doc')
|
|
OpenFooter
( ) ,byte,proc MyWord.OpenFooter()
|
|
OpenHeader
( ) ,byte,proc MyWord.OpenHeader()
|
| Paste
( ) ,byte,proc MyWord.Paste() TempByte = MyWord.Paste()
|
|
PicasToPoints ( string pPicas ) ,string loc:Points = MyWord.PicasToPoints(8) MyWord.Update(oiw:PageLeftMargin, MyWord.PicasToPoints(8))
|
|
PixelsToPoints ( string pPixels, byte pVertical=false ) ,string loc:Points = MyWord.PixelsToPoints(15) MyWord.Update(oiw:PageLeftMargin, MyWord.PixelsToPoints(15))
|
|
PointsToCentimeters
( string pPoints ) ,string loc:Points = MyWord.PointsToCentimeters(6) MyWord.Update(oiw:PageLeftMargin, MyWord.PointsToCentimeters(6))
|
|
PointsToInches
( string pPoints ) ,string loc:Points = MyWord.PointsToInches(14) MyWord.Update(oiw:PageLeftMargin, MyWord.PointsToInches(14))
|
|
PointsToLines
( string pPoints ) ,string loc:Points = MyWord.PointsToLines(8) MyWord.Update(oiw:PageLeftMargin, MyWord.PointsToLines(8))
|
|
PointsToMillimeters
( string pPoints ) ,string loc:Points = MyWord.PointsToMillimeters(14) MyWord.Update(oiw:PageLeftMargin, MyWord.PointsToMillimeters(14))
|
|
PointsToPicas
( string pPoints ) ,string loc:Points = MyWord.PointsToPicas(12) MyWord.Update(oiw:PageLeftMargin, MyWord.PointsToPicas(12))
|
|
PointsToPixels ( string pPoints, pVertical=false ) ,string loc:Points = MyWord.PointsToPixels(13) MyWord.Update(oiw:PageLeftMargin, MyWord.PointsToPixels(13))
|
|
PrintDialog
( ) ,byte,proc MyWord.PrintDialog() TempByte = MyWord.PrintDialog()
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
PrintMe (<string pPages>, byte pRange=oiw:PrintAllDocument, long pCopies=1, byte pPageType=oiw:PrintAllPages, byte pBackground=false, <string pPrinterName>) ,byte,proc Prints the currently loaded document. This method has been replaced by the PrintOut(), which expands the supported options and is currently in Beta (see below). Parameters
Notes In order for the pPages parameter to work, pRange
needs to be oiw:PrintRangeOfPages.
If you pass a value in pPages, and also pass anything other than
oiw:PrintRangeOfPages
in pRange, we will simply ignore what you pass in pRange.
We do this so that the following code will work, even though
pRange is going to default to oiw:PrintAllDocument, which wouldn't ordinarily work: If you're wanting to print a document to a printer other than the system default printer, the "safest" way to do this seems to be it is done in the "Two Printers" example. Notes can be found in that example. Examples TempByte = MyWord.PrintMe ()
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
PrintOut (*oiwPrintProperties printSettings, string printerName) The PrintOut method expand on the simple PrintMe() method and exposes all the properties supports by Word. The oiwPrintProperties group type is provided to allow the setting to be easily set and passed. Parameters *oiwPrintProperties printSettings A oiwPrintProperties group that contains the settings to be used for printing. See below for a description of the group type and fields. This is a TYPE'd group and can be used to create your own PrintSettings groups as follows: myPrintSettings
group(oiwPrintProperties) string printName The name of the printer to use for printing. Return Values Returns 1 for success and zero if the COM interface encountered an error. Data Types
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
PrintPreview
( ) ,byte or ( byte pOption ) ,byte,proc
TempByte = MyWord.PrintPreview () ( TempByte will be 1 if on, 0 if not ) MyWord.PrintPreview (1) ! turn print preview on MyWord.PrintPreview (0) ! turn print preview off MyWord.PrintPreview (2) ! toggle print preview TempByte = MyWord.PrintPreview (1) ! turn print preview on ! TempByte will return 1 if passed, 0 if an error occurred
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Protect (long
protectionType, string pPassword),
long Enables document protection. This limits what changes may be made to the document unless document protection is turned off. If a password is specified then that password must be used to turn document protection off. Once you enabled document protection the same limits that apply to the end user also apply to other methods called. For example if you enabled document protection and set the document to Read Only, you will not be able to modify the document by calling any of the oiWord methods until oiWord.Unprotect is called to remove the protection. Parameters long protectionType: Type of protection to enabled. Can be one of the following values:
string pPassword: The password used to protect the document. This password will be needed to remove the protection. A blank string may be specified, which means that the protection can be removed without setting any password. Return Values Returns 1 for success and zero for failure. Examples MyWord1.Protect(oiw:AllowOnlyComments,
'capesoft')
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Redo ( ) ,byte,proc MyWord.Redo() TempByte = MyWord.Redo()
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ReplaceText (string pFindText, string pReplaceText, byte pReplaceAll=false), byte, proc Search and replace method, locates a string in the document and replaces it with the specified string. This method searches the currently loaded document for the text you pass as the pFindText parameter, and then replaces that text with the text which you pass as the pReplaceText parameter. The pReplaceAll parameter determines whether the first instance the word / text is replace, or whether all instances are replaced. Important: Word limits the size of the strings being replaced and the replacement text to 256 characters. There are two ways of replacing strings larger than 256 characters:
Note: Replacement text inherits the formatting of the text it replaces in the document. For example, if you replace the string "abc" with "xyz," occurrences of "abc" with bold formatting are replaced with the string "xyz" with bold formatting. This also applies to case, in that if you replace "acb" with "xyz" you will get "xyz", but if you replace "ABC" with "xyz" you will in fact get "XYZ". This is actually pretty useful once you understand how it works, in that you can lay out the same search string in a document, multiple times, and each string can have its own formatting (case, bold, underlined etc) which is preserved when you replace. Parameters string pFindText: The text to find in the document. This will be replace by the pReplaceText string if it is found. string pReplaceText: The text to replace the pFindText string with byte pReplaceAll: An optional parameter specifying that all instances of the pFindText string in the document should be replaced by the pReplaceTextString. The default is false (only replace the first occurrence). Setting this to true (1) will replace all occurrences.
Return Values Returns true (1) if no problems were experienced (Note: A return value of true does not indicate that any text was actually replaced. In other words, if the text you are searching for is not found, the method can still return true). Examples MyWord1.Rep | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||