【下载Stimulsoft Reports.WPF最新版本】

此示例显示如何在代码中使用报表变量。有必要在报表中定义变量,然后可以使用变量名称通过代码设置值。首先,使用变量加载报表:

private void buttonPreview_Click(object sender, System.EventArgs e)
{
    stiReport1.Load("..\\Variables.mrt");
    stiReport1.Compile();
...

然后,为报表变量分配新值,您可以使用报表变量名称:

...
    //Set Variables
    stiReport1["Name"] = tbName.Text;
    stiReport1["Surname"] = tbSurname.Text;
    stiReport1["Email"] = tbEmail.Text;
    stiReport1["Address"] = tbAddress.Text;
    stiReport1["Sex"] = rbMale.IsChecked.GetValueOrDefault();
...

最后,在WPF查看器中显示报表:

...
    stiReport1.ShowWithWpf();
}

示例代码的结果如下图所示:

【Stimulsoft Reports.WPF教程】在代码中使用报表变量

查看原文,下载示例

相关文章:

  • 2021-11-07
  • 2022-01-06
  • 2021-04-21
  • 2021-04-23
  • 2022-01-17
  • 2021-09-27
  • 2021-08-23
  • 2021-12-29
猜你喜欢
  • 2021-04-20
  • 2021-07-14
  • 2022-01-01
  • 2021-05-29
  • 2021-06-14
  • 2021-05-17
  • 2021-12-10
相关资源
相似解决方案