文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>asp.net生成xls文件完成后自动关闭excel进程代码

asp.net生成xls文件完成后自动关闭excel进程代码

时间:2010-09-01  来源:蔚蓝的大海

asp教程.net生成xls文件完成后自动关闭excel进程代码
//方法一

gc.collect();
        applicationclass excel;
        _workbook xbk;
        _worksheet xst;
        excel = new applicationclass();
        xbk = excel.workbooks.add(true);
        xst = (_worksheet)xbk.activesheet;
           //自定义代码...
        //结束时
        xbk.close(false, null, null);
        excel.quit();
        system.runtime.interops教程ervices.marshal.releasecomobject(xbk);
        system.runtime.interopservices.marshal.releasecomobject(excel);
        system.runtime.interopservices.marshal.releasecomobject(xst);
        xbk = null;
        excel = null;
        xst = null;

//方法二

 

finally
            {
                ((microexcel._application)tempapp).workbooks.close();
                int32 tempgeneration = gc.getgeneration(tempapp);
                ((microexcel._application)tempapp).quit();
                gc.collect(tempgeneration);
                //上面部分在winform中就已经干掉excel进程了,但是在asp.net教程中还不行          
                process[] myprocesses;
                myprocesses = process.getprocessesbyname("excel");

                //得不到excel进程id,暂时只能判断进程启动时间
                foreach (process myprocess in myprocesses)
                {
                    try
                    {
                        datetime starttime = myprocess.starttime;

                        if (starttime >= tempstart && starttime <= tempend)
                        {
                            myprocess.kill();
                        }
                    }//直接在vs中运行网页就不会有取不到starttime的问题
                    catch//有一些核心进程是不允许访问的,因此而引起的异常可以捕获并放弃处理
                    { }
                }
                    
            }


USB 2.0 + Firewire 1394 2.5" IDE Hard Drive EnclosureDP to HDMI Male to Female adapter connector with long life time OEMSurfboard USB Flash DrivePower supply with 5.5*2.5 connector DC9V to AC 220V charger KW-008 UL seriesUSB 2.0 2.5" SATA HARD DISK DRIVE HDD CASE EnclosureHDMI 19P/F SMT with screw hole H5.08mm HDMI high definition data plug HDMI connectorMini 5P A/M short body wire solder USB connector cellphone connector mini usb adapterTokidoki Mimobot 2GB USB Flash DriveHDMI Female to Female angle bend adapter connector with long life time OEMMini 5P AB/F SMT USB connector cellphone connector mini usb adapter mini usb portMini USB Bluetooth Wireless PC Adapter Dongle15 pin Male to Female HD VGA Monitor Cable3.5"/2.5" All in one IDE/SATA HDD Dual Docking Statio8DBi Radar direction antenna wireless lan card detachable antenna DSSS spread spectrumPower supply PGD-50 series chargerUseful 4 Ports USB Hub with Cellphone Skidproof Dock for Your Office DeskSilver and Black Vertical Type 4 Ports 7 Ports USB 2.O Hub for PC LaptopsNice Butterfly Shaped 4 Ports USB HubUSB A Male to Mini USB 5 Pin Male Cable whiteSamsung 10,12,14P straight head USB connector cellphone connector mobile connectorOctopus Paul usb flash drive disk well-known for 2010 world cup fashion designUSB A/F Dual port wire solder connector RoHS compliant OEM adapter connector5*RCA Female to 15 pin Male HD VGA Video Audio Monitor CableUSB 54M wireless lan card built-in smart chip antenna widely coverage areaUSB A/M wire solder foldable type connector RoHS compliant OEM adapter connectorIDE to SATA adapter card high-speed plug and play serial ATA standard transmission cardUSB A/F SMT short body connector ( L=13.6mm) RoHS compliant adapter connector12*RCA F to 15 pin Male HD VGA Video Audio Monitor Cable4*BNC F to 15 pin Male HD VGA Video Audio Monitor CableIDE to SATA 5001 adapter card high-speed support ATA 66/100/133 transmission cardDVI24+1 Female right angle DVI plug DVI connector pin DVI connectorColor Leather 256Mb USB 2.0 Flash Storage Drive With ChainMini 18P Female SMT USB connector mini usb port type cellphone connector adapterUSB B/M long body wire solder three-piece connector plug OEM adapter connectorHDMI19M TO DVI(18+1)M+CORE-21 cableLG 12P Male assembly connector cellphone connector LG mobile phone connectorUSB 3.0 A Male to A Female Extension Cable Blue for PrinterStylish 4Gb USB 2.0 Flash Storage Drive868 IDE to SATA adapter plug and play high-speed 2A transformer transmission cardUniversal adapter 761 DC 12V to AC 220V charger 100*63*40 mmUSB Aluminum Enclosure Case for 1.8" ZIF Hard Drive HDD BlueUSB APPL Cable Male to APPLE MaleMini 5P B/M short body wire solder USB connector cellphone connector mini usb adapterDVI24+1 Male 180°plugboard heightening type connector pin OEM adapter connectorColorful Alarm 4 Ports USB 2.0 Hub for PC LaptopUSB B/M short body wire solder (L=20.7mm)connector plug OEM adapter connectorPCI serial Male card with CH352L main chip SMD chip plug and play PCI cardUSB3.0 F 90° DIP connector RoHS compliant OEM adapter connectorHDMI to 2*DVI adapter connector with long life time OEMMini 14P Male wire solder USB connector cellphone connector mini usb port type usb cable connector

Replica lv Hangbags

Replica Hangbags

Hangbags

replica handbags

replica handbags

replica handbags

replica handbags

replica handbags

replica handbags

replica handbags

replica handbags

usb cable

usb cable

usb cable

usb cable

usb flash drives

usb flash drives

usb flash drives

usb flash drives usb flash drives usb flash drives usb flash drives usb flash drives usb flash drives
相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载