How to set the available export options in the .Net crystal

Posted by nix1016 on 18-Aug-2015 20:44

Hi All,

I'm having issues with trying to set the list of available export formats in the .net crystal reports viewer. There are quite a few posts floating on how to do this in C# & VB but the syntax is something that I'm not quite sure how to translate to ABL.

This is the syntax in C#:

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

I understand that I have to assign the available formats to an integer variable which I can then assign to my crystal viewer using crystalReportViewer1:AllowedExportFormats = exportFormatFlags. But I'm not sure how to set this exportFormatFlag. I've tried a couple of things all to no avail. It's probably something simple but I just can't quite nut it out as I don't have any experience in .Net developement.

Thanks in Advance!

Posted by Garry Hall on 20-Aug-2015 07:39

You can use the result from EnumHelper as the parameter to EnumHelper. e.g.

DEFINE VARIABLE myKeys AS class System.Windows.Forms.Keys no-undo.

myKeys  = CAST(Progress.Util.EnumHelper:Or(

   System.Windows.Forms.Keys:Control,

   System.Windows.Forms.Keys:Alt  ),System.Windows.Forms.Keys).

myKeys  = cast(Progress.Util.EnumHelper:Or(myKeys, System.Windows.Forms.Keys:Shift),System.Windows.Forms.Keys).

MESSAGE STRING(myKeys)

   VIEW-AS ALERT-BOX INFO BUTTONS OK.

All Replies

Posted by nix1016 on 18-Aug-2015 22:17

I think I have figured it out with the below code, however, this is only allowing me to use 2 formats as the Progress.Util.EnumHelper:Or( ) method only accepts 2 arguments. How can I specify more formats?

DEFINE VARIABLE exportTypes AS class system.enum no-undo.

exportTypes  = Progress.Util.EnumHelper:Or( CrystalDecisions.Shared.ViewerExportFormats:PdfFormat, CrystalDecisions.Shared.ViewerExportFormats:ExcelFormat ).

CrystalReportViewer1:AllowedExportFormats = int(string(CAST( exportTypes, CrystalDecisions.Shared.ViewerExportFormats))).

Posted by Garry Hall on 20-Aug-2015 07:39

You can use the result from EnumHelper as the parameter to EnumHelper. e.g.

DEFINE VARIABLE myKeys AS class System.Windows.Forms.Keys no-undo.

myKeys  = CAST(Progress.Util.EnumHelper:Or(

   System.Windows.Forms.Keys:Control,

   System.Windows.Forms.Keys:Alt  ),System.Windows.Forms.Keys).

myKeys  = cast(Progress.Util.EnumHelper:Or(myKeys, System.Windows.Forms.Keys:Shift),System.Windows.Forms.Keys).

MESSAGE STRING(myKeys)

   VIEW-AS ALERT-BOX INFO BUTTONS OK.

Posted by nix1016 on 20-Aug-2015 20:20

Ah I was going to try this next but I thought there would surely be a better way as I have over 10 formats that I want to show up so I would need do this 5+ times. But if that's the only way then I'd just have to do it that way. Thanks!

This thread is closed