How to print Word, Excel, and text files in VC

Source: Internet
Author: User

I collected some information about this issue for work reasons. I am deeply aware that it is not easy to collect such materials. Therefore, I would like to share it with you, hoping to help you a little bit.

 

1. VC print Excel:

There is a lot of information about how VC can open an Excel file. Generally, Ole avtive control/is used. Suppose that when you open an Excel file and obtain its

Workbook handle, corresponding interface:

Colevariant covtrue (short) True );

Colevariant covfalse (short) False );

Colevariant covoptional (long) disp_e_paramnotfound, vt_error );

_ Workbook objbook;

.....

Objbook. printout (covoptional,

Covoptional,

Colevariant (long (1), // print the number of copies

Covfalse,

Covoptional,

Covoptional,

Covoptional

, Covoptional

);

For more information about other parameters, see msdn.

 

2. VC prints word

The Printing Interface of word is:

_ Document: printout (covfalse,

Covoptional,

Covoptional,

Covoptional,

Covoptional,

Covoptional,

Covoptional,

Colevariant (long) 1), // print the page number

Covoptional,

Covoptional,

Covoptional,

Covoptional,

Covoptional,

Covoptional,

Covoptional,

Covoptional,

Covoptional,

Covoptional

);

For the parameter meanings, see msdn.

 

3. VC print Excel:

Call the print function of shell:

ShellExecute (null, "print", "C: // temp // test.txt", null, null, sw_hide );

Note that a printer has been installed on the machine. The printed output is sent to the default printer. In addition, shellexcute can be used to print Excel and Word, and replace the corresponding file name.

ShellExecute (null, "print", "C: // temp // test.xls", null, null, sw_hide );

ShellExecute (null, "print", "C: // temp // test.doc", null, null, sw_hide );

 

 

 

 

 

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.