从 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
效果图: