原創|使用教程|編輯:鄭恭琳|2015-12-10 09:34:30.000|閱讀 2234 次
概述:本片文章主要介紹Stimulsoft Reports.Net開發者在處理變量時遇到的常見問題及解決方案。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
< Stimulsoft Reports.Net v2015.3最新版本下載>
可以使用以下代碼來實現給報表添加變量。
添加int型的MyVariable變量代碼示例:
C#
report.Dictionary.Variables.Add(new StiVariable("Category", "MyVariable", typeof(int), "1", false));
VB
Report.Dictionary.Variables.Add(New StiVariable("Category", "MyVariable", CType(GetType(int), Type), "1", False))
添加string型的MyVariable變量代碼示例:
C#
report.Dictionary.Variables.Add(new StiVariable("Category", "MyVariable", typeof(string), "1", false));
VB
Report.Dictionary.Variables.Add(New StiVariable("Category", "MyVariable", CType(GetType(String), Type), """1""", False))
要訪問變量的值,你可以使用以下代碼:
C#
StiReport report = new StiReport(); report.Load("Variables.mrt"); report.Compile(); //設置變量 report["VariableName"] = "Value"; //獲取變量 object value = report["VariableName"];
VB
Dim Report As StiReport = New StiReport() Report.Load("Variables.mrt") Report.Compile() '設置變量 Report.Item("VariableName") = " Value " '獲取變量 Dim Value As Object = Report.Item("VariableName")
使用以下代碼:
text1.Text = "{PageNofM}";
購買最新正版授權!""
慧都年終盛典火爆開啟,一年僅一次的最強促銷,破冰鉅惠不容錯過!!優惠詳情點擊查看>>
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn