GrapeCity.Windows.SpreadSheet.UI Namespace > GcSpreadSheet Class > PrintToDocument Method : PrintToDocument(Int32) Method |
'Declaration Public Overloads Function PrintToDocument( _ ByVal sheetIndex As System.Integer _ ) As System.Windows.Documents.IDocumentPaginatorSource
'Usage Dim instance As GcSpreadSheet Dim sheetIndex As System.Integer Dim value As System.Windows.Documents.IDocumentPaginatorSource value = instance.PrintToDocument(sheetIndex)
public System.Windows.Documents.IDocumentPaginatorSource PrintToDocument( System.int sheetIndex )
internal class PrintDocumentViewer : DocumentViewer { public PrintDocumentViewer(GrapeCity.Windows.SpreadSheet.UI.GcSpreadSheet spread, int sheetIndex) { this.Spread = spread; this.SheetIndex = sheetIndex; this.Document = spread.PrintToDocument(0); } protected override void OnPrintCommand() { if (this.Spread != null) { if (this.SheetIndex != -1) { this.Spread.Print(this.SheetIndex); } else { this.Spread.Print(); } } } private GrapeCity.Windows.SpreadSheet.UI.GcSpreadSheet Spread { get; set; } private int SheetIndex { get; set; } } private void button1_Click_1(object sender, RoutedEventArgs e) { Window window = new Window(); PrintDocumentViewer viewer = new PrintDocumentViewer(GcSpreadSheet1, -1); window.Content = viewer; window.ShowDialog(); }
Friend Class PrintDocumentViewer Inherits DocumentViewer Public Sub New(spread As GrapeCity.Windows.SpreadSheet.UI.GcSpreadSheet, sheetIndex As Integer) Me.Spread = spread Me.SheetIndex = sheetIndex Me.Document = spread.PrintToDocument(0) End Sub Protected Overrides Sub OnPrintCommand() If Me.Spread IsNot Nothing Then If Me.SheetIndex <> -1 Then Me.Spread.Print(Me.SheetIndex) Else Me.Spread.Print() End If End If End Sub Private Property Spread() As GrapeCity.Windows.SpreadSheet.UI.GcSpreadSheet Get Return m_Spread End Get Set(value As GrapeCity.Windows.SpreadSheet.UI.GcSpreadSheet) m_Spread = value End Set End Property Private m_Spread As GrapeCity.Windows.SpreadSheet.UI.GcSpreadSheet Private Property SheetIndex() As Integer Get Return m_SheetIndex End Get Set(value As Integer) m_SheetIndex = Value End Set End Property Private m_SheetIndex As Integer End Class Private Sub Button_Click_1(sender As Object, e As RoutedEventArgs) Dim window As New Window() Dim viewer As New PrintDocumentViewer(GcSpreadSheet1, -1) window.Content = viewer window.ShowDialog() End Sub
Target Platforms: Windows 7, Windows 8 Desktop, Windows Vista SP1 or later, Windows Server 2000, Windows 2000 Professional (SP4), Windows XP (SP2), Windows 2008, Windows 2003 Server (SP1)