Spire.Spreadsheet is a powerful component to view spreadsheet. As a standalone spreadsheet class library, Spire.Spreadsheet is a companion component to Spire.XLS, which mainly focus on how to display spreadsheet.

Thu Oct 18, 2018 5:23 am

Hey

is it possibel to show or hide rows or columne?

thank you GH

GHWels
 
Posts: 90
Joined: Sun Nov 23, 2014 7:22 pm

Thu Oct 18, 2018 8:31 am

Hello,

Thanks for your inquiry.
Our Spire.Spreadsheet supports showing and hiding rows/columns. You could refer to the following guide to add Spire.Spreadsheet controls to Toolbox, and then to view and show/hide the rows/columns of your Excel file. If you have other questions, just feel free to contact us.
How to Open and View Excel in Windows Form using Spire.Speadsheet

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Thu Oct 18, 2018 9:49 am

Sorry
my question was not accurate enough.
I want to control the columns or rows visibly or invisibly by vb.net code
Sincerely,
GH

GHWels
 
Posts: 90
Joined: Sun Nov 23, 2014 7:22 pm

Thu Oct 18, 2018 11:04 am

Hello,

Thanks for your quick response.
If you just want to set the columns and rows visibly/invisibly by code, but not need to view the Excel at the same time. You could refer to below code of our Spire.XLS to achieve.
Code: Select all
Dim workbook As New Workbook()
workbook.LoadFromFile("sample.xlsx")
Dim sheet As Worksheet = workbook.Worksheets(0)
sheet.HideRow(2)
sheet.HideColumn(3)
sheet.ShowRow(4)
sheet.ShowColumn(5)
workbook.SaveToFile("result.xlsx", Spire.Xls.FileFormat.Version2013)

Otherwise, if you need to view the Excel file when setting the columns and rows visibly/invisibly, you have to use our Spire.Spreadsheet. It supports hiding and showing the columns and rows directly, you also could set them by yourself. Below is the code snippet for your better reference.
Code: Select all
Private Sub hideRowToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Handles hideRowToolStripMenuItem.Click
   For i As Integer = spreadsheet1.ActiveWorksheet.GetSelectedRange().Top To spreadsheet1.ActiveWorksheet.GetSelectedRange().Bottom
      spreadsheet1.ActiveWorksheet.Rows(i).IsHidden = True
   Next i
End Sub

Private Sub hideColumnsToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Handles hideColumnsToolStripMenuItem.Click
   For i As Integer = spreadsheet1.ActiveWorksheet.GetSelectedRange().Left To spreadsheet1.ActiveWorksheet.GetSelectedRange().Right
      spreadsheet1.ActiveWorksheet.Columns(i).IsHidden = True
   Next i
End Sub

Private Sub unhideRowsToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Handles unhideRowsToolStripMenuItem.Click

   For i As Integer = spreadsheet1.ActiveWorksheet.GetSelectedRange().Top To spreadsheet1.ActiveWorksheet.GetSelectedRange().Bottom
      spreadsheet1.ActiveWorksheet.Rows(i).IsHidden = False
   Next i
End Sub

Private Sub unhideColumnsToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Handles unhideColumnsToolStripMenuItem.Click
   For i As Integer = spreadsheet1.ActiveWorksheet.GetSelectedRange().Left To spreadsheet1.ActiveWorksheet.GetSelectedRange().Right
      spreadsheet1.ActiveWorksheet.Columns(i).IsHidden = False
   Next i
End Sub

If there is any doubt, welcome to write back.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Fri Oct 19, 2018 9:44 am

Thanks for your quick response.
It works perfekt
GH

GHWels
 
Posts: 90
Joined: Sun Nov 23, 2014 7:22 pm

Fri Oct 19, 2018 9:57 am

Hi,

Glad to hear from you.
Please feel free to contact us in case of any question.

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1182
Joined: Tue Sep 27, 2016 1:06 am

Return to Spire.Spreadsheet