Manipulating Ms Word 123 in Visual C + +

Source: Internet
Author: User

Use VC programming to manipulate office. You can implement such as: Word file printing, transferring data to Word documents, sending e-mail, automatically generating tables, Excel data statistics, pie charts, histogram display, automatic report generation, playback slides, doc,txt,html,rtf file conversion, Chinese simplified traditional conversion, Pinyin or stroke sorting ... As long as the functionality that Office can implement can be invoked in the program you write. Read the instructions below and download the source file for your reference, and you'll be able to take this technique step-by-step. I wish our friends a happy learning.

First, the concept

The interfaces for OLE Automation Automation programs are available in Microsoft Office products. If you use Vb,vba and script scripts to invoke Office functionality, it's much simpler than using VC calls. For example, in Word, bring up the menu "tool (T) \ macro (M) \ Record New Macro (R)", at which point it begins to record any menu and keyboard you have in Word, and save your procedure for repeated calls. The record for saving these operations is actually using the VBA program (Visual Basic for application). The following features we want to implement also refer to the VBA approach.

Second, the structural level

In order to be more logical and more hierarchical to operate Office,microsoft, the application (application) is divided into the following tree structure by logical function

Application (WORD, for example, lists only part)

Documents (all documentation)

Document (one documentation)

......

Templates (All templates)

Template (a template)

......

Windows (All windows)

Window

Selection

View

Selection (Edit object)

Font

Style

Range

......

......

Only by understanding the logical hierarchy can we manipulate Office properly. For example, if a VBScript statement is given:

Application. Activedocument.saveas "C:\abc.doc"

So, we know, the process of this operation is: the first step, to obtain application; The second step, obtains the activedocument from the application; step three, call the document's function SaveAs, and the argument is a string file name.

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.