Controlling the operation of Word 97 in an application

Source: Internet
Author: User
Tags ole

You must first include file Comobj.hpp in the header file when compiling the Automation client, and write to #include <ComObj.hpp>. Programming tools The developer of C + + Builder the ability to invoke Word 97 automation objects in roughly the form of several OLE object class functions that can be easily exploited by application designers.

* Set the properties of the OLE object:

Olepropertyget (propname)

Olepropertyset (Propname,value) where value is any value that can be converted to a variant

* Method of calling OLE object:

Oleprocedure (Oleprocname,[val,...])

Olefunction (Olefuncname,[val,...])

Where Val is any value that can be converted to variant type can be passed through Olefunction (Olefuncname,[val,...]) The parent object returns its child object, which is the syntax: the child object name = The parent object name. Olefunction (Olefuncname,val). This method can also be used to combine objects from the parent object that return their underlying objects.

Using OLE Automation to control Word 97 in C + + Builder, you must have the Automation object for Word 97 and the object methods and properties for Word in Microsoft Word Visual basic Help files. A Word object represents an element of word, such as a document, paragraph, bookmark, or individual character. A collection is an object that contains several other objects, usually of the same type, for example, a collection object that can contain all the bookmark objects in the document. By using properties and methods, you can modify individual objects, or you can modify the entire collection of objects. A property is an attribute of an object or an aspect of the object's operation. For example, a document property contains a name, content, save state, and whether or not revisions are enabled. To change the properties of an object, you can modify the value of the property. Method is an action that an object can perform.

The automation objects that represent the Word 97 application are two: Word.Application and Word.Basic, and the WordBasic property of the Application object allows them to be transformed between assignments. By using Createoleobject ("...") in C++builder, you can start Word and get a handle and assign it to a Variant variable. If there are two variant variants V1 and V2,wordbasic are properties of the Application object:

V1=createoleobject ("Word.Application");

V2=v1. Olefunction ("WordBasic").

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.