NativeExcel2 for .Net Developer's Reference

IPageBreaks.Item Property

Returns a single page break from the collection.

[C#] In C#, this property is the indexer for the IPageBreaks class.

[Visual Basic]
DefaultPropertyReadOnlyItem(_
ByValindexAsInteger_
)AsIPageBreak
[C#]
IPageBreakthis[
intindex
]{get;}
[C++]
__propertyIPageBreak*get_Item(
intindex
);
[JScript]
returnValue = IPageBreaksObject.Item( index );
-or-
returnValue = IPageBreaksObject( index );

[JScript] In JScript, you can use the default indexed properties defined by a type, but you cannot explicitly define your own. However, specifying the expando attribute on a class automatically provides a default indexed property whose type is Object and whose index type is String.

Parameters

index
The one-based index number of the IPageBreak interface.

Property Value

IPageBreak interface.

Example

This example copies all vertical page breaks from first sheet to second.

[C#]
 IWorksheet sheet1 = book.Worksheets[1];
 IWorksheet sheet2 = book.Worksheets[2];
 for (int i = 1; i <= sheet1.VPageBreaks.Count; i++) {
     sheet2.VPageBreaks.Add(sheet1.VPageBreaks[i].Location);
 }  
[VisualBasic]
 Dim sheet1 As IWorksheet = book.Worksheets(1)
 Dim sheet2 As IWorksheet = book.Worksheets(2)
 Dim i As Integer = 1
 While i <= sheet1.VPageBreaks.Count
     sheet2.VPageBreaks.Add(sheet1.VPageBreaks(i).Location)
     i = i + 1
 End While  
[C++]
 IWorksheet* sheet1 = book->Worksheets->Item[1];
 IWorksheet* sheet2 = book->Worksheets->Item[2];
 for (int i = 1; i <= sheet1->VPageBreaks->Count; i++) {
     sheet2->VPageBreaks->Add(sheet1->VPageBreaks->Item[i]->Location);
 }  

See Also

IPageBreaks Interface | NativeExcel Namespace | IWorksheet.HPageBreaks | IWorksheet.VPageBreaks | IPageBreak Interface