Spread Windows Forms 7.0 Product Documentation
UseSmartPrint Property
See Also  Example Support Options
FarPoint.Win.Spread Assembly > FarPoint.Win.Spread Namespace > PrintInfo Class : UseSmartPrint Property


Glossary Item Box

Gets or sets whether the control optimizes the printing using rules.

Syntax

Visual Basic (Declaration) 
Public Property UseSmartPrint As Boolean
Visual Basic (Usage)Copy Code
Dim instance As PrintInfo
Dim value As Boolean
 
instance.UseSmartPrint = value
 
value = instance.UseSmartPrint
C# 
public bool UseSmartPrint {get; set;}

Property Value

Boolean: true to use the optimum printing rules; false to print normally

Remarks

Set this property to true to optimize printing, which might save time and paper.

By default, these optimum printing rules provide the following behavior:

  • If the information can be printed without the sheet making 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.

If you want to change this behavior, you change the rules that govern the printing calculations by setting the SmartPrintRules property.

Set this property to true when you want to use the SmartPrintRules (ScaleRule or BestFitColRule or LandscapeRule). There are default rules so you do not have to set any of these to do a SmartPrint but definitely if you set some, you must set this property. You do NOT need this property to be true for these other printing optimizations: SmartPrintPagesTall and SmartPrintPagesWide, and BestFitCols and BestFitRows.

For more information about optimum printing, refer to Optimizing Printing.

Example

This example shows how to define the settings for optimizing the printing.
C#Copy Code
// Typically you would use one type of optimization; they are all shown here for illustration only

// Define the printer settings for optimization
FarPoint.Win.Spread.PrintInfo printset = new FarPoint.Win.Spread.PrintInfo();
FarPoint.Win.Spread.SmartPrintRulesCollection prules = new FarPoint.Win.Spread.SmartPrintRulesCollection(); 

// ... use best fit of columns and rows
printset.BestFitCols = true;
printset.BestFitRows = true;

// ... or check by page size
printset.SmartPrintPagesTall = 1; 
printset.SmartPrintPagesWide = 1; 

// ... or use the rules defined
prules.Add(new FarPoint.Win.Spread.BestFitColumnRule(FarPoint.Win.Spread.ResetOption.None)); 
prules.Add(new FarPoint.Win.Spread.LandscapeRule(FarPoint.Win.Spread.ResetOption.Current)); 
prules.Add(new FarPoint.Win.Spread.ScaleRule(FarPoint.Win.Spread.ResetOption.None, 1, 0.6, 0.1)); 
printset.SmartPrintRules = prules;
printset.UseSmartPrint = true;

// Assign the printer settings to the sheet and print it
fpSpread1.Sheets[0].PrintInfo = printset;
fpSpread1.PrintSheet(0);
Visual BasicCopy Code
' Typically you would use one type of optimization; they are all shown here for illustration only

' Define the printer settings for optimization
Dim printset As New FarPoint.Win.Spread.PrintInfo()
Dim prules As New FarPoint.Win.Spread.SmartPrintRulesCollection

' ... use best fit of columns and rows
printset.BestFitCols = True
printset.BestFitRows = True

' ... or check by page size
printset.SmartPrintPagesTall = 1
printset.SmartPrintPagesWide = 1

' ... or use the rules defined
prules.Add(New FarPoint.Win.Spread.BestFitColumnRule(FarPoint.Win.Spread.ResetOption.None)) 
prules.Add(New FarPoint.Win.Spread.LandscapeRule(FarPoint.Win.Spread.ResetOption.Current))
prules.Add(New FarPoint.Win.Spread.ScaleRule(FarPoint.Win.Spread.ResetOption.None, 1, 0.6, 0.1))
printset.SmartPrintRules = prules
printset.UseSmartPrint = True

' Assign the printer settings to the sheet and print it
FpSpread1.Sheets(0).PrintInfo = printset
FpSpread1.PrintSheet(0)

Requirements

Target Platforms: Windows 2000 Professional (SP4), Windows 2000 Server, Windows 2003 Server (SP1), Windows 2008, Windows XP (SP2), Windows Vista, Windows 7, Windows 8

See Also

© 2002-2014 ComponentOne, a division of GrapeCity. All Rights Reserved.