【Stimulsoft Reports Silverlight教程】使用报表组件
下载Stimulsoft Reports Silverlight最新版本
此示例显示如何从代码编辑某些组件属性。报表的所有组成部分都在页面上。页面位于报表对象中。要获取对组件对象的引用,必须首先获取对该页面的引用。它们可以通过它的名字获得。例如,更改报表中的文本框值:
private void btPreview_Click(object sender, RoutedEventArgs e) { viewer.Report = null; var stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream( "WorkWithReportComponents.Work_with_Components.mrt"); stiReport1.Load(stream); stream.Close(); stream.Dispose(); stream = null; ((StiText)stiReport1.Pages["Page1"].Components["Text1"]).Text.Value = textBox1.Text; viewer.Visibility = System.Windows.Visibility.Visible; stiReport1.Render(); viewer.Report = stiReport1; }
下面的屏幕截图中,您可以看到示例代码的结果。