Quantcast
Channel: Measurement Studio for VC++ topics
Viewing all articles
Browse latest Browse all 660

The Save method of CNiExcelWorkBook couldn't work correctly

$
0
0
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 ::smileyvery-happy:efaultFileFormat); // 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::smileyfrustrated:aveChanges); // 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

Viewing all articles
Browse latest Browse all 660

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>