如何关闭导出到excel的文件 [英] how to close file which is exporting to excel

查看:110
本文介绍了如何关闭导出到excel的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 我写了一个代码,用C#编码将数字转换为文本excel单元格
然后在关闭任务管理器中仍然存在的文件后,将这些数据导出为ex​​cel数据后,如何结束此操作
我声明的代码是

  if (Dt.Columns [j] .ColumnName ==& quot; Serial In& quot; || Dt.列[j] .ColumnName ==&"Serial Out&")
                           {
                               Xl.SetCellValueToTextOnActiveSheet( 2  + i, 1  + j,Row [j] .ToString());
                           }
                           其他
                           {
                               Xl.SetCellValueOnActiveSheet( 2  + i, 1  + j,Row [j] .ToString());
                           } 



[edit]已修复代码块-OriginalGriff [/edit]

解决方案

hi,

导出到excel后


 Process [] prs = Process.GetProcesses();
 foreach (处理pr  in  prs)
{
如果(pr.ProcessName == " )
pr.Kill();
} 



试试这个代码.


hi i wrote a code to convert number to text excel cells in c# coding
then after these data exporting to excel the data after closing the file which is still existing inthe task manager process how to end this
the code which i declared is

if (Dt.Columns[j].ColumnName == "Serial In" || Dt.Columns[j].ColumnName == "Serial Out")
                           {
                               Xl.SetCellValueToTextOnActiveSheet(2 + i, 1 + j, Row[j].ToString());
                           }
                           else
                           {
                               Xl.SetCellValueOnActiveSheet(2 + i, 1 + j, Row[j].ToString());
                           }



[edit]Code block fixed - OriginalGriff[/edit]

解决方案

hi,

after exporting to excel


Process[] prs = Process.GetProcesses();
foreach(Process pr in prs)
{
if(pr.ProcessName == "****ProcessName")
pr.Kill();
}



try this code..


这篇关于如何关闭导出到excel的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆