zoukankan      html  css  js  c++  java
  • Excel with COM

    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();

  • 相关阅读:
    Quartz.net任务调度
    基于Task定时检测网络本地网络状况
    java基于NIO的分散读取文件,然后统一聚合后写入文件
    基于直接缓冲区和非直接缓冲区的javaIO文件操作
    java 读取xml
    WPF 通过线程使用ProcessBar
    NPOI自适应列宽
    C#序列化与反序列化以及深拷贝浅拷贝
    Springboot feign 传递request信息
    apereo cas 小记01--服务器搭建01
  • 原文地址:https://www.cnblogs.com/lingdanglfw/p/4702072.html
Copyright © 2011-2022 走看看