Spread Windows Forms 10.0 Product Documentation
GetOwnerPrintInfo Method
Example 


Graphics object that handles printing
Rectangular area that represents the area for printing
Sheet to print
Gets the printing information required to print a given sheet into the supplied rectangle.
Syntax
'Declaration
 
Public Function GetOwnerPrintInfo( _
   ByVal g As Graphics, _
   ByVal rect As Rectangle, _
   ByVal sheet As Integer _
) As OwnerPrintInfo
'Usage
 
Dim instance As FpSpread
Dim g As Graphics
Dim rect As Rectangle
Dim sheet As Integer
Dim value As OwnerPrintInfo
 
value = instance.GetOwnerPrintInfo(g, rect, sheet)
public OwnerPrintInfo GetOwnerPrintInfo( 
   Graphics g,
   Rectangle rect,
   int sheet
)

Parameters

g
Graphics object that handles printing
rect
Rectangular area that represents the area for printing
sheet
Sheet to print
Example
This example gets the page count.
//Add a PrintDocument control
 private void Form1_Load(object sender, EventArgs e)
        {
            fpSpread1.Sheets.Count = 2;
            fpSpread1.Sheets[0].Cells[0, 0].Value = "test";
            fpSpread1.Sheets[0].Cells[8, 0].Value = "test";
            fpSpread1.Sheets[0].Cells[15, 0].Value = "test";
            fpSpread1.Sheets[0].Cells[0, 15].Value = "column";
            fpSpread1.Sheets[1].Cells[0, 0].Value = "test";          
        }

        private void button1_Click(object sender, EventArgs e)
        {
            printDocument1.Print();
        }
 
        private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            Rectangle rect;
            rect = new Rectangle(0, 0, 100, 100);
            fpSpread1.OwnerPrintDraw(e.Graphics, rect, 0, 1);
            listBox1.Items.Add(fpSpread1.GetOwnerPrintInfo(e.Graphics, rect, 0).PageCount);

            Rectangle rect1;
            rect1 = new Rectangle(0, 200, 100, 100);
            fpSpread1.OwnerPrintDraw(e.Graphics, rect1, 1, 1);
        }
'Add a PrintDocument control
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        FpSpread1.Sheets.Count = 2
        FpSpread1.Sheets(0).Cells(0, 0).Value = "test"
        FpSpread1.Sheets(0).Cells(8, 0).Value = "test"
        FpSpread1.Sheets(0).Cells(15, 0).Value = "test"
        FpSpread1.Sheets(0).Cells(0, 15).Value = "column"
        FpSpread1.Sheets(1).Cells(0, 0).Value = "test"
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        PrintDocument1.Print()
    End Sub

    Private Sub PrintDocument1_PrintPage(sender As Object, e As Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
        Dim rect As Rectangle
        rect = New Rectangle(0, 0, 100, 100)
        FpSpread1.OwnerPrintDraw(e.Graphics, rect, 0, 1)
        ListBox1.Items.Add(FpSpread1.GetOwnerPrintInfo(e.Graphics, rect, 0).PageCount)

        Dim rect1 As Rectangle
        rect1 = New Rectangle(0, 200, 100, 100)
        FpSpread1.OwnerPrintDraw(e.Graphics, rect1, 1, 1)
    End Sub
Requirements

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

See Also

Reference

FpSpread Class
FpSpread Members

 

 


Copyright © GrapeCity, inc. All rights reserved.