Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

The Save method of CNiExcelWorkBook couldn't work correctly.

The following is my code: CNiExcelApplication _application(false); CNiExcelWorkbook _workBook(_application.OpenWorkbook(path.GetBuffer())); // path是已经存在的一个excel文件 CNiExcelWorksheet _workSheet(_workBook.GetWorksheet(1)); CNiExcelCellRange range = _workSheet.GetRange("A1"); range.SetCellValue("Hello"); _workBook.save(path.GetBuffer(), CNiExcelWorkbook ::DefaultFileFormat); // line 10 There always pops up "class CNiExcelWorkbook saveas method is invalid". But when I change line 10 by code line 11 _workBook.Close(CNiExcelWorkbook::SaveChanges); // line 11 Everything work correctly. I want to save the excel file but I don't want to close file while saving. Could anyone tell me what is wrong with my code ? BTW, Is it possible to check if an excel file is already opened or not? (by double click, not by openworkbook method of CNiExcelApplication like above). If the excel file is already opened , is it possible to save file without closing the file?
0 Kudos
Message 1 of 1
(4,489 Views)