VerticalPageBreakCollection.Item

VerticalPageBreakCollection indexer (1 of 2)

Gets the VerticalPageBreak element at the specified index.

public VerticalPageBreak this[int index] { get; }
ParameterDescription
indexThe zero based index of the element.

Return Value

The element at the specified index.

Examples

using System;
using Aspose.Cells;

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

            // Add vertical page breaks
            worksheet.VerticalPageBreaks.Add(5);
            worksheet.VerticalPageBreaks.Add(10);
            worksheet.VerticalPageBreaks.Add(15);

            // Access and display page breaks using Item property
            VerticalPageBreakCollection vpagebreaks = worksheet.VerticalPageBreaks;
            Console.WriteLine("Vertical Page Breaks:");
            for (int i = 0; i < vpagebreaks.Count; i++)
            {
                Console.WriteLine($"Break {i + 1}: Column = {vpagebreaks[i].Column}");
            }

            // Remove and re-add to modify a page break since Column is read-only
            int column = vpagebreaks[1].Column;
            vpagebreaks.RemoveAt(1);
            vpagebreaks.Add(12);
            Console.WriteLine("\nAfter modification:");
            Console.WriteLine($"Break 2: Column = {vpagebreaks[1].Column}");
        }
    }
}

See Also


VerticalPageBreakCollection indexer (2 of 2)

Gets the VerticalPageBreak element with the specified cell name.

public VerticalPageBreak this[string cellName] { get; }
ParameterDescription
cellNameCell name.

Return Value

The element with the specified cell name.

See Also