Version
Gold www.capesoft.com |
|||
Welcome to Office Inside! If you are new to Office Inside, or if you have not used the product for a while, these steps should get you going in the right direction.
Whether you are just starting off with this product, or are wanting to see what features the current version offers, or are wanting to find out how to do something with Office Inside, the best place to start is typically with the examples. The abc "Demo" app (offdemo.app and the Clarion 6 version offdemo6.app) is the most comprehensive of the examples, and will show most of the features which Office Inside has to offer. A good place to start is to compile this example application and spend a few minutes having a look at what it can do ( we recommend doing this each time you install a new version of Office Inside also ). Once you have found what you're wanting to do, you can then have a look at the source code to see how we did it. This documentation explains the various objects, templates, and function calls which we use, but the example is easier to get your teeth into, and we'd suggest using this documentation more as a reference than as something which you read from start to finish. A common question is "Office Inside is so big, how do I find what I'm looking for?". To answer that question see the section titled Getting Started with Office Automation.
Another useful habit to get into is to read the Product History each time you install a new version of Office Inside, which will list the changes / improvements / new features which have been added.
If you are still unsure about something after you've looked at the example applications, and read the documentation, feel free to contact us for further assistance or to be pointed in the right direction. The Frequently Asked Questions is another useful reference to read through once in a while, and may give you some ideas as to what other Developers are asking about and using the product for.
Enjoy!
This template is copyright © 2011 by CapeSoft
Software. None of the included files may be distributed (with the
exception of the DLLs when distributing your application in standalone mode,
and pwutil.dll which you need to always ship with your application see What
You Need To Ship for more information). Your
programs which use "Office Inside" can be distributed without any
"Office Inside" royalties.
Each developer needs his own license to use CapeSoft Office Inside. (Need to
buy
more licenses?)
This product is provided as-is. Use it entirely at your own risk. Use of this
product implies your acceptance of this, along with the recognition of copyright
stated above. In no way will CapeSoft Software, their employees or
affiliates be liable in any way for any damages or business losses you may incur
as a direct or indirect result of using this product.
Why "another" Office product you might ask? Primarily because
for the first time Clarion is now able to access COM components without the performance
and stability problems we experienced in the past. With those obstacles out of
the way, there is now room for a product that makes it really easy to implement
Office functionality into your apps without having to spend substantial amounts
of time learning new technologies or tweaking your code. Want to add spell-checking?
Two minutes. Want to generate editable Word documents from all your existing
reports? 2 minutes. Drop it in, and compile. When new versions
of MS Office are released, download the latest version of Office Inside, recompile,
and ship. That's why.
The way the product is "built" is as follows: We have built several
classes which we ship as a DLL and lib. These classes handle the complexity
of communicating with MS Office COM components (interfaces), and simplify complex
tasks, data types and logic into easy-to-use methods. We then have templates
which implement those classes for you. You can either use our templates
( we will add more templates and expand on the existing ones regularly ), or you
can write code which calls our classes. We provide example applications
showing how to do both.
From time to time there will be changes in Office Inside that may produce compile errors in your code, or require changes within you application.
Office Inside 2.40 - August 2007
Important: If you are using the 'Import XLS To TPS' control template (now called 'Import and Excel File') then you must move your code for processing each record from the old ImportXLSFile_TakeRecord() method to the new TakeImportRecord() method. Also note that instead of each column being passed as a parameter the columns are now passed using a queue.
Office Inside 1.95 - 03 April 2006
NOTE: Have a look at the section titled "Version
History" to see what we're working on and what progress we're making.
Your questions, comments and suggestions are welcome. Check our web page (www.capesoft.com) for new versions. You can also contact us in one of the following ways.
CapeSoft Support | |||
support@capesoft.com | |||
Telephone | +27 21 715 4000 | ||
Fax | +27 21 715 2535 | ||
Post | PO Box 511, Plumstead, 7801, Cape Town, South Africa | ||
Office Inside can be purchase at $397 from:
CapeSoft Sales | |||
Web | www.capesoft.com | ||
Telephone |
+27 21 715 4000
|
||
Fax |
+27 21 715 2535
|
||
Post |
PO Box 511, Plumstead, 7801, Cape Town, South Africa
|
||
Buy Online | |||
Web | |||
To install "Office Inside", run the supplied installation file. The install file will optionally register the template for you, and update your redirection file to include various subdirectories within Clarion\3rdParty\.
In order for Office Inside to use the MS Office components, those components must be available. This means that if you want to use the templates that generate MS Word reports (for instance), MS Word must be installed on the PC. Office Inside supports all versions of Office from Office 2000 onwards (2003 and up is recommended). Office 2007, Office 2010 and future versions are fully supported. OfficeInside will continue to work with all future versions as long as the Office COM interface exists.
DLLs required (Standalone mode compiles) | |||
Clarion Version | DLL required | ||
Clarion 6.1 / Clarion 6.2 | C60OFFX.DLL and PWUTIL.DLL | ||
Clarion 5.5 | C55OFFX.DLL and PWUTIL.DLL | ||
DLLs required (Local mode compiles) | |||
Clarion Version | DLL required | ||
Clarion 6.1 / Clarion 6.2 | PWUTIL.DLL | ||
Clarion 5.5 | PWUTIL.DLL | ||
This table (Quick Reference) can be used to easily locate documentation on any of the Office Inside templates (listed below alphabetically).
Office Inside Templates : Quick Reference | ||||
Component | Template | Description | ||
(all) | Activate_Office_Inside | Global extension for using Office Inside in your application. | ||
Excel | Add_MSExcel_Object | Adds and configures an object in your procedure and allows the object type and settings to be chosen. | ||
Excel | ImportXLStoTPSAbc | Template Utility to add an Excel Import Wizard to your application. | ||
Excel | ImportAnXLSFile | Code template for adding an Excel Import function to a button or other control. | ||
Outlook | Add_MSOutlook_Object | Adds and configures an object in your procedure and allows the object type and settings to be chosen. | ||
Word | Add_MSWord_Object | Adds and configures an object in your procedure and allows the object type and settings to be chosen. | ||
Word | OfficeInside Spell Checking Window Controls | Adds the Spell Checking controls to a window to provide feedback for spelling checking. We recommend using the provided template utility "ShowSpellingSuggestionsABC" or "ShowSpellingSuggestionsLegacy" to add the procedure to your application. | ||
Word | OfficeInside Spell Checking | Adds and configures an object in your procedure and allows the object type and settings to be chosen. | ||
Word | Office Inside Spell Check for C55 RTF | Control template. Adds a button to allow an RTF control to be spell checked in C55. This only applies to C55, in Clarion 6 and above the RTF control supports spell checking using the Word_Spellingchecking template without the need for this control template. | ||
Below follows a list of all the Office Inside templates which are not "component-specific", meaning that they do not only apply to a single component of Office. Use the "Quick Reference" table (above) for a complete listing of all the Office Inside templates.
Template : Activate_Office_Inside | |||
Summary |
|||
Global Extension Template Activate CapeSoft Office Inside Features in your application Required |
|||
What does it do? |
|||
You must add this template
to your app or no other templates / objects will work. This template
sets up the Office Inside classes (dll / lib) so that other templates can
implement those classes. |
|||
How do I implement it? |
|||
1. Open your app If you are using Legacy and would like to use the Editable Report Word and Excel template you need to ticked on "Enable the use of ABC classes" checkbox under Global Settings on the Classes tab. Please also note that in Legacy you must have at least one of the SV report output templates added. This limitation will be removed in a future release. |
|||
The most frequently used classes are the oiWord, oiExcel, oiOutlook and oiPowerpoint classes, which are documented separately, see the Component Specific Documentation links in the Contents. This section documents additional classes that provide other functionality, as well as object that are generic to all of the application classes.
The oiRecentFiles class represents the Recent Files list for each of the Office application. This is the list that you typically see at the bottom of the File menu in Word, Excel and PowerPoint and it contains a list of the most recently used documents for the particular application. Each one of the Office Inside application classes contain a RecentFiles object. This object is initialised for you when the parent is initialised (so when the Init() method of oiWord, oiExcel, oiPowerpoint etc. is called). In addition the list is populated when the object is initialised and corresponds to the list when the office Application starts.
The RecentFiles class also allows you to refresh the list, and to perform actions on the files in the list, such as delete them, open them in the currently open Office application etc. The oiRecentFiles class contains a queue of oiRecentFile objects, each object represents a specific file. You don't need to manage the RecentFile objects, the parent class does it for you and provides methods to access them easily.
See the Demo application for an example of using the RecentFiles class. Below the class methods are described briefly, full documentation and example code will be added to future releases.
This method copies the Recent Files list into a queue for use in your application. The example demonstrates using this method to populate a queue and then display the contents in a listbox.
Initialises the object and populates the queue with the recent files list. This is done for you when the application initialises and typically this method never needs to be called.
Cleans up and destroys the object, this is done when the Kill method of the application is called and typically this method would never need to be called manually.
Clears all queue entries and fetches the list again. This is useful for ensuring that the list is up to date if documents have been opened, closed or created.
Fetches a specific enter from the queue.
Returns the number of files in the list
This adds a new file to the Recent Files list in the Office application. This method allows you to add a file to the list that the user did not necessarily open with the Office application.
Opens the Recent File in the Office application. The index parameter specifies which file in the list should be opened.
Deletes a file from Recent Files list.
For data types and equates that relate to a specific Office Inside object please see the documentation on the Word, Excel, Outlook and PowerPoint classes.
Equates
The size equates below are used for the various fields and type declared in Office Inside. For example the data types used by the Outlook class for storing Appointments, Tasks, Contacts etc.
_oit:TinyStringSize equate( 20 ) ! Really small Office Inside String Size
_oit:SmallStringSize equate( 50 ) ! Small Office Inside String Size
_oit:MedStringSize equate( 100 ) ! Medium Office Inside String Size
_oit:StdStringSize equate( 255 ) ! Standard Office Inside String Size
_oit:LargeStringSize equate( 1024 ) ! Large Office Inside Sting size
_oit:TelNoStringSize equate( 30 ) ! String size for telephone / fax numbers _oit:EntryIDSize equate(_oit:LargeStringSize)
Dll Functions | ||||
|
||||
oi_ChangeDefaultShowMessageIcon (string pIconName) |
Globally changes the icon used in the ShowMessage methods. This function does not need to be called for each object. Typically you would call this function as your Application (frame) initializes. Parameters string pIconName A string that contains the icon name (or equate) to use. Examples oi_ChangeDefaultShowMessageIcon(icon:exclamation)
|
oi_DebugMessage ( string debugMessage) |
Sends a Debug Message to your Debug Console, such as Debug View. Parameters string debugMessage: A string to output to the system debug output. Return Value None. Examples oi_DebugMessage('MyApp: Call the SendEmail method to send the mail message.')
|
oi_GetFileVersionInfo (string pFileName), string |
Used to read the version number information from a file's resource information. Returns the version information as a string. Parameters string pFileName A string containing the file name (and path) of the file to extract the version resource information from. Return Value A string containing the version information for the specified file. Examples versionString = oi_GetFileVersionInfo (LongPath() & '\oihelper.exe')
|
oi_GetOSVersionInfo ( ),string |
This function returns the current Operating System. The syntax of the string returned is as follows: OS.MajorVersion.MinorVersion.BuildNumber; e.g. NTS.0005.0001.0000. We always return the string in the format XXXX.XXXX.XXXX.XXXX, to make string processing easier (i.e. ReturnString[1:4], ReturnString[6:9], ReturnString[11:14], ReturnString[16:19] ). Note that the OS component could be preceded by blank spaces ( e.g. " 95" ) to make string processing easier, while the remaining components will be preceded by zeros (0) if they are not 4 characters long, or will be clipped to the first four characters if they are longer. This may sound complicated but it makes coding much easier (as illustrated above).
Parameters None Return Value Returns a string containing the Windows version information Examples versionString
= oi_GetOSVersionInfo()
|
oi_GetRegValue (string parentFolder, string nameOfKey, string nameOfValue), string |
Reads a value from the Windows registry. Parameters string parentFolder The parent folder to fetch the key from, this is typically on of the preset root register hives (folders): 'HKEY_LOCAL_MACHINE' string nameOfKey The name of the key to retrieve string nameOfValue The name of the value to retrieve from the specified key Return Value The value of the registry key (if it exists and could be retrieved). This value is returned as a string. Examples deviceName = oi_GetRegValue('HKEY_CURRENT_USER', 'Software\Microsoft\Windows NT\CurrentVersion\Windows', 'Device')
|
oi_GetWorkAreaHeight ( ),long |
TempLong = oi_GetWorkAreaHeight ()
|
oi_GetWorkAreaWidth ( ),long |
TempLong = oi_GetWorkAreaWidth ()
|
oi_OpenDoc ( string FileName ),byte,proc |
TempByte
= oi_OpenDoc ('c:\temp\MyDoc.doc')
|
oi_RGBToBGRLong ( long pR, long pG, long pB ) ,long |
MyWord.SetFontColor(
color:blue ) MyWord.SetFontColor( 13373688 ) MyWord.SetFontColor( oi_RGBToBGRLong(248, 16, 204) )
|
oi_SendEmail ( string pToAddress, string pCCAddress, string pBCCAddress, string pSubject, string pAttachments, string pBody, byte pPlainText, byte pOpen=false ) ,byte,proc |
oi_SendEmail ('support@capesoft.com', 'arb@capesoft.com;
support@capesoft.com', '', 'Test', 'c:\test.txt; c:\myfile.doc',
'This is a test', false)
|
oi_SetForegroundWindow ( string WindowTitle ) |
oi_SetForegroundWindow
('Inbox - Outlook Express')
|
oi_SetRegValue (string ParentFolder, string NameOfKey, string NameOfValue, string NewValue),string,proc |
oi_SetRegValue('HKEY_CURRENT_USER', 'Software\Microsoft\Windows NT\CurrentVersion\Windows', 'Device',
'\\PC3\HP970C,winspool,Ne02:')
|
oi_SysTempDir ( ),string |
loc:StringVar
= oi_SysTempDir()
|
oi_Version ( byte pOption=0 ),string |
TempString
= oi_Version ( ) ! eg. '3.12' TempString = oi_Version (1) ! eg. '3.12 Beta' TempString = oi_Version (2) ! eg. '48'
|
Unloads the COM interface for one or more threads in an application. Use with extreme caution. In general this does not need to be called, as each Office Inside object will dispose of allocated resources and will intelligently dispose of the COM interface on the per thread basis if no other objects are using it. Parameters byte pOption: Determines what the method does. If this is zero then the method does not do anything. If it is set to 1 then the Com interface is disposed for the current thread. Setting pOption to 2 will dispose of it for all threads. Return Value Returns 1 for success and zero for failure. Remarks If the application was started and passed the /oidebugmax switch on the command line then this method will output debug information to the debug log (which can be viewed using the free DebugView tool from www.sysinternals.com).
|
oi_GetCStringFromBstr (*long pbstr) Returns a cstring when passed a pointer to a bstring object. This method is not commonly used externally at this stage. Parameters *long pbstr: a long containing a pointer (address) of a bstring object in memory. Return Values Returns a pointer to a cstring that contains the contents of the bstring that was passed to the method. The caller is responsible for disposing of the cstring pointer returned.
|
oi_FreePWVariantCache () This method frees all cached variants stored in PWVariantFactory objects. The PWVariantFactory class and objects are not exposed and this method does not currently need to be called by applications that use OfficeInside.
|
oi_SetFocusWindow (string windowTitle) Sets the focus to the window that has the title matching the passed string (windowTitle) parameter. This can be used to give focus to any window on the system, regardless of which application it is. The window that gains focus does not necessarily become visible or change its ordering with other windows. To bring a window to the top (make it the topmost window) call the oi_SetForegroundWindow() method. Parameters string windowTitle: A string that contains the title of the window to give focus to. This can be any window in any application on the system.
|
oi_SetRegValue
(string
parentFolder, string nameOfKey, string nameOfValue, string newValue)
Sets the value of an entry in the Windows registry based on the passed parameters. If passed key does not exists it is created and the value set to the passed value. Parameters string parentFolder: The name of the root key that contains the key to set. Must be one of the following values:
string nameOfKey: The name of the key that contains the value to be set. string nameOfValue: The name of the value to be set. If a value with this name is not already present in the key, the function adds it to the key. If nameOfValue is an empty string, '', the function sets the type and data for the key's unnamed or default value. string newValue: The new value to set or to be added Return Value The functions returns zero for success or an Windows API error code (non zero value) if it fails. Notes For more information, see Registry Element Size Limits. Registry keys do not have default values, but they can have one unnamed value, which can be of any type.
|
Returns a string containing the hexadecimal equivalent of the passed value. Parameters long pLong: A long value to convert to a hexadecimal representation Return Value A string containing the hexadecimal representation of the passed long value. Notes The oiDecToBase() function is a generic form of this method that will convert a decimal (base 10) number to any base, including hexadecimal (base 16)
|
oi_ByteToHex (byte pByte)
Converts a byte to the hexadecimal representation. This function is identical to the oi_LongToHex() function, but converts a byte instead of a long. Parameters byte pByte: A byte value to convert to a hexadecimal representation Return Value A string containing the hexadecimal representation of the passed long byte. Notes The oiDecToBase() function is a generic form of this method that will convert a decimal (base 10) number to any base, including hexadecimal (base 16)
|
Converts the passed hexadecimal value to the equivalent long. Parameters string pHex: A string that contains the hexadecimal representation of a number. Return Values Returns a long containing the value of the passed string Notes The oiBaseToDec() function is a generic form of this method that will convert a number with any base, including hexadecimal (base 16) to decimal (base 10) and return the value as a long.
|
oi_RGBLongToBGRLong (long pRGB) Flips the byte order of the passed long from RGB to BGR. Used for colour conversion where the first and third bytes (least significant) need to be swapped. Parameters long pRGB: A long value that stores a colour in RGB (Red, Green, Blue) byte order. Return Values A long representing the passed colour, but with the byte order reversed to BGR (Blue, Green, Red)
|
oiDecToBase (long num, long base=16) Converts a passed long value to any base (such as hexadecimal, base 16) and returns the value in a string Parameters string num: The number to convert long base: The base to convert the number to. For example 10 converts to Decimal, 16 converts to Hexadecimal, 8 converts to Octal. Return Values Returns a string containing the passed number converted to the specified base
|
oiBaseToDec (string num, long base=16) Converts the passed number to a long value (a "decimal" number). Although the long simply contains the value and is actually binary (base 2) it is typically displayed as a decimal number. Parameters string num: A string containing the number to convert to a long. This number can have any base, such as base 8 (Octal) or base 16 (Hexadecimal). long base: The base of the number to convert. The passed string will be assumed to be a number with this base. Return Value A long containing the value of the passed number |
What's new in OfficeInside 3
This section contains Tips and Frequently Asked Questions pertaining to the Office Inside product as a whole. Tips and FAQs pertaining to specific sections / components of Office Inside can be found as follows:
MS Word related FAQ's | ( click here) | |
MS Excel related FAQ's | ( click here ) | |
MS Outlook related FAQ's | ( click here ) | |
MS PowerPoint related FAQ's | ( click here ) |
You can use New to create a new OfficeInside object, however you must ensure that:
Example
MyWord
&oiWord
code
MyWord &= new
oiWord
MyWord.disabled = 1
MyWord.Init(0, 1)
In version 1.95 we increased the size of the strings used in the queue and group types defined by Office Inside, such as:
oioFolderNamesQType
oioFolderItemsQType
oioAttachmentsQ
oioContactsQType1
oioContactProperties
oioCalendarQType1
oioAppointmentProperties
oioTasksQType1
oioTaskProperties
oioGrpProgressControls
If you have declared groups or queue with the same structure for passing to Office Inside methods then you will need to update them. We strongly recommend that you use the types declared in Office Inside rather than redeclaring them inside your application. For example:
MyAddressList queue(oioContactsQType1)
end
1. | Can I use Office Inside in a 16-bit app? |
No. | |
2. |
What versions of Clarion does Office Inside support? |
Clarion 5.5, Clarion 6 and Clarion 7. | |
3. |
Does Office Inside support Legacy applications? |
Yes | |
4. |
What will happen if I try to run my app (which uses Office Inside) on a computer where MS Office is not installed? |
Absolutely nothing. The Office Inside code will simply not work. It will not freeze the computer, or "time-out" trying to find MS Office. It will simply do nothing. Calls to the Office Inside objects will simply fail. The easiest way to manager this is to test what value the Init methods return. If Init fails (returns "false"), then you could simply disable any "Office" controls in your app. | |
5. |
Issues with Office Inside and Zone Alarm. |
It has been reported that certain versions of Zone Alarm (including Zone Alarm Pro Ver. 4.5.530.000) seem to cause issues when using Office Inside. Apparently version 4.0.146.029 works fine.. (Thanks to Johan de Klerk for figuring this one out..) | |
6. | I am using an editable Excel report and a non editable Word report template for the same report and the Word icon is not being displayed on the output selection window. |
You should change the Word report to editable if you are using it in conjunction with the editable Excel report template. This is becuase of the way the report targets are added. | |
7. | My columns in my Excel editable report don't line up, or it just all looks very odd... |
Remember that Excel is very restrictive in what can be displayed, so make sure you think in terms of lining everything up in rows and columns. Try to keep "one column, one control width" in mind, so if there is a control that will go into a particular column make sure that above and below it there aren't multiple controls that will fall into the same "column". It also helps to keep all controls in a column the same width. Future version of the reporting engine will be smarter and do more automatically, but for Excel it is always worth keeping the limitations in mind in order to get great looking reports. We recommend checking the C6 demo application for a good example of a multi page Excel report with numerous controls. | |
8 |
What do I need to use the Word and Excel editable report templates? |
|
|
9 | When UAC is enabled, my application has problems accessing Outlook. |
Ensure that your applications that will interact with Outlook have a valid manifest file for Vista/Windows 7. Without a valid manifest file, your application may require elevation in order to run, which will prevent Outlook from displaying security prompts to the user. In the event of a security prompt requiring user interaction, this will prevent your application from interacting with Outlook, and it may appears as if your application has locked up while waiting for a response from Outlook. It is strongly recommended that elevated applications do not interact with Outlook directly. The Microsoft design recommendations should be followed - seperated the functionality that requires elevation into a seperate application, or seperate the components that interact with Office into applications that can be run without requiring priviledge elevation. | |
Prior to Office Inside 2.10 it was not possible to use File Explorer and Office Inside on the same thread (for example both extensions on a single Window). Office Inside 2.10 introduces a new option to the Office Inside Object extensions - "Activate compatibility with File Explorer". In order to use an Office Inside object on the same Window as a File Explorer object, make sure that this check box is checked on the local extension. Each Office Inside control must have this box checked if used on the same window as FileExplorer.
Do not check the box if you have not added FileExplorer to the same procedure, as Office Inside will then not initialise the COM interface, and it will simply not do anything when you call the methods unless you set the oiOffice.noComInit property of the object to zero and call the oiOffice.Init() method after setting this property back to zero.
If you are calling the Init() method manually the you need to set the oiOffice.noComInit property of the object to 1 before calling the Init() method.
Example Applications |
You should import the Spell Checking window using the provided template utility. The new window uses the brand new control template that is part of the OfficeInside 3 spell checking solution.
As much as we can we try to keep upgrades free. Charging an upgrade gives us the resources to pack in a whole lot of extra functionality into a product, that we would otherwise not be able to do. We are not forcing you to upgrade - and we will continue supporting and building Office Inside 2 in future versions of Clarion. If you would rather not pay for the additional functionality offered in Office Inside 3, you're welcome to continue using Office Inside 2.
Although we try to ensure that Office Inside is always backward compatible, we may from time to time if we think it is going to improve the product long term, deliberately do something that would make Office Inside non backward compatible. In such cases we will document these changes in the Version History, as well as provide a summary here:
Version 1.91
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. 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.
Version 1.40 Beta
- Changed the Init method (all objects: Word, Excel, Outlook etc).
This method now only takes two parameters, as I've done away with the first
parameter (EarlyBound)
The simplest definition of automation in this sense is to control another, external program. A large part of what OfficeInside does is to make Automation of Microsoft Office products simpler, by taking care of the complexities inside the OfficeInside DLL. When you use the Office Inside DLL from your own application, all you need to do to start an instance of Microsoft Word (for instance) which you can then control from your application, is write one line of code (assuming you're not using the templates, which would do that for you), as follows: MyObject.Init(). Easy as that. The thousands of lines of code that are needed to actually get an instance of Word available to you and automate (control) that process are hidden from you inside the Office Inside DLL.
The DLL consists in part of several objects, such as oiWord, oiExcel, oiOutlook, etc. Each of these objects contain methods which you can then call to make the Office Programs "do things". For instance, once you have started Microsoft Word, if you wish to write some text to the Word document, you would use the oiWord object's InsertText() method, as follows: MyObject.InsertText('I wrote this'). And again, the DLL would then take care of getting that text into Word.
One of the big questions which we hear is "there are so many methods in Office Inside, how do I know what to look for?". The easiest way to get started is to compile the example application called "OffDemo.app". This example shows off most of what Office Inside is capable of doing, and contains "Automation Examples" for all the Microsoft Office programs which we currently support. Below is a picture of the Microsoft Excel automation example, showing the Clarion window called "Automate MS Excel", along with the instance of Microsoft Excel that the Clarion program started and is now automation ("controlling"). To make life easier for you, we have created a menu bar in each of the Clarion examples which matches the actual menu bar in the applicable Microsoft program. So if you want to know how to insert a picture into Word, you simply use the Clarion example application's "Automate MS Word" procedure, click on the "Insert" menu (in the Clarion example), and then click on "Insert Picture - From File". The actual method that is then called from code will appear in a list box on the Clarion window (as shown below for the Excel example), so that you can see exactly which method you need to use. You can then look up that method in the documentation to find out more about it, how it can be used, and what parameters etc can be used in it!
DebugView by SysInternals (now Microsoft) is an application that lets you monitor debug output on your local system. We use DebugView when developing because it gives an accurate picture as to what's happening in your code (as opposed to Message() or Stop()). If you start your application (any application into which Office Inside is compiled) with the following command line parameters, debug output will be generated accordingly, which you can then monitor using DebugView.
MyApp.exe | same as MyApp.exe /oidebugoff |
MyApp.exe /oidebugoff | almost no debug output |
MyApp.exe /oidebugmin | minimum amount of debug output |
MyApp.exe /oidebugmax | maximum amount of debug output |
Tip
I'd recommend using debug output only when you're testing something. It can be quite annoying for other programmers to work on a system where there are a dozen different apps generating debug output at the same time! To make life easier, all Office Inside debug messages are prefixed with "[OfficeInside]", as shown below. You can set DebugView to ignore all messages that do not contain "[OfficeInside]". You will also take a very small performance hit when running an app with debugging turned on.
The following coding conventions have been used when building Office Inside: