# Printing a Range of Cells on a Sheet

Learn how to print a specified range of cells on a sheet using the Spread component's PrintInfo and PrintSheet method. Find out how to set the cell range and print the sheet using various programming languages.

## Content

You may not want to print the entire sheet but only a specified range of cells on a sheet. You can specify that only a range of cells within a sheet prints, rather than the entire sheet. After specifying the range of cells with the [PrintInfo](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.PrintInfo.html) object, use the [PrintSheet](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.FpSpread.PrintSheet.html) method as described in [Printing an Entire Sheet](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-printing/spwin-printactions/spwin-printsheet).

## Using the Properties Window

1. At design time, in the **Properties** window, select the Spread component.
2. Select the **Sheets** property.
3. Click the button to display the **SheetView Collection Editor**.
4. In the **Members** list, select the sheet for which to set the print the cell range.
5. In the properties list, double-click the **PrintInfo** property to display the settings for the **PrintInfo** class.
6. Set the **PrintType** property to **PageRange**.
7. Set the **ColStart**, **RowStart**, **ColEnd**, and **RowEnd** properties to designate the cell range to print.
8. Click **OK** to close the editor.

## Using a Shortcut

* Create a [PrintInfo](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.PrintInfo.html) object.
* Set the PrintInfo object [PrintType](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.PrintInfo.PrintType.html) property to PrintType.CellRange.
* Set the PrintInfo object [ColStart](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.PrintInfo.ColStart.html), [RowStart](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.PrintInfo.RowStart.html), [ColEnd](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.PrintInfo.ColEnd.html), and [RowEnd](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.PrintInfo.RowEnd.html) properties to designate the cell range to print.
* Set the Sheet shortcut object **PrintInfo** property to the PrintInfo object you just created.

**Example**
This example code prints cells B2 through D4.

```csharp
// Create PrintInfo object and set properties.
FarPoint.Win.Spread.PrintInfo printset = new FarPoint.Win.Spread.PrintInfo();
printset.PrintType = FarPoint.Win.Spread.PrintType.CellRange;
printset.ColStart = 1;
printset.ColEnd = 3;
printset.RowStart = 1;
printset.RowEnd = 3;
// Set the PrintInfo property for the first sheet.
fpSpread1.Sheets[0].PrintInfo = printset;
// Print the sheet.
fpSpread1.PrintSheet(0);
```

```vbnet
' Create PrintInfo object and set properties.
Dim printset As New FarPoint.Win.Spread.PrintInfo()
printset.PrintType = FarPoint.Win.Spread.PrintType.CellRange
printset.ColStart = 1
printset.ColEnd = 3
printset.RowStart = 1
printset.RowEnd = 3
' Set the PrintInfo property for the first sheet.
fpSpread1.Sheets(0).PrintInfo = printset
' Print the sheet.
fpSpread1.PrintSheet(0)
```

## Using Code

1. Create a [PrintInfo](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.PrintInfo.html) object.
2. Set the PrintInfo object [PrintType](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.PrintInfo.PrintType.html) property to PrintType.CellRange.
3. Set the PrintInfo object [ColStart](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.PrintInfo.ColStart.html), [RowStart](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.PrintInfo.RowStart.html), [ColEnd](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.PrintInfo.ColEnd.html), and [RowEnd](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.PrintInfo.RowEnd.html) properties to designate the cell range to print.
4. Set the SheetView object **PrintInfo** property to the PrintInfo object you just created.

**Example**
This example code prints cells B2 through D4.

```csharp
// Create PrintInfo object and set properties.
FarPoint.Win.Spread.PrintInfo printset = new FarPoint.Win.Spread.PrintInfo();
printset.PrintType = FarPoint.Win.Spread.PrintType.CellRange;
printset.ColStart = 1;
printset.ColEnd = 3;
printset.RowStart = 1;
printset.RowEnd = 3;
// Create SheetView object and assign it to the first sheet.
FarPoint.Win.Spread.SheetView SheetToPrint = new FarPoint.Win.Spread.SheetView();
SheetToPrint.PrintInfo = printset;
fpSpread1.Sheets[0] = SheetToPrint;
// Print the sheet.
fpSpread1.PrintSheet(0);
```

```vbnet
' Create PrintInfo object and set properties.
Dim printset As New FarPoint.Win.Spread.PrintInfo()
printset.PrintType = FarPoint.Win.Spread.PrintType.CellRange
printset.ColStart = 1
printset.ColEnd = 3
printset.RowStart = 1
printset.RowEnd = 3
' Create SheetView object and assign it to the first sheet.
Dim SheetToPrint As New FarPoint.Win.Spread.SheetView()
SheetToPrint.PrintInfo = printset
fpSpread1.Sheets(0) = SheetToPrint
' Set the PrintInfo property for the first sheet.
fpSpread1.Sheets(0).PrintInfo = printset
' Print the sheet.
fpSpread1.PrintSheet(0)
```

## Using the Spread Designer

1. Select the sheet tab for the sheet you want to print.
2. Select the **Page Layout** option.
3. Select the **PrintTitles** icon, choose **General**.
    The **Sheet Print Options** dialog appears.
4. Click the **Output** tab.
5. From the **Output Type** drop-down list box, choose **Cell Range**.
6. Click **OK** to close the **Sheet Print Options** dialog.
7. From the **File** menu choose **Apply and Exit** to apply your changes to the component and exit Spread Designer.
8. To specify the range of cells,
9. To print the range of cells, follow the instructions in [Printing an Entire Sheet](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-printing/spwin-printactions/spwin-printsheet).

## See Also

[Printing an Entire Sheet](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-printing/spwin-printactions/spwin-printsheet)
[Printing to PDF](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-printing/spwin-printactions/spwin-printPDF)
[Printing a Child View of a Hierarchical Display](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-printing/spwin-printactions/spwin-printhierarchy)
[Printing Particular Pages](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-printing/spwin-printactions/spwin-printpages)
[Printing the Portion of the Sheet with Data](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-printing/spwin-printactions/spwin-printdataarea)
[Printing an Area of the Sheet](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-printing/spwin-printactions/spwin-printarea)
[Printing a Sheet with Cell Notes](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-printing/spwin-printactions/spwin-printnotes)
[Printing a Sheet with Shapes](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-printing/spwin-printactions/spwin-printshapes)
[Printing in Duplex Mode](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-printing/spwin-printactions/PrintingDuplexMode)