Concrete realization
First, the operation class header file containing Excel files.
#Include 'cspreadSheet.h '
Secondly, create a new Excel file and write the default data.
//File name and path of the new excel, and testsheet is the name of the internal table.
cspreadSheet SS('c:\\Test.xls ',' test sheet ');
cstringArray SampleArray,testRow
ss . begin transaction();
//Add a title
Sample array. remove all();
Example array.add ('name');
Sample array. Add ('('age')'
SS. add headers(sample array);
//Add data
CString strname = {'Xu Jingzhou',' Seo Ji-Hye',' Guo Hui',' Niu Yingjun',' Zhu Xiaopeng'};
cstring strAg = {'27 ',' 23 ',' 28 ',' 27 ',' 26 ' };
for(int I = 0; I< sizeof (strname)/sizeof (cstring); i++; )
{
Sample array. remove all();
Sample array. add(strName[I]);
Sample array. add(strAge[I]);
SS. AddRow(sample array);
}
SS. commit();