Spread Silverlight Documentation
HeaderCenterImage Property (PrintInfo)
Example 


Gets or sets the image for the center section of the header.
Syntax
'Declaration
 
<System.ComponentModel.DefaultValueAttribute()>
Public Property HeaderCenterImage As System.Byte()
'Usage
 
Dim instance As PrintInfo
Dim value() As System.Byte
 
instance.HeaderCenterImage = value
 
value = instance.HeaderCenterImage
[System.ComponentModel.DefaultValue()]
public System.byte[] HeaderCenterImage {get; set;}

Property Value

The image for the center portion of the printed header. The default value is null, which means that no image is specified.
Example
This example uses the HeaderCenterImage property.
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)
        {
            OpenFileDialog file = new OpenFileDialog();
            if (file.ShowDialog() == true)
            {
                this.gcSpreadSheet1.ActiveSheet.PrintInfo.FooterCenterImage = StreamToBytes(file.File.OpenRead());
                this.gcSpreadSheet1.ActiveSheet.PrintInfo.FooterLeftImage = StreamToBytes(file.File.OpenRead());
                this.gcSpreadSheet1.ActiveSheet.PrintInfo.FooterRightImage = StreamToBytes(file.File.OpenRead());
                this.gcSpreadSheet1.ActiveSheet.PrintInfo.HeaderCenterImage  = StreamToBytes(file.File.OpenRead());
                this.gcSpreadSheet1.ActiveSheet.PrintInfo.HeaderLeftImage = StreamToBytes(file.File.OpenRead());
                this.gcSpreadSheet1.ActiveSheet.PrintInfo.HeaderRightImage = StreamToBytes(file.File.OpenRead());
            }
            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)
        {
         SaveFileDialog saveFileDialog = new SaveFileDialog();
saveFileDialog.Filter = "PDF File (.pdf)|*.pdf";
bool? useClick = saveFileDialog.ShowDialog();
if (useClick == true)
{
    var stream = saveFileDialog.OpenFile();
gcSpreadSheet1.SavePDF(stream, 0);
 stream.Dispose();
}
        }
Private Function StreamToBytes(stream As System.IO.Stream) As Byte()
        Dim bytes As Byte() = New Byte(stream.Length - 1) {}
        stream.Read(bytes, 0, bytes.Length)
        stream.Seek(0, System.IO.SeekOrigin.Begin)
        Return bytes
    End Function

Private Sub Button1_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles Button1.Click
        Dim file As New OpenFileDialog()
        If file.ShowDialog() = True Then
            GcSpreadSheet1.ActiveSheet.PrintInfo.FooterCenterImage = StreamToBytes(file.File.OpenRead())
            GcSpreadSheet1.ActiveSheet.PrintInfo.FooterLeftImage = StreamToBytes(file.File.OpenRead())
            GcSpreadSheet1.ActiveSheet.PrintInfo.FooterRightImage = StreamToBytes(file.File.OpenRead())
            GcSpreadSheet1.ActiveSheet.PrintInfo.HeaderCenterImage = StreamToBytes(file.File.OpenRead())
            GcSpreadSheet1.ActiveSheet.PrintInfo.HeaderLeftImage = StreamToBytes(file.File.OpenRead())
            GcSpreadSheet1.ActiveSheet.PrintInfo.HeaderRightImage = StreamToBytes(file.File.OpenRead())
        End If
        GcSpreadSheet1.ActiveSheet.PrintInfo.FooterCenter = "&G"
        GcSpreadSheet1.ActiveSheet.PrintInfo.FooterRight = "&G"
        GcSpreadSheet1.ActiveSheet.PrintInfo.FooterLeft = "&G"
        GcSpreadSheet1.ActiveSheet.PrintInfo.HeaderCenter = "&G"
        GcSpreadSheet1.ActiveSheet.PrintInfo.HeaderRight = "&G"
        GcSpreadSheet1.ActiveSheet.PrintInfo.HeaderLeft = "&G"
End Sub

Private Sub Button2_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles Button2.Click
Dim saveFileDialog = New SaveFileDialog()
saveFileDialog.Filter = "PDF File(.pdf)|*.pdf"
Dim useClick As Boolean = saveFileDialog.ShowDialog()
If (useClick = True) Then
Dim stream = saveFileDialog.OpenFile()
GcSpreadSheet1.SavePDF(stream, 0)
End Sub
Requirements

Target Platforms: Windows 7, Windows 8 Desktop, Windows Vista SP1 or later, Windows Server 2000, Windows 2000 Professional, Windows XP Professional, Windows NT 4.0 Workstation, SP6, Windows NT 4.0 Server, SP6

See Also

Reference

PrintInfo Class
PrintInfo Members

 

 


Copyright © GrapeCity, inc. All rights reserved.