Friday, July 04, 2008  



 FarPoint Technologies
 (800) 645-5913

 fpsales@fpoint.com



     
 »Spread for Windows Forms » Product Tour » Printing » Parts to Print

Previous Specifying Which Parts to Print Next

You can print any of several parts of the spreadsheet.

  Back to Top
 Printing a Sheet with Default Values
You can print a sheet in the control by calling the FpSpread.PrintSheet method. Calling this method prints the sheet, using the sheet's PrintInfo property settings. The default setting prints in black and white and automatically determines the best order in which to print pages. With the default settings, the following items print using the printer's current orientation setting: all the columns and rows in the sheet (but only the cells that have data in them), the sheet's border, the column and row headers, the header shadows, and the grid lines.

' Print the second sheet
FpSpread1.PrintSheet(1)


  Back to Top
 Printing a Range of Cells
You can specify that only a range of cells within a sheet prints, rather than the entire sheet.

// Print cells B2 through D4.
FarPoint.Win.Spread.PrintInfo PrintSettings = new FarPoint.Win.Spread.PrintInfo();
PrintSettings.PrintType = FarPoint.Win.Spread.PrintType.CellRange;
PrintSettings.ColStart = 1;
PrintSettings.ColEnd = 3;
PrintSettings.RowStart = 1;
PrintSettings.RowEnd = 3;
// Create SheetView object and assign it to the first sheet
FarPoint.Win.Spread.SheetView SheetToPrint = new FarPoint.Win.Spread.SheetView();
SheetToPrint.PrintInfo = PrintSettings;
fpSpread1.Sheets[0] = SheetToPrint;
// Print the sheet
fpSpread1.PrintSheet(0);

' Print cells B2 through D4.
' Create PrintInfo object and set properties
Dim PrintSettings As New FarPoint.Win.Spread.PrintInfo()
PrintSettings.PrintType = FarPoint.Win.Spread.PrintType.CellRange
PrintSettings.ColStart = 1
PrintSettings.ColEnd = 3
PrintSettings.RowStart = 1
PrintSettings.RowEnd = 3
' Create SheetView object and assign it to the first sheet
Dim SheetToPrint As New FarPoint.Win.Spread.SheetView()
SheetToPrint.PrintInfo = PrintSettings
FpSpread1.Sheets(0) = SheetToPrint
' Set the PrintInfo property for the first sheet
FpSpread1.Sheets(0).PrintInfo = PrintSettings
' Print the sheet
FpSpread1.PrintSheet(0)


  Back to Top
 Printing Particular Pages
You can print all or some of the pages for the sheet. Specify the pages to print by setting the PrintType, PageStart, and PageEnd properties of the PrintInfo object.

// Print pages 5 through 10.
// Create PrintInfo object and set properties
FarPoint.Win.Spread.PrintInfo PrintSettings = new FarPoint.Win.Spread.PrintInfo();
PrintSettings.PrintType = FarPoint.Win.Spread.PrintType.PageRange;
PrintSettings.PageStart = 5;
PrintSettings.PageEnd = 10;
// Set the PrintInfo property for the first sheet
fpSpread1.Sheets[0].PrintInfo = PrintSettings;
// Print the sheet
fpSpread1.PrintSheet(0);

' Print pages 5 through 10.
' Create PrintInfo object and set properties
Dim PrintSettings As New FarPoint.Win.Spread.PrintInfo()
PrintSettings.PrintType = FarPoint.Win.Spread.PrintType.PageRange
PrintSettings.PageStart = 5
PrintSettings.PageEnd = 10
' Set the PrintInfo property for the first sheet
FpSpread1.Sheets(0).PrintInfo = PrintSettings
' Print the sheet
FpSpread1.PrintSheet(0)


  Back to Top
 Printing a Hierarchical Spreadsheet
You can print child sheets of a hierarchy and manage how they are printed.

// Print a child sheet
FarPoint.Win.Spread.SheetView ss;
ss = fpSpread1.Sheets[0].GetChildView(0, 0);
if (ss != null)
   {
      fpSpread1.PrintSheet(ss);
   };

' Print a child sheet
Dim ss As FarPoint.Win.Spread.SheetView
ss = FpSpread1.Sheets(0).GetChildView(0, 0)
If Not ss Is Nothing Then
   FpSpread1.PrintSheet(ss)
End If


  Back to Top
 Printing Cell Notes
You can print cell notes as well as the data. Use the PrintNotes property in the PrintInfo object to print notes. The notes can be printed on a page after the data or as displayed.

// Print notes
FarPoint.Win.Spread.PrintInfo pi = new FarPoint.Win.Spread.PrintInfo();
pi.PrintNotes = FarPoint.Win.Spread.PrintNotes.AtEnd;
fpSpread1.Sheets[0].PrintInfo = pi;

' Print notes
Dim pi as New FarPoint.Win.Spread.PrintInfo()
pi.PrintNotes = FarPoint.Win.Spread.PrintNotes.AtEnd
fpSpread1.Sheets(0).PrintInfo = pi


  Back to Top
 Printing Shapes
You can print shapes as well as the data. Use the PrintShapes property in the PrintInfo object to print shapes.

// Print shapes
FarPoint.Win.Spread.PrintInfo pi = new FarPoint.Win.Spread.PrintInfo();
pi.PrintShapes =true;
fpSpread1.Sheets[0].PrintInfo = pi;
fpSpread1.PrintSheet(0);

' Print shapes
Dim pi as New FarPoint.Win.Spread.PrintInfo()
pi.PrintShapes = True
fpSpread1.Sheets(0).PrintInfo = pi
FpSpread1.PrintSheet(0)


  Back to Top
 Calculating the Page Count
You can calculate the number of printed pages for the sheet.

// Get the number of pages to print
int pageCnt;
pageCnt = fpSpread1.GetPrintPageCount(0);

' Get the number of pages to print
Dim pageCnt As Integer
pageCnt = FpSpread1.GetPrintPageCount(0)


Previous Specifying Which Parts to Print 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.