How to limit export formats in crystal reports

For Crystal reports for visual studio.net 2005, you can export the report to various file formats such as pdf, excel, word, rpt, etc. If I just want to limit the user to viewing only excel and word formats and set the default file format to succeed, is there any way to do this? Sometimes too many choose not well, right?

+3
source share
4 answers

You do not mention whether you use C # / VB.NET or Web / WinForms.

WITH#

I do not think that's possible. You will need to implement your own export button.

Something in the lines of this MSDN article

WITH#

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

// Set the excel format options.
excelFormatOpts.ExcelUseConstantColumnWidth = true;
exportOpts.ExportFormatType = ExportFormatType.Excel;
exportOpts.FormatOptions = excelFormatOpts;

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

Report.Export ();

Vb.net

' Declare variables and get the export options.
Dim exportOpts As New ExportOptions()
Dim diskOpts As New DiskFileDestinationOptions()
Dim excelFormatOpts As New ExcelFormatOptions()
exportOpts = Report.ExportOptions

' Set the excel format options.
excelFormatOpts.ExcelTabHasColumnHeadings = true

exportOpts.ExportFormatType = ExportFormatType.Excel
exportOpts.FormatOptions = excelFormatOpts

' Set the export format.
exportOpts.ExportFormatType = ExportFormatType.Excel

exportOpts.ExportDestinationType = ExportDestinationType.DiskFile

' Set the disk file options.
diskOpts.DiskFileName = fileName
exportOpts.DestinationOptions = diskOpts

Report.Export()

Vb.net

DLL . i.e DLL Excel, Excel

+1

:

    Dim formats As Integer
    formats = (CrystalDecisions.Shared.ViewerExportFormats.PdfFormat Or CrystalDecisions.Shared.ViewerExportFormats.XLSXFormat)

    CrystalReportViewer1.AllowedExportFormats = formats
+4

CRVS2010, .

CRVS2010 - . # , CrystalReportViewer PDF Excel:

int exportFormatFlags = (int)(CrystalDecisions.Shared.ViewerExportFormats.PdfFormat | CrystalDecisions.Shared.ViewerExportFormats.ExcelFormat);
CrystalReportViewer1.AllowedExportFormats = exportFormatFlags;

. .

http://scn.sap.com/community/crystal-reports-for-visual-studio/blog/2011/01/26/export-file-formats-for-sap-crystal-reports-for-vs-2010

+4

Crystal Reports Rpt, :

Dim formats As Integer
formats = (CrystalDecisions.Shared.ViewerExportFormats.AllFormats Xor CrystalDecisions.Shared.ViewerExportFormats.RptFormat)

CrystalReportViewer1.AllowedExportFormats = formats

Or Short Version :

CrystalReportViewer1.AllowedExportFormats = (CrystalDecisions.Shared.ViewerExportFormats.AllFormats Xor CrystalDecisions.Shared.ViewerExportFormats.RptFormat)
+2
source

Source: https://habr.com/ru/post/1795428/


All Articles