不会吧?没有人理会?只有自己顶了...
希望大家帮忙呀,小弟谢谢先1

解决方案 »

  1.   

    这是JACOB操作EXCEL文件的,希望对你有用
    packagecom.livedoor.finance.credit.admin.business.event.util;importcom.jacob.com.Variant;
    importcom.jacob.com.Dispatch;
    importcom.jacob.com.ComThread;
    importcom.jacob.activeX.ActiveXComponent;/**
    *@authorDarren.Wang
    * 2005/03/17
    *ThankstoSamir(whoisinAustralia),withouthishelp,Ican'tcompletethiswork.
    */
    publicclassJacobExcelLauncher{
    //excelautomation
    privateActiveXComponentexcel;
    //excelworkbooks
    privateDispatchworkbooks;
    //excelfilevarient
    privateVariantworkbook;/*
    *constructoroftheJacobExcelLauncher
    *@authorDarren.Wang
    */
    publicJacobExcelLauncher()
    {
    //starttheExcel
    excel=newActiveXComponent("Excel.Application";
    //firsttime,weneedsettheexceltobeinvisible
    excel.setProperty("Visible",newVariant(false));
    //getworkbooks
    workbooks=excel.getProperty("WorkBooks".toDispatch();
    }/*
    *LaunchExcelfilewiththismethod,
    *itcanbeinvokedmanytimes
    */
    publicvoidlaunch(StringfileName)
    {
    //nowmakeitappear
    excel.setProperty("Visible",newVariant(true));
    //opentheexcelfile
    workbook=Dispatch.callN(workbooks,"Open",newObject[]{fileName});
    }/*
    *Releasetheresourcesandkilltheexcelprocess
    */
    publicvoidrelease()
    {
    //quittheexcelapplication
    excel.invoke("Quit",newVariant[]{});
    //invokethemethodtocountdownthenumbersofthereference,
    //andreleasethemonebyonetokilltheexcelprocessfinally.
    ComThread.Release();
    }publicstaticvoidmain(String[]args){
    JacobExcelLauncherlauncher=newJacobExcelLauncher();
    launcher.launch("c:/workbook.xls";
    launcher.launch("c:/workbook2.xls";
    launcher.release();
    }
    }