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();
}