Worksheet.GetPrintableRange() Method
Returns a worksheet range that can be printed.
Namespace: DevExpress.Spreadsheet
Assembly: DevExpress.Spreadsheet.v24.2.Core.dll
NuGet Package: DevExpress.Spreadsheet.Core
Declaration
Returns
Type | Description |
---|---|
CellRange | A CellRange object that is the printable worksheet range. |
Remarks
The GetPrintableRange method returns a continuous worksheet range that meets the following requirements.
The top-left cell of the printable range is the A1 cell. If this cell is hidden, the printable range starts from the top-left cell of the visible area.
- The printable range includes all cells that have data: values (CellRange.Value) or formulas (CellRange.Formula).
The printable range includes all cells containing visual formatting (fill or border).
- If a non-empty cell is located in the hidden row or column, it is not included in the printable range.
The rightmost empty columns containing visual formatting (fill or border) are not included in the printable range.
The bottommost empty rows containing visual formatting (fill or border) are not included in the printable range.
Includes all shapes (pictures and charts).
Includes all tables (a table occupies a range determined by the Table.Range property). If a table contains hidden rows or columns below or to the right of visible cells, they are excluded from the printable range.
Merged cells (empty and non-empty) are included in the printable range. If merged cells are hidden, they are not included in the printable range. If merged cells contain no data and occupy the entire row or column, they are not included in the printable range as well.
- Conditional formatting is ignored.
- The print area (a cell range assigned to the Worksheet.SetPrintRange method and defined by the _xlnm.Print_Area name) is ignored. Use the GetPrintableRange method overload with a boolean parameter to get the printable range corresponding to the specified print area.
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the GetPrintableRange() method.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.