Home > Back-end >  OLE how to choose the Excel multiple worksheet at the same time?
OLE how to choose the Excel multiple worksheet at the same time?

Time:09-27

OLE how to choose the Excel multiple worksheet at the same time?

CodePudding user response:

Give you a simple example:
 vExcelApp. OlePropertySet (" Visible ", true); 

String xlsFile=L "D: \ \ ccrun \ \ 123. XLS";
VExcelApp. OlePropertyGet (" Workbooks "). OleFunction (" Open ", WideString (xlsFile));

Int Bounds [2]={0, 2};
The Variant sheetIndexs=VarArrayCreate (Bounds, 1, varInteger);

//select the first three Sheet
SheetIndexs. PutElement (1, 0);
SheetIndexs. PutElement (2, 1);
SheetIndexs. PutElement (3, 2);

The Variant vSheets=vExcelApp. OlePropertyGet (" Sheets ", sheetIndexs);

SafeArrayDestroyData (sheetIndexs parray);

VSheets. OleProcedure (" Select ");

CodePudding user response:

Thank demon elder brother, although look not to understand. But the code is available. But I use vSheets OleFunction (" PrintOut "); Print to PDF printer. Actually separated three PDF files. How do I can merge into a PDF file?

CodePudding user response:

Use API method to print, is also a Sheet a file...

CodePudding user response:

Behind the code on the 1st floor after me, and then add a line:
 vExcelApp. OlePropertyGet (" ActiveWindow "). OlePropertyGet (" SelectedSheets "). OleProcedure (" PrintOut "); 

CodePudding user response:

reference 4 floor ccrun response:
following behind the code of 1/f, I add a line:
 vExcelApp. OlePropertyGet (" ActiveWindow "). OlePropertyGet (" SelectedSheets "). OleProcedure (" PrintOut "); 


Demon elder brother to help us take a look at the following problems of bai, thank you,
http://bbs.csdn.net/topics/391889269
  • Related