rainforestnet / CrystalReportsNinja

A small Windows Console App that loads external Crystal Reports file, takes parameter inputs and export to various format or even print to printer
http://www.rainforestnet.com
94 stars 78 forks source link

-E print "Invalid Export type." #9

Open wtmh opened 6 years ago

wtmh commented 6 years ago

When using -E print I get this output:

Report loaded successfully Database Login done Exception: Invalid export type. Inner Exception:

Using anything else it prints fine, because well, those formats are accounted for.

Looks like it's currently not possible to print full stop. (I could be way off, I don't know C#.)

Observations: In ArgumentContainer.cs, PrintOutput is set to false by default with no code anywhere else to flip it on: PrintOutput = false;

In ReportProcessor.cs, Line 82, the _printToPrinter variable is assigned PrintOutput: _printToPrinter = ReportArguments.PrintOutput;

In ReportProcessor.cs, Line 259, The _printToPrinter variable is tested here to see if it's being printed to paper and not exporting. But it is not possible to set to true. Specifying -E print is just setting an _outputFormat of "PRINT" which is of course invalid.

There really needs to be a condition the checks the input of that argument in the case of print being passed. Something like: else if (_outputFormat.ToUpper() == "PRINT") _printToPrinter = true;

mharned73 commented 6 years ago

I modified a local copy of the code and it works....

sunk818 commented 6 years ago

Can you share what you modified and submit a pull request? Is the repo owner still active?

gonerdoug commented 4 years ago

I inserted

if (_outputFormat.ToUpper() == "PRINT") _printToPrinter = true;

at line 87 of ReportProcessor.cs and it now works to output to printer.

mhertzfeld commented 4 years ago

For anyone else who may be having this problem. The problem has been fixed in the fork below. Make sure to read the readme for parameter changes.

https://github.com/mhertzfeld/CrystalReportsNinja