I justed started working with CVI and Excel and I am Using the Excel Report Library.
Basically, what I am doing is: I open existing Excel Templates, edit the docs and save and close it (see code below).
Currently I have a workbook handle for each workbook that I open, but I am using only 1 application handle for all the workbooks. It works so far but I am not sure whether I will run into troubles later.
1. Is it necessary to create multiple application handles for each workbook?
2. When talking about the "application", what does it refer to? The Excel Application? If yes, another application would be Word or another instance of Excel?
/*Declaration Handles*/ static CAObjHandle workbookHandle2; static CAObjHandle workbookHandle3; static CAObjHandle workbookHandle4; static CAObjHandle applicationHandle; /*Create new app*/ ExcelRpt_ApplicationNew(VTRUE,&applicationHandle); /*open existing wb*/ ExcelRpt_WorkbookOpen(applicationHandle,"C:\\testfile123.xltx", &workbookHandle2); ExcelRpt_WorkbookOpen(applicationHandle,"C:\\testfile123.xlt", &workbookHandle3); ExcelRpt_WorkbookOpen(applicationHandle,"C:\\testfile123.xltm", &workbookHandle4); /*save templates*/ ExcelRpt_WorkbookSave(workbookHandle2, "testfile2.xlsx", ExRConst_DefaultFileFormat); ExcelRpt_WorkbookSave(workbookHandle3, "testfile3.xlsx", ExRConst_DefaultFileFormat); ExcelRpt_WorkbookSave(workbookHandle4, "testfile4.xlsx", ExRConst_DefaultFileFormat);
Thanks,
ZerMahlMer