从VB.NET中的Crystal报表导出到Excel [英] Export to Excel from Crystal reports in VB.NET

查看:87
本文介绍了从VB.NET中的Crystal报表导出到Excel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我使用水晶报告生成报告。

如果我将报告导出到excel。,记录会导出。



但是没有正确的对齐方式。



现在我想看到像水晶报告一样的excel记录。



目前我正在使用以下代码将记录导出到Excel



尝试

Dim CrExportOptions As ExportOptions

Dim CrDiskFileDestinationOptions As New _

DiskFileDestinationOptions()

Dim CrFormatTypeOptions As New ExcelFormatOptions

CrDiskFileDestinationOptions.DiskFileName = _

c:\\ \\ _crystalExport.xls

CrExportOptions = cryRpt.ExportOptions

使用CrExportOptions

.ExportDestinationType = ExportDestinationType.DiskFile

.ExportFormatType = ExportFormatType.Excel

.DestinationOptions = CrDiskFileDestinationOptions

.FormatOptions = C rFormatTypeOptions

结束

cryRpt.Export()

Catch ex As Exception

MsgBox(ex.ToString)

结束尝试



你能帮忙吗?

解决方案

< blockquote>尝试使用ExcelUseConstantColumnWidth为false

  Dim  CrFormatTypeOptions  As   ExcelFormatOptions 
CrFormatTypeOptions.ExcelUseConstantColumnWidth = False



您可能还需要更改报告以避免在导出到Excel时出现对齐问题。 查看此文章。 [ ^ ]


Hi,

i am generating report by using crystal reports.
if i export the report to excel ., the records getting exporting.

But there is no proper alignment.

Now i want to see the records into excel as like crystal report.

Presently i am using the below code for exporting the records into Excel

Try
Dim CrExportOptions As ExportOptions
Dim CrDiskFileDestinationOptions As New _
DiskFileDestinationOptions()
Dim CrFormatTypeOptions As New ExcelFormatOptions
CrDiskFileDestinationOptions.DiskFileName = _
"c:\crystalExport.xls"
CrExportOptions = cryRpt.ExportOptions
With CrExportOptions
.ExportDestinationType = ExportDestinationType.DiskFile
.ExportFormatType = ExportFormatType.Excel
.DestinationOptions = CrDiskFileDestinationOptions
.FormatOptions = CrFormatTypeOptions
End With
cryRpt.Export()
Catch ex As Exception
MsgBox(ex.ToString)
End Try

Can you please any one help on this?

解决方案

try with ExcelUseConstantColumnWidth as false

Dim CrFormatTypeOptions As New ExcelFormatOptions
CrFormatTypeOptions.ExcelUseConstantColumnWidth = False


You may need to change the report as well to avoid alignment issues when exporting to excel. check this article.[^]


这篇关于从VB.NET中的Crystal报表导出到Excel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆