开发者

Set active printer in PrintOut OLE function

I use PrintOut function

Excel::_ApplicationPtr app("Excel.Application");

app->Visible[0] = false;

Excel::_WorkbookPtr book = app->Workbooks->Add();
Excel::_WorksheetPtr sheet = book->Worksheets->Item[1];
....

book->Worksheets->PrintOut(1, 1, 1, false, NULL, NULL, NULL, false, false);

But it's wrong. The defeniton of this function is:

PrintOut ( const _variant_t & From, const _variant_t & To, const _variant_t & Copies, const _variant_t & Preview, const _variant_t & ActivePrinter, const _variant_t 开发者_运维问答& PrintToFile, const _variant_t & Collate, const _variant_t & PrToFileName, const _variant_t & IgnorePrintAreas, long lcid );

How I can right set ActivePrinter ?


According to this MSDN article Active Printer is in fact the name of the printer you want to use, so it is a string and it is also an optional parameter, so I guess you can just pass empty variant there:

book->Worksheets->PrintOut( .., _variant_t(), ... );
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜