Friday, July 04, 2008  



 FarPoint Technologies
 (800) 645-5913

 fpsales@fpoint.com



     
 »Spread for Windows Forms » Product Tour » Printing » Customize

Previous Customizing the Printing Next

There are various aspects of the printing of the spreadsheet that can be customized.

  Back to Top
 Customizing the Printing
You can customize the printing by setting the properties of a PrintInfo object and setting the PrintInfo property of a sheet to that object. The PrintInfo object has the settings for customizing the printing of a sheet.
Property  Description 
AbortMessage Gets or sets the message to display for the abort dialog.
BestFitCols Gets or sets whether column widths are adjusted to fit the longest string width for printing.
BestFitRows Gets or sets whether row heights are adjusted to fit the tallest string height for printing.
ColStart and ColEnd Used for printing a portion of the sheet.
FirstPageNumber Gets or sets the page number to print on the first page.
Footer Used for providing footers on printed pages.
Header Used for providing headers on printed pages.
JobName Gets or sets the name of the print job.
Margin Gets or sets the margins for printing.
Opacity Gets or sets the opacity used when printing this sheet; this is used to print a watermark first and then the sheet contents.
Orientation Gets or sets the page orientation used for printing.
PageStart and PageEnd Used for printing a page range.
PageOrder Gets or sets the order in which pages print.
PaperSize Gets or sets the paper size to use.
PaperSource Gets or sets the paper source to use.
Preview Used to provide print preview.
Printer Gets or sets the name of the printer to use for printing.
PrintType Gets or sets what is to be printed.
PrintNotes Gets or sets whether to print the cell notes.
PrintShapes Gets or sets whether to print floating objects.
RowStart and RowEnd Used for printing a portion of the sheet.
ShowBorder Gets or sets whether to print a border around the sheet.
ShowColor Gets or sets whether to print the colors as they appear on the screen.
ShowColumnHeaders and ShowRowHeaders Gets or sets whether to print the column headers and row headers.
ShowGrid Gets or sets whether to print the sheet grid lines.
ShowPrintDialog Gets or sets whether to display a print dialog before printing.
ShowShadows Gets or sets whether to print the header shadows.
SmartPrintRules Used for setting up the rules for optimizing the printing.
UseMax Gets or sets whether to print only rows containing data.
UseSmartPrint Used for turning on the rules for optimizing the printing.
ZoomFactor Gets or sets the zoom factor used for printing this sheet.

// Create PrintInfo object and set properties
FarPoint.Win.Spread.PrintInfo PrintSettings = new FarPoint.Win.Spread.PrintInfo();
PrintSettings.ShowGrid = false;
PrintSettings.ShowRowHeaders = false;
PrintSettings.UseMax = true;
// Set the PrintInfo property for the first sheet
fpSpread1.Sheets[0].PrintInfo = PrintSettings;
// Print the sheet
fpSpread1.PrintSheet(0);

' Create PrintInfo object and set properties
Dim PrintSettings As New FarPoint.Win.Spread.PrintInfo()
PrintSettings.ShowGrid = False
PrintSettings.ShowRowHeaders = False
PrintSettings.UseMax = True
' Set the PrintInfo property for the first sheet
FpSpread1.Sheets(0).PrintInfo = PrintSettings
' Print the sheet
FpSpread1.PrintSheet(0)


  Back to Top
 Adding Header and Footer Text to Printed Pages
You can provide header and footer text that appears on the printed pages. Using control characters, you can specify variables, such as page numbers, and font settings.

// Create PrintInfo object and set properties
FarPoint.Win.Spread.PrintInfo PrintSettings = new FarPoint.Win.Spread.PrintInfo();
PrintSettings.Header = "/lJobName";
PrintSettings.Footer = "/r/p of /pc";
fpSpread1.Sheets[0].PrintInfo = PrintSettings;
// Print the sheet
fpSpread1.PrintSheet(0);

' Create PrintInfo object and set properties
Dim PrintSettings As New FarPoint.Win.Spread.PrintInfo()
PrintSettings.Header = "/lJobName"
PrintSettings.Footer = "/r/p of /pc"
' Set the PrintInfo property for the first sheet
FpSpread1.Sheets(0).PrintInfo = PrintSettings
' Print the sheet
FpSpread1.PrintSheet(0)


  Back to Top
 Optimizing the Printing
Spread provides a way to automatically determine the best way to print your sheet. By using rules that you can choose, it can decide, for example, whether it is best to print your sheet on landscape- or portrait-oriented pages. The rules, that you can turn on or off, that optimize the printing can be customized by setting the properties of these rule objects:

Rule Object Description
LandscapeRule Determines whether to print the sheet in landscape or portrait orientation.
ScaleRule Determines the best scale at which to print the sheet, starting with 100% (Start Factor = 1), and decreasing at set intervals to a minimum size (End Factor). Default settings are Start Factor = 1, End Factor = 0.6, and Interval = 0.1.
BestFitColumnRule Determines how best to fit the columns in the sheet on the page


  Back to Top
 Printing a Watermark
You can print a background image or a watermark when the spreadsheet is printed.

Set the PrintBackground event to fire when printing, and specify the graphic with the PrintBackground event, and the opacity with the PrintInfo.Opacity property, so the printing of the spreadsheet has no watermark if opacity is highest (transparency is lowest) and shows the watermark through the spreadsheet if the opacity is low (transparency is high).


  Back to Top
 Adding Page Breaks
You can add column or row page breaks as well as return the column or row page breaks for the sheet. Use the GetRowPageBreaks method to get the number of row page breaks and use the GetColumnPageBreaks method to get the number of column page breaks. To add or set the page breaks, use the SetRowPageBreak and SetColumnPageBreak methods.

// Set a page break
fpSpread1.Sheets[0].SetRowPageBreak(5);

' Set a page break
FpSpread1.Sheets(0).SetRowPageBreak(5)


Previous Customizing the Printing Next


    
 Have a question?
Have a Question? Ask Us!
Subscribe to the RSS feed!RSS Subscribe
 

 
SD Times 'TOP 100' Industry Innovator - Read the press release (pdf)

Tour Home
Overview
Appearance
User Interaction
Cell Types
Formulas
Managing Data
Data Binding
Import/Export
Printing
Keyboard Interaction
Shapes
Models
Spread Designer
 
Map

Copyright © 1991-2007 FarPoint Technologies, Inc. All rights reserved. All names are property of their respective owners.