SS_PRINTFORMAT Structure
Applies To
fpSpread control
Definition
typedef struct ss_printformat
{
BOOL fDrawBorder;
BOOL fDrawShadows;
BOOL fDrawColors;
BOOL fShowGrid;
BOOL fShowColHeaders;
BOOL fShowRowHeaders;
BOOL fUseDataMax;
short dPrintType;
SS_COORD x1CellRange;
SS_COORD y1CellRange;
SS_COORD x2CellRange;
SS_COORD y2CellRange;
short nPageStart;
short nPageEnd;
float fMarginLeft;
float fMarginTop;
float fMarginRight;
float fMarginBottom;
HDC hDCPrinter;
WORD wOrientation
BYTE fSmartPrint
WORD wScalingMethod;
double ZoomFactor;
short nBestFitPagesWide;
short nBestFitPagesTall;
BOOL fCenterOnPageH;
BOOL fCenterOnPageV;
} SS_PRINTFORMAT, FAR *LPSS_PRINTFORMAT;
Fields
The following fields are available:
Field | Description | |
---|---|---|
fDrawBorder | Draw a border around the sheet Defaults to TRUE. |
|
fDrawShadows | Draw the shadows in the header cells Defaults to TRUE. |
|
fDrawColors | Colors that appear within the sheet are sent to the printer (If the printer is not a color printer, colors will appear as gray-scale or a dithered pattern.) Defaults to FALSE. |
|
fShowGrid | Show the grid Defaults to TRUE. |
|
fShowColHeaders | Show column headers Defaults to TRUE. |
|
fShowRowHeaders | Show row headers Defaults to TRUE. |
|
fUseDataMax | Use the maximum row and column that contain data Defaults to TRUE. |
|
dPrintType | Choose any combination of the following values. Use the (|) OR operator and combine the following values as indicated: |
|
Value or Constant | Description | |
Use one of the following values: | ||
0 | (Default) Print all the pages | |
SS_PRINTTYPE_CURRENTPAGE | Print the current page | |
SS_PRINTTYPE_CELLRANGE | Print a range of cells using the x1CellRange, y1CellRange, x2CellRange, and y2CellRange fields | |
SS_PRINTTYPE_PAGERANGE | Print a range of pages using the nPageStart and nPageEnd fields | |
Use one of the following values: | ||
SS_PRINTTYPE_OVERTHENDOWN | Prints pages across then down | |
SS_PRINTTYPE_DOWNTHENOVER | Prints pages down then across | |
x1CellRange | Left cell in cell range Defaults to 0. |
|
y1CellRange | Top cell in cell range Defaults to 0. |
|
x2CellRange | Right cell in cell range Defaults to 0. |
|
y2CellRange | Bottom cell in cell range Defaults to 0. |
|
nPageStart | Starting page Defaults to 1. |
|
nPageEnd | Ending page Defaults to last page in sheet. |
|
fMarginLeft | Left margin in inches Defaults to 0. |
|
fMarginTop | Top margin in inches Defaults to 0. |
|
fMarginRight | Right margin in inches Defaults to 0. |
|
fMarginBottom | Bottom margin in inches Defaults to 0. |
|
hDCPrinter | Optional device context handle Defaults to 0. If this value is 0, the sheet creates its own. By supplying an hDC, the application can perform whatever setup procedure is required. If the application supplies an hDC, it must also destroy the handle. |
|
wOrientation | Determines page orientation for the printed pages Choose one of the following values: |
|
Constant | Description | |
SS_PRINTORIENT_DEFAULT | (Default) Prints pages with current printer page orientation setting | |
SS_PRINTORIENT_PORTRAIT | Prints pages in portrait orientation | |
SS_PRINTORIENT_LANDSCAPE | Prints pages in landscape orientation | |
fSmartPrint | Specifies whether to print the sheet using the SmartPrint feature Defaults to FALSE. |
|
wScalingMethod | Scaling method to use when printing the sheet | |
Constant | Description | |
SS_PRINTSCALINGMETHOD_NONE | No scaling occurs | |
SS_PRINTSCALINGMETHOD_SMARTPRINT | Uses the SmartPrint capability | |
SS_PRINTSCALINGMETHOD_ZOOM | Uses the setting for the ZoomFactor field | |
SS_PRINTSCALINGMETHOD_BESTFIT | Determines the best fit based on the nBestFitPagesWide and nBestFitPagesTall fields | |
ZoomFactor | Amount to scale the printed sheet; a value between 0 and 5, where 0.5 means to print at 50% of the sheet size. Used when wScalingMethod is set to SS_PRINTSCALINGMETHOD_ZOOM. | |
nBestFitPagesWide | Number of pages wide to print. Defaults to 1. Used when wScalingMethod is set to SS_PRINTSCALINGMETHOD_BESTFIT. | |
nBestFitPagesTall | Number of pages tall to print. Defaults to 1. Used when wScalingMethod is set to SS_PRINTSCALINGMETHOD_BESTFIT. | |
fCenterOnPageH | Whether to horizontally center the sheet on the printed page | |
fCenterOnPageV | Whether to vertically center the sheet on the printed page |
Remarks
For the dPrintType field, if you use either the SS_PRINTTYPE_OVERTHENDOWN or the SS_PRINTTYPE_DOWNTHENOVER value, then the sheet prints the pages following the directions specified by the value. If you do not specify one of these values, the sheet automatically determines the best order for printing the pages.
Tip: If the fpSpread control is in virtual mode, either use the default setting or the SS_PRINTTYPE_OVERTHENDOWN value for best results. |
Note: If you have called the SSSetFreeze function to freeze columns or rows, the frozen columns or rows will also print with your range, even if they are not included in the range you specify. |
The SSPrint function's lpPrintFormat parameter uses a pointer to this structure to return the format values. You can set that parameter to NULL and call this function to return the default format values.
If you set the fSmartPrint parameter to TRUE or the wScalingMethod parameter to SS_PRINTSCALINGMETHOD_SMARTPRINT, note the following about the SmartPrint capability:
- If the information can be printed without any changes, the sheet prints in portrait mode.
- If the sheet is wider than a portrait page, the sheet prints in landscape mode.
- If the information does not fit in landscape mode, but will fit in landscape mode if the sheet is reduced up to 60% of its original size, the sheet is scaled to fit within the page.
- If the information cannot be scaled to fit, the sheet tries to reduce column widths to accommodate the widest string within each column.
- If all attempts to make the sheet print within a page fail, printing resumes normally in the current printer orientation with no reductions.
See Also
Printing the Portion of the Sheet with Data
Specifying a Print Range
Specifying Print Options
SSGetPrintOptions, SSPrint, SSSetFreeze, SSSetPrintOptions functions
SS_PRINTINFO structure