# Printing the Portion of the Sheet with Data

Learn how to print specific portions of a sheet with data using the UseMax method of the PrintInfo class. Find out how to control printing rows and columns containing data or print all the way to the end of the defined sheet.

## Content



You may not want to print the entire sheet but only the portion of the sheet that has data. Use the [UseMax](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.PrintInfo.UseMax.html) method of the [PrintInfo](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.PrintInfo.html) class to specify whether to print only rows and columns containing data or whether to print all the way to the end of the defined sheet, even if the rows and columns are empty.

If you want to print all of the columns (even if it does not have data in it) but only the rows with data, you would need to set **UseMax** to True to keep from printing rows without data. Then, you would need to programmatically put data in the last column and the last row with data, so the Spread prints all the columns. You could add a line of code similar to the following before calling the [PrintSheet](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.FpSpread.PrintSheet.html) method.

```csharp
fpSpread1.Sheets(0).Cells(fpSpread1.Sheets(0).GetLastNonEmptyRow(FarPoint.Win.Spread.NonEmptyItemFlag.Data), (fpSpread1.Sheets(0).ColumnCount - 1)).Value = ""
```

```vbnet
fpSpread1.Sheets[0].Cells[fpSpread1.Sheets[0].GetLastNonEmptyRow(FarPoint.Win.Spread.NonEmptyItemFlag.Data), fpSpread1.Sheets[0].ColumnCount - 1].Value = "";
```

For more information about methods involved with finding data, refer to [Rows or Columns That Have Data](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-rowcol/spwin-rowcolnonempty).

## 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 a Range of Cells on a Sheet](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-printing/spwin-printactions/spwin-printrange)

[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)