Cells.HideRows

Cells.HideRows method

Hides multiple rows.

public void HideRows(int row, int totalRows)
ParameterTypeDescription
rowInt32The row index.
totalRowsInt32The row number.

Examples

using System;
using Aspose.Cells;

namespace AsposeCellsExamples
{
    public class CellsMethodHideRowsWithInt32Int32Demo
    {
        public static void Run()
        {
            // Create a new workbook
            Workbook workbook = new Workbook();
            Worksheet worksheet = workbook.Worksheets[0];

            // Populate some data
            for (int i = 0; i < 10; i++)
            {
                for (int j = 0; j < 5; j++)
                {
                    worksheet.Cells[i, j].Value = $"Row {i+1}, Col {j+1}";
                }
            }

            // Hide rows 3 to 5 (zero-based index: 2 to 4)
            worksheet.Cells.HideRows(2, 3);

            // Save the workbook
            workbook.Save("HideRowsExample.xlsx");
        }
    }
}

See Also