NativeExcel2 for .Net Developer's Reference

IPageSetup.SetPrintAreaMethod

Sets the range to be printed by using row and column indexes.

[Visual Basic]
SubSetPrintArea(_
ByValRowStartAsInteger,_
ByValColStartAsInteger,_
ByValRowEndAsInteger,_
ByValColEndAsInteger_
)
[C#]
voidSetPrintArea(
intRowStart,
intColStart,
intRowEnd,
intColEnd
);
[C++]
voidSetPrintArea(
intRowStart,
intColStart,
intRowEnd,
intColEnd
);
[JScript]
functionSetPrintArea(
intRowStart,
intColStart,
intRowEnd,
intColEnd
);

Parameters

RowStart
Integer. Indicates the index of the first row (one-based).
ColStart
Integer. Indicates the index of the first column (one-based).
RowEnd
Integer. Indicates the index of the last row (one-based).
ColEnd
Integer. Indicates the index of the last column (one-based).

Example

This example sets the print area to cells A1:C5 on worksheet one.

[C#]
book.Worksheets[1].PageSetup.SetPrintArea(1,1,5,3);
[VisualBasic]
book.Worksheets(1).PageSetup.SetPrintArea(1,1,5,3)
[C++]
book->Worksheets->Item[1]->PageSetup->SetPrintArea(1,1,5,3);

See Also

IPageSetup Interface | NativeExcel Namespace | PageSetup Property | PrintArea Property | PrintAreaDefined Property