Dynamics AX Knowledge

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

    COM     excelApplication ;
    COM     workBooks ;
    COM     workSheets ;
    COM     workSheet ;
    COM     workBook ;
    COM     activesheet ;
    COM     cells ;
    COM     cell ;
    COM     selections ;
    COM     Range ;
    COM     Font ;
    int     a,b  ;
    ;

    excelApplication        = new COM("excel.application") ;
    excelApplication.visible(true);
    workBooks               = excelApplication.workbooks();
    workBooks.open("C:\\AX.xls");    //create a xls file first


    workBook                = workbooks.item(1) ;


    workSheets              = workBook.worksheets() ;
    //workSheet               = workSheets.add();  //add a sheet, yes or no
    activesheet             = worksheets.item(1) ;

    b       = 0 ;

//export var data
    for(a=1;a<30;a++)
    {
        b                       = b+1 ;
        range                   = activesheet.range("A"+int2str(a)) ;
        range.value2(int2str(b+1)) ;
        font = range.font();
        font.size(20);
        font.name("Arial") ;
    }
//The below is export database data
    while select name from empltable where empltable.EmplId == '028'
    {
        range                   = activesheet.range("A1") ;
        range.value2(empltable.Name) ;
        font = range.font();
        font.size(20);
        font.name("Arial") ;
    }

//quit and save
    workBook.save() ;
    workBook.close() ;
    excelApplication.quit();

posted on 2007-11-30 11:48  Jacky Xu  阅读(515)  评论(0编辑  收藏  举报