devexpress导出成html文件,如何: 把报表导出为 HTML - Devexpress Winform 中文文档

此篇博客介绍了如何使用 DevExpress 报表库创建 HTML 格式的报告,包括设置字符集、页眉边框、导出范围等详细步骤,并提供了一个自动打开生成文件的方法。重点在于HTMLExportOptions 的配置和实际文件操作过程。
摘要由CSDN通过智能技术生成

Imports System.Drawing

Imports System.Diagnostics

Imports DevExpress.XtraPrinting

Imports DevExpress.XtraReports.UI

' …

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _

Handles Button1.Click

' A path to export a report.

Dim reportPath As String = "c:\\Test.html"

' Create a report instance.

Dim report As New XtraReport1()

' Get its HTML export options.

Dim htmlOptions As HtmlExportOptions = report.ExportOptions.Html

' Set HTML-specific export options.

htmlOptions.CharacterSet = "UTF-8"

htmlOptions.RemoveSecondarySymbols = False

htmlOptions.Title = "Test Title"

' Set the pages to be exported, and page-by-page options.

htmlOptions.ExportMode = HtmlExportMode.SingleFilePageByPage

htmlOptions.PageRange = "1, 3-5"

htmlOptions.PageBorderColor = Color.Blue

htmlOptions.PageBorderWidth = 3

' Export the report to HTML.

report.ExportToHtml(reportPath)

' Show the result.

StartProcess(reportPath)

End Sub

' Use this method if you want to automaically open

' the created HTML file in the default program.

Public Sub StartProcess(ByVal path As String)

Dim process As New Process()

Try

process.StartInfo.FileName = path

process.Start()

process.WaitForInputIdle()

Catch

End Try

End Sub

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值