private byte[] StreamToBytes(System.IO.Stream stream)
{
byte[] bytes = new byte[stream.Length];
stream.Read(bytes, 0, bytes.Length);
stream.Seek(0, System.IO.SeekOrigin.Begin);
return bytes;
}
private void button1_Click(object sender, RoutedEventArgs e)
{
Microsoft.Win32.OpenFileDialog file = new Microsoft.Win32.OpenFileDialog();
if (file.ShowDialog() == true)
{
this.gcSpreadSheet1.ActiveSheet.PrintInfo.FooterCenterImage = StreamToBytes(file.OpenFile());
this.gcSpreadSheet1.ActiveSheet.PrintInfo.FooterLeftImage = StreamToBytes(file.OpenFile());
this.gcSpreadSheet1.ActiveSheet.PrintInfo.FooterRightImage = StreamToBytes(file.OpenFile());
this.gcSpreadSheet1.ActiveSheet.PrintInfo.HeaderCenterImage = StreamToBytes(file.OpenFile());
this.gcSpreadSheet1.ActiveSheet.PrintInfo.HeaderLeftImage = StreamToBytes(file.OpenFile());
this.gcSpreadSheet1.ActiveSheet.PrintInfo.HeaderRightImage = StreamToBytes(file.OpenFile());
}
this.gcSpreadSheet1.ActiveSheet.PrintInfo.FooterCenter = "&G";
this.gcSpreadSheet1.ActiveSheet.PrintInfo.FooterRight = "&G";
this.gcSpreadSheet1.ActiveSheet.PrintInfo.FooterLeft = "&G";
this.gcSpreadSheet1.ActiveSheet.PrintInfo.HeaderCenter = "&G";
this.gcSpreadSheet1.ActiveSheet.PrintInfo.HeaderRight = "&G";
this.gcSpreadSheet1.ActiveSheet.PrintInfo.HeaderLeft = "&G";
}
private void button2_Click(object sender, RoutedEventArgs e)
{
this.gcSpreadSheet1.SavePDF("c:\\zipfile\\test.pdf", 0);
}