VC Print Word,excel Text file Method _c language

Source: Internet
Author: User

This article illustrates the method of printing word,excel text file in VC. Share to everyone for your reference. The implementation methods are as follows:

1. VC Print Excel:

About VC How to open an Excel, this aspect of information a lot of, general use is OLE avtive control/assume when you open an Excel file, and get it's
Workbook handle, the corresponding interface is:

Copy Code code as follows:
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 number of copies
Covfalse,
Covoptional,
Covoptional,
Covoptional
, covoptional
);

The reader can refer to the MSDN for the specific meaning of the other parameters.

2. VC Print Word

The print interface for Word is:

Copy Code code as follows:
_document::P rintout (Covfalse,
Covoptional,
Covoptional,
Covoptional,
Covoptional,
Covoptional,
Covoptional,
COleVariant ((long) 1),//print pages
Covoptional,
Covoptional,
Covoptional,
Covoptional,
Covoptional,
Covoptional,
Covoptional,
Covoptional,
Covoptional,
Covoptional
);

Refer to MSDN for the meaning of the parameter.

3. VC Print Excel:

Call the Shell's print function:

Copy Code code as follows:
ShellExecute (NULL, "print", "C://temp//test.txt", null,null,sw_hide);

Note that the printer is already installed on the machine. The printout is sent to the default printer. In addition, Shellexcute can also be used to print Excel and Word, replacing the corresponding filename.
Copy Code code as follows:
ShellExecute (NULL, "print", "C://temp//test.xls", null,null,sw_hide);
ShellExecute (NULL, "print", "C://temp//test.doc", null,null,sw_hide);

I hope this article on the VC program for everyone to help.

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.