GrapeCity.Xaml.SpreadSheet.Data Namespace > PrintInfo Class : HeaderCenterImage Property |
'Declaration <DefaultValueAttribute()> Public Property HeaderCenterImage As Byte()
'Usage Dim instance As PrintInfo Dim value() As Byte instance.HeaderCenterImage = value value = instance.HeaderCenterImage
[DefaultValue()] public byte[] HeaderCenterImage {get; set;}
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
Target Platforms: Windows Server 2012, Windows RT