净Excel的互操作删除工作表 [英] .Net Excel Interop Deleting a worksheet

查看:231
本文介绍了净Excel的互操作删除工作表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从.NET删除一个excel文件的工作表的C#3.5的应用程序与互操作Excel的类(Excel 2003中)。

I'm trying to delete a worksheet from a excel document from a .Net c# 3.5 application with the interop Excel class (for excel 2003).

我尝试了很多的东西,如:

I try many things like :

Worksheet worksheet = (Worksheet)workbook.Worksheets[1];
worksheet.Delete();

这不工作,不抛出任何错误...

It's doesn't work and doesn't throw any error ...

推荐答案

在一个多小时的样子,我找到了答案:

After more than one hour looking I found the answer:

xlApp.DisplayAlerts = false;
worksheet.Delete();
xlApp.DisplayAlerts = true;

这篇关于净Excel的互操作删除工作表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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