-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathForm1.vb
27 lines (23 loc) · 1.12 KB
/
Form1.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
Imports DevExpress.XtraPrinting
Imports DevExpress.XtraReports.UI
Imports System.Windows.Forms
Imports System
Namespace XlsxExportExample
Public Partial Class Form1
Inherits Form
Public Sub New()
InitializeComponent()
End Sub
Private Sub simpleButton1_Click(ByVal sender As Object, ByVal e As EventArgs)
' Create a report.
Dim report As XtraReport = New XtraReport() With {.Name = "Report Example"}
' Specify export options.
Dim xlsxExportOptions As XlsxExportOptions = New XlsxExportOptions() With {.ExportMode = XlsxExportMode.SingleFile, .ShowGridLines = True, .FitToPrintedPageHeight = True}
' Specify the path for the exported XLSX file.
Dim xlsxExportFileName As String = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) & "\Downloads\" & report.Name & ".xlsx"
' Export the report.
report.ExportToXlsx(xlsxExportFileName, xlsxExportOptions)
System.Diagnostics.Process.Start(xlsxExportFileName)
End Sub
End Class
End Namespace