从 spire.xls 版本 10.9.0开始,新加了属性workbook.ishidewindow,支持隐藏和取消隐藏excel窗口。该文将详细介绍如何使用c#/vb.net 隐藏excel当前窗口。
c#
using spire.xls;
namespace hidewindow
{
class program
{
static void main(string[] args)
{
//加载示例文档
workbook workbook = new workbook();
workbook.loadfromfile("sample.xlsx");
//隐藏窗口
workbook.ishidewindow = true;
//保存文档
workbook.savetofile("result.xlsx", excelversion.version2013);
}
}
}
vb.net
imports spire.xls
namespace hidewindow
class program
private shared sub main(byval args() as string)
'加载示例文档
dim workbook as workbook = new workbook
workbook.loadfromfile("sample.xlsx")
'隐藏窗口
workbook.ishidewindow = true
'保存文档
workbook.savetofile("result.xlsx", excelversion.version2013)
end sub
end class
end namespace
效果图: