We recommend using Visual Studio 2017
This documentation is archived and is not being maintained.


Call this function to format a range of text in a rich edit control for the output device specified by pDC.

long PrintPage(
   CDC* pDC,
   long nIndexStart,
   long nIndexStop 


Pointer to a device context for page output.


Zero-based index of the first character to be formatted.


Zero-based index of the last character to be formatted.

The index of the last character that fits on the page plus one.

The layout of each page is controlled by GetPageRect and GetPrintRect. Typically, this call is followed by a call to CRichEditCtrl::DisplayBand which generates the output.

Note that margins are relative to the physical page, not the logical page. Thus, margins of zero will often clip the text since many printers have unprintable areas on the page. To avoid clipping your text, you should call SetMargins and set reasonable margins before printing.

Header: afxrich.h