谁能帮我解释一下下面代码的意思,我看不懂,所以有错都调试不来,在每一行后面//注释一下,麻烦了void CTestExcelDlg::OnButton1() {// TODO: Add your control notification handler code here_Application app;Workbooks boo

来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/15 12:27:45
谁能帮我解释一下下面代码的意思,我看不懂,所以有错都调试不来,在每一行后面//注释一下,麻烦了voidCTestExcelDlg::OnButton1(){//TODO:Addyourcontrol

谁能帮我解释一下下面代码的意思,我看不懂,所以有错都调试不来,在每一行后面//注释一下,麻烦了void CTestExcelDlg::OnButton1() {// TODO: Add your control notification handler code here_Application app;Workbooks boo
谁能帮我解释一下下面代码的意思,我看不懂,所以有错都调试不来,在每一行后面//注释一下,麻烦了
void CTestExcelDlg::OnButton1()
{
// TODO: Add your control notification handler code here
_Application app;
Workbooks books;
_Workbook book;
Worksheets sheets;
_Worksheet sheet;
Range range;
Font font;
Range cols;
COleVariant covOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR);
if( !app.CreateDispatch("Excel.Application") ){
this->MessageBox("无法创建Excel应用!");
return;
}
books=app.GetWorkbooks();
book=books.Add(covOptional);
sheets=book.GetSheets();
sheet=sheets.GetItem(COleVariant((short)1));
range=sheet.GetRange(COleVariant("A1"),COleVariant("A1"));
range.SetValue(COleVariant("HELLO EXCEL!"));
font=range.GetFont();
font.SetBold(COleVariant((short)TRUE));
range=sheet.GetRange(COleVariant("A2"),COleVariant("A2"));
range.SetFormula(COleVariant("=RAND()*100000"));
range.SetNumberFormat(COleVariant("$0.00"));
cols=range.GetEntireColumn();
cols.AutoFit();
app.SetVisible(TRUE);
app.SetUserControl(TRUE);
}

谁能帮我解释一下下面代码的意思,我看不懂,所以有错都调试不来,在每一行后面//注释一下,麻烦了void CTestExcelDlg::OnButton1() {// TODO: Add your control notification handler code here_Application app;Workbooks boo
是否是strtus添加