Cells.GroupColumns

GroupColumns(int, int)

Groups columns.

public void GroupColumns(int firstIndex, int lastIndex)
ParameterTypeDescription
firstIndexInt32The first column index to be grouped.
lastIndexInt32The last column index to be grouped.

Examples

using System;
using Aspose.Cells;

namespace AsposeCellsExamples
{
    public class CellsMethodGroupColumnsWithInt32Int32Demo
    {
        public static void Run()
        {
            // Create a new workbook
            Workbook workbook = new Workbook();
            
            // Access the first worksheet
            Worksheet worksheet = workbook.Worksheets[0];
            Cells cells = worksheet.Cells;

            // Group columns from index 0 to 255
            cells.GroupColumns(0, 255);

            // Save the workbook
            string outputPath = "outputGroupColumns.xlsx";
            workbook.Save(outputPath);

            Console.WriteLine("Columns grouped successfully. File saved to: " + outputPath);
        }
    }
}

See Also


GroupColumns(int, int, bool)

Groups columns.

public void GroupColumns(int firstIndex, int lastIndex, bool isHidden)
ParameterTypeDescription
firstIndexInt32The first column index to be grouped.
lastIndexInt32The last column index to be grouped.
isHiddenBooleanSpecifies if the grouped columns are hidden.

Examples

using System;
using Aspose.Cells;

namespace AsposeCellsExamples
{
    public class CellsMethodGroupColumnsWithInt32Int32BooleanDemo
    {
        public static void Run()
        {
            // Create a new workbook
            Workbook workbook = new Workbook();
            
            // Access the first worksheet
            Worksheet worksheet = workbook.Worksheets[0];
            Cells cells = worksheet.Cells;

            // Group columns 5 to 7 (3 columns) and hide them
            cells.GroupColumns(5, 7, true);

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

See Also