使用crystal report(ExportFormatType.ExcelRecord)在导出DATA时仅动态设置列宽,以便在c#中出色 [英] Set column width dynamically while exporting DATA ONLY to excel in c# using crystal report (ExportFormatType.ExcelRecord)

查看:168
本文介绍了使用crystal report(ExportFormatType.ExcelRecord)在导出DATA时仅动态设置列宽,以便在c#中出色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用下面的代码



//声明变量并获取导出选项。

ExportOptions exportOpts = new ExportOptions() ;

ExcelFormatOptions excelFormatOpts = new ExcelFormatOptions();

DiskFileDestinationOptions diskOpts = new DiskFileDestinationOptions();

exportOpts = rpt.ExportOptions;



//设置excel格式选项。

excelFormatOpts.ExcelConstantColumnWidth = 100;

excelFormatOpts.ExcelUseConstantColumnWidth = true;

exportOpts.ExportFormatType = ExportFormatType.ExcelRecord;

exportOpts.FormatOptions = excelFormatOpts;



//设置磁盘文件选项和导出。

exportOpt s.ExportDestinationType = ExportDestinationType.DiskFile;

diskOpts.DiskFileName = strFilename;

exportOpts.DestinationOptions = diskOpts;



rpt.Export();





问题:



现在我需要格式化。我想在excel中设置列宽。



我可以这样做吗?



来自我的上面代码下面的行似乎不起作用



excelFormatOpts.ExcelConstantColumnWidth = 100;

excelFormatOpts.ExcelUseConstantColumnWidth = true;



我很欣赏这方面的任何帮助,因为这个问题正在耗费我的时间。



感谢您提前提供任何帮助。

I am using the below code

// Declare variables and get the export options.
ExportOptions exportOpts = new ExportOptions();
ExcelFormatOptions excelFormatOpts = new ExcelFormatOptions();
DiskFileDestinationOptions diskOpts = new DiskFileDestinationOptions();
exportOpts = rpt.ExportOptions;

// Set the excel format options.
excelFormatOpts.ExcelConstantColumnWidth = 100;
excelFormatOpts.ExcelUseConstantColumnWidth = true;
exportOpts.ExportFormatType = ExportFormatType.ExcelRecord;
exportOpts.FormatOptions = excelFormatOpts;

// Set the disk file options and export.
exportOpts.ExportDestinationType = ExportDestinationType.DiskFile;
diskOpts.DiskFileName = strFilename;
exportOpts.DestinationOptions = diskOpts;

rpt.Export();


Question:

Now I need to format. I want to set column width in the excel.

Can I do it?

From my above code the below lines seems not to function

excelFormatOpts.ExcelConstantColumnWidth = 100;
excelFormatOpts.ExcelUseConstantColumnWidth = true;

I appreciate any help in this regard as this issue is eating my time.

Thank you for any help in advance.

推荐答案

检查这些

从Crystal Reports导出到Excel时,列设置不起作用 [ ^ ]

导出到Microsoft Excel [ ^ ]

在Crystal Reports .NET中导出到Excel - 完美的Excel导出 [ ^ ]
Check these
Column Settings Not Working When Exporting From Crystal Reports To Excel[^]
Exporting to Microsoft Excel[^]
Exporting to Excel in Crystal Reports .NET - Perfect Excel Exports[^]


这篇关于使用crystal report(ExportFormatType.ExcelRecord)在导出DATA时仅动态设置列宽,以便在c#中出色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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