【Stimulsoft Reports Silverlight教程】在代码中使用 表变量

此示例显示如何使用 表变量并在代码中设置其值。

下载Stimulsoft Reports Silverlight最新版本

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

private void btDesign_Click(object sender, System.Windows.RoutedEventArgs e){    var stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("UsingReportVariables.Variables.mrt");    stiReport1.Load(stream);    stream.Close();    stream.Dispose();    stream = null;    stiReport1.Design();}

然后,在btPreview_Click事件中,为 表变量分配新值。您可以使用 表变量名称:

private void btPreview_Click(object sender, System.Windows.RoutedEventArgs e){    viewer.Visibility = System.Windows.Visibility.Visible;    viewer.Report = null;    var stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("UsingReportVariables.Variables.mrt");    stiReport1.Load(stream);    stream.Close();    stream.Dispose();    stream = null;    //Set Variables    stiReport1["Name"] = tbName.Text;    stiReport1["Surname"] = tbSurname.Text;    stiReport1["Email"] = tbEmail.Text;    stiReport1["Address"] = tbAddress.Text;    stiReport1["Sex"] = rbMale.IsChecked;    stiReport1["BirthDay"] = dtBirthDay.DisplayDate;    stiReport1.Render();    viewer.Report = stiReport1;}

下面的屏幕截图中,您可以看到示例代码的结果。

Stimulsoft

下载示例

购买Stimulsoft正版授权,请点击“咨询在线客服”哟!

GrapeCity年末福利大放送
标签: 表 表控件SilverlightStimulsoft

声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2018年11月9日
下一篇 2018年11月9日

相关推荐

发表回复

登录后才能评论