-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainWindow.xaml.vb
43 lines (33 loc) · 1.49 KB
/
MainWindow.xaml.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
Imports DevExpress.Export
Imports DevExpress.Export.Xl
Imports DevExpress.XtraPrinting
Imports System.Collections.ObjectModel
Imports System.Diagnostics
Imports System.Windows
Namespace WpfApplication80
Public Partial Class MainWindow
Inherits Window
Public Sub New()
Me.InitializeComponent()
Dim items As ObservableCollection(Of Item) = New ObservableCollection(Of Item)()
For i As Integer = 1 To 30 - 1
items.Add(New Item() With {.Name = "Name" & i, .MinValue = i + 4, .MaxValue = i + 10})
Next
Me.grid.ItemsSource = items
End Sub
Private Sub Button_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
Dim options As XlsxExportOptionsEx = New XlsxExportOptionsEx() With {.UnboundExpressionExportMode = UnboundExpressionExportMode.AsFormula, .LayoutMode = LayoutMode.Table}
AddHandler options.BeforeExportTable, AddressOf options_BeforeExportTable
Me.view.ExportToXlsx("Document.xlsx", options)
Call Process.Start("Document.xlsx")
End Sub
Private Sub options_BeforeExportTable(ByVal e As BeforeExportTableEventArgs)
e.Table.Style.Name = XlBuiltInTableStyleId.Light4
End Sub
End Class
Public Class Item
Public Property Name As String
Public Property MinValue As Integer
Public Property MaxValue As Integer
End Class
End Namespace