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.
You can calculate the number of printed pages for the sheet using the GetPrintPageCount method.
If you just want to print the current page, set the PrintType property to PrintType.CurrentPage, and go on to step 4.
This example code prints pages 5 through 10.
C# |
Copy Code
|
---|---|
// Create PrintInfo object and set properties. FarPoint.Win.Spread.PrintInfo printset = new FarPoint.Win.Spread.PrintInfo(); printset.PrintType = FarPoint.Win.Spread.PrintType.PageRange; printset.PageStart = 5; printset.PageEnd = 10; // Set the PrintInfo property for the first sheet. fpSpread1.Sheets[0].PrintInfo = printset; // Print the sheet. fpSpread1.PrintSheet(0); |
VB |
Copy Code
|
---|---|
' Create PrintInfo object and set properties. Dim printset As New FarPoint.Win.Spread.PrintInfo() printset.PrintType = FarPoint.Win.Spread.PrintType.PageRange printset.PageStart = 5 printset.PageEnd = 10 ' Set the PrintInfo property for the first sheet. fpSpread1.Sheets(0).PrintInfo = printset ' Print the sheet. fpSpread1.PrintSheet(0) |
If you just want to print the current page, set the PrintType property to PrintType.CurrentPage, and go on to step 4.
This example code prints pages 5 through 10.
C# |
Copy Code
|
---|---|
// Create PrintInfo object and set properties. FarPoint.Win.Spread.PrintInfo printset = new FarPoint.Win.Spread.PrintInfo(); printset.PrintType = FarPoint.Win.Spread.PrintType.PageRange; printset.PageStart = 5; printset.PageEnd = 10; // Create SheetView object and assign it to the first sheet. FarPoint.Win.Spread.SheetView SheetToPrint = new FarPoint.Win.Spread.SheetView(); SheetToPrint.PrintInfo = printset; fpSpread1.Sheets[0] = SheetToPrint; // Print the sheet. fpSpread1.PrintSheet(0); |
VB |
Copy Code
|
---|---|
' Create PrintInfo object and set properties. Dim printset As New FarPoint.Win.Spread.PrintInfo() printset.PrintType = FarPoint.Win.Spread.PrintType.PageRange printset.PageStart = 5 printset.PageEnd = 10 ' Create SheetView object and assign it to the first sheet. Dim SheetToPrint As New FarPoint.Win.Spread.SheetView() SheetToPrint.PrintInfo = printset fpSpread1.Sheets(0) = SheetToPrint ' Set the PrintInfo property for the first sheet. fpSpread1.Sheets(0).PrintInfo = printset ' Print the sheet. fpSpread1.PrintSheet(0) |