GrapeCity.Xaml.SpreadSheet.Data
HeaderLeftImage Property (PrintInfo)
Example 


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

Property Value

The image for the left portion of the printed header. The default value is null, which means that no image is specified.
Example
This example sets the HeaderLeftImage 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 async void button1_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var filePicker = new Windows.Storage.Pickers.FileOpenPicker();
                filePicker.FileTypeFilter.Add(".png");
                Windows.Storage.StorageFile storageFile = await filePicker.PickSingleFileAsync();
                if (storageFile != null)
                {
                    using (var stream = await storageFile.OpenStreamForReadAsync())
                    {
                        this.gcSpreadSheet1.ActiveSheet.PrintInfo.FooterCenterImage = StreamToBytes(stream);
                        this.gcSpreadSheet1.ActiveSheet.PrintInfo.FooterLeftImage = StreamToBytes(stream);
                        this.gcSpreadSheet1.ActiveSheet.PrintInfo.FooterRightImage = StreamToBytes(stream);
                        this.gcSpreadSheet1.ActiveSheet.PrintInfo.HeaderCenterImage = StreamToBytes(stream);
                        this.gcSpreadSheet1.ActiveSheet.PrintInfo.HeaderLeftImage = StreamToBytes(stream);
                        this.gcSpreadSheet1.ActiveSheet.PrintInfo.HeaderRightImage = StreamToBytes(stream);
                    }
                    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"; 
                }
            }
            catch (Exception ex)
            {
                Windows.UI.Popups.MessageDialog dialog = new Windows.UI.Popups.MessageDialog(ex.Message, "Error");
                dialog.ShowAsync();
            }
        }
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 Async Sub button1_Click(sender As Object, e As RoutedEventArgs) Handles button1.Click
        Try
            Dim filePicker As New Windows.Storage.Pickers.FileOpenPicker()
            filePicker.FileTypeFilter.Add(".png")
            Dim storageFile As Windows.Storage.StorageFile = Await filePicker.PickSingleFileAsync()
            If storageFile IsNot Nothing Then
                Using stream = Await storageFile.OpenStreamForReadAsync()
                    GcSpreadSheet1.ActiveSheet.PrintInfo.FooterCenterImage = StreamToBytes(stream)
                    GcSpreadSheet1.ActiveSheet.PrintInfo.FooterLeftImage = StreamToBytes(stream)
                    GcSpreadSheet1.ActiveSheet.PrintInfo.FooterRightImage = StreamToBytes(stream)
                    GcSpreadSheet1.ActiveSheet.PrintInfo.HeaderCenterImage = StreamToBytes(stream)
                    GcSpreadSheet1.ActiveSheet.PrintInfo.HeaderLeftImage = StreamToBytes(stream)
                    GcSpreadSheet1.ActiveSheet.PrintInfo.HeaderRightImage = StreamToBytes(stream)
                End Using
                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 If
        Catch ex As Exception
            Dim dialog As Windows.UI.Popups.MessageDialog = New Windows.UI.Popups.MessageDialog(ex.Message, "Error")
            dialog.ShowAsync()
        End Try
    End Sub
Requirements

Target Platforms: Windows Server 2012, Windows RT

See Also

Reference

PrintInfo Class
PrintInfo Members

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options