accessing Excel files with C++builder

Source: Internet
Author: User
Tags ole

C++builder is the Borland company after a successful product after Delphi, she set VB, VC + + and the advantages of Delphi in one and won the favor of the C language enthusiasts. Because most operators love to organize data in Microsoft Excel, this article introduces two ways to access Excel files with C++builder.

I. Manipulating Excel with OLE technology

OLE (Object linking and embedding) is the standard proposed by Microsoft, is a way to exchange data between applications, interoperability, MS OFFICE provides a strong OLE service function, VB, Delphi and C++builder and other languages can be customer way to Excel to submit commands, To access its data, which VB and Delphi is the simplest, in the syntax of the use of class VBA statements, this 99 48th of the "Operation in Delphi Excel," A article has introduced Delphi practice. We thought that C++builder copy Delphi, the results of the grammar is not compiled, can not find the details of this specific introduction. After repeated testing: the original C++builder using the indirect method, the Variant class variant provided by the four "methods" to the OLE service program to submit a manipulation command:

  Variant Variant::OlePropertyGet(属性名,参数….);
  // 取对象属性
   Void   Variant::OlePropertySet(属性名,参数….);
  // 设置对象属性 
   Variant Variant::OleFunction(函数名,参数….);
   // 运行对象的函数
   void   Variant::OleProcedure(过程名,参数….);
   // 运行对象的过程

Its header file "Vcl\utilcls.h" must be embedded in the user program.

For these four long method names, you can redefine the macro statement in your program:

      #define  PG  OlePropertyGet
       #define  PS  OlePropertySet
       #define  FN  OleFunction
       #define  PR  OleProcedure

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.