【问题标题】:Parameter Problem with Crystal Reports ExportCrystal Reports 导出的参数问题
【发布时间】:2009-02-09 17:08:52
【问题描述】:

我正在尝试将水晶报表导出为 pdf,然后通过电子邮件发送,但每次执行导出命令时,都会收到 ParameterFieldCurrentValue 异常。

我已经在 ReportDocument 中跟踪了 Parameter 集合的值,并且正在那里设置这些值。此外,所有四个参数都是字符串。第一个设置为允许多个值以及离散值或范围值。我调用的对话框为该参数的可选选项设置值。没有其他参数字段。但是,报告中有公式字段。

我的代码是:

SelectionDialog sd = new SelectionDialog(null, null, 
@"\\er1\common\bfi_apps\ReportMasterTwo\eds\custno.csv", true, false);
DialogResult dr = sd.ShowDialog();
string filename = @"c:\documents and settings\aap\desktop\salesanalysis.pdf";

if (dr == DialogResult.OK && sd.selectedVals != null)
{
    for (int i = 0; i < sd.selectedVals.Count; i++)
    {
        ar100SalesABC_edcustom1.Parameter_Customer_Number.CurrentValues.AddValue
    (sd.selectedVals[i]);
    }

    ar100SalesABC_edcustom1.Parameter_Fiscal_period.CurrentValues.AddValue("1");
    ar100SalesABC_edcustom1.Parameter_Fiscal_year.CurrentValues.AddValue("2007");
    ar100SalesABC_edcustom1.Parameter_Product_Type.CurrentValues.AddValue("F");


    ar100SalesABC_edcustom1.ExportToDisk
    (ExportFormatType.PortableDocFormat, filename); // ERROR HAPPENS HERE

    // .. emailing code and other stuff
}

我做错了什么?还有其他更好的方法吗?我已经尝试过导出选项,我已经尝试过 SetParameter,但我一直收到该错误。

【问题讨论】:

    标签: c# pdf crystal-reports


    【解决方案1】:

    我最终使用 SetParameter 而不是当前值方法,并为多值参数使用值集合。

    我也没有使用类型化的报告,而是使用了非类型化的报告文档。

    我还从 Crystal Reports 复制了 sql,并用它来制作数据集。我认为数据集是我之前缺少的部分。

    它现在可以工作了,虽然它看起来不像上面的代码。

    【讨论】:

      猜你喜欢
      • 2011-04-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多