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 );