NativeExcel for .Net Developer's Reference

IPageSetup.SetPrintArea Method 

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

[Visual Basic]
Sub SetPrintArea( _ 
   ByVal RowStart As Integer, _ 
   ByVal ColStart As Integer, _ 
   ByVal RowEnd As Integer, _ 
   ByVal ColEnd As Integer _ 
)
[C#]
void SetPrintArea(
   int RowStart,
   int ColStart,
   int RowEnd,
   int ColEnd
);
[C++]
void SetPrintArea(
   int RowStart,
   int ColStart,
   int RowEnd,
   int ColEnd
);
[JScript]
function SetPrintArea(
   int RowStart,
   int ColStart,
   int RowEnd,
   int ColEnd
);

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);
[Visual Basic]
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