- Demo
- C# source
- VB.Net source
The sample demonstrates how to hide worksheet column in Excel workbook via Spire.XLS.
using Spire.Xls; namespace HideColumn { class Program { static void Main(string[] args) { Workbook workbook = new Workbook(); workbook.LoadFromFile(@"..\..\..\..\Data\vendors.xls"); Worksheet sheet = workbook.Worksheets[0]; //hide the first column of sheet sheet.HideColumn(1); //hide the sixth column of sheet sheet.HideColumn(6); workbook.SaveToFile("sample.xls", ExcelVersion.Version97to2003); System.Diagnostics.Process.Start(workbook.FileName); } } }
Imports Spire.Xls Namespace HideColumn Friend Class Program Shared Sub Main(ByVal args() As String) Dim workbook As New Workbook() workbook.LoadFromFile("..\..\..\..\Data\vendors.xls") Dim sheet As Worksheet = workbook.Worksheets(0) 'hide the first column of sheet sheet.HideColumn(1) 'hide the sixth column of sheet sheet.HideColumn(6) workbook.SaveToFile("sample.xls", ExcelVersion.Version97to2003) System.Diagnostics.Process.Start(workbook.FileName) End Sub End Class End Namespace