原創(chuàng)|使用教程|編輯:鄭恭琳|2016-01-06 12:09:43.000|閱讀 1698 次
概述:本片文章主要介紹Stimulsoft Reports.Net開(kāi)發(fā)者遇到的一些常見(jiàn)問(wèn)題及解決方案。
# 界面/圖表報(bào)表/文檔/IDE等千款熱門(mén)軟控件火熱銷(xiāo)售中 >>
相關(guān)鏈接:
< Stimulsoft Reports.Net v2015.3最新版本下載>
代碼如下:
DataBand1.Sort = new string[2] { "ASC", "Name" };
使用StiComponent.GetActualSize方法,該方法返回組件的尺寸。但是,請(qǐng)注意,如果你想要該方法返回CanGrow屬性的正確數(shù)據(jù),CanShrink和AutoWidth屬性必須設(shè)置為true。
代碼如下:
C#
StiComponent component = report.GetComponentByName("ComponentName");
VB
Dim Component As StiComponent = Report.GetComponentByName("ComponentName");
使用StiRichText.RtfText屬性。
使用以下代碼:
component.Bookmark = "{Categories.CategoryName}";
Text屬性中的文本表達(dá)式在報(bào)表渲染時(shí)被計(jì)算、被保存,將計(jì)算出一個(gè)結(jié)果值后會(huì)放置在TextValue中。換句話說(shuō)就是你可以指定表達(dá)式。示例如下:
text1.Text = "Phone: {Customers.Phone}";
在TextValue中,你只可以指定字符串:
text1.TextValue = "123";
如果Text和TextValue一塊被指定,那么TextValue輸出將會(huì)被使用。
在該字段你需要指定數(shù)據(jù)源和數(shù)據(jù)列。示例如下:
Customers.Photo
注意不能放括號(hào)。你也可以通過(guò)鏈接進(jìn)行調(diào)用。如下:
Products.Customers.Photo
使用BeforePrintEvent事件,在事件中指定以下代碼:
C#
Image1.Image = Image.FromFile(MyDataSource.ImagePath);
VB
Image1.Image = Image.FromFile(MyDataSource.ImagePath)
你還可以使用ImageData屬性:
C#
{Image.FromFile(MyDataSource.ImagePath)}
VB
{Image.FromFile(MyDataSource.ImagePath)}
ComboBox comboBox = ReportComboBox.Control;
ReportComboBox.Items.Add("123");
使用StiReport類(lèi)的Script屬性。該屬性包含報(bào)表的代碼文本。
使用StiReport類(lèi)的ScriptNew方法。代碼如下:
C#
StiReport report = new StiReport(); report.ScriptNew();
VB
Dim Report As StiReport = New StiReport() Report.ScriptNew()
使用StiReport類(lèi)的ScriptUpdate方法來(lái)更新報(bào)表的代碼。方法如下:
C#
StiReport report = new StiReport(); report.ScriptUpdate();
VB
Dim Report As StiReport = New StiReport() Report.ScriptUpdate()
需注意的是,在報(bào)表編譯前,報(bào)表代碼會(huì)自動(dòng)更新。因此沒(méi)必要調(diào)ScriptUpdate方法。
確保屬性窗口可見(jiàn)并且選中(按F4鍵一次或兩次或通過(guò)菜單“View” -> “Properties”)。在屬性窗口中選擇組合框中最上面的項(xiàng)目(例如:“MyReport:Report”),將會(huì)出現(xiàn)“Referenced Assemblies“屬性,點(diǎn)擊[…]按鈕編輯其值。添加你的程序集,點(diǎn)擊[OK]按鈕。現(xiàn)在你就可以使用報(bào)表代碼中自定義程序集中的功能了。
步驟如下:
C#
StiReport report = new StiReport(); report.Load("report.xml"); //Compile the report first report.Compile(); //Initialize the field in a report report.CompiledReport["Parameters"] = OurParameters; report.Render();
VB
Dim Report As StiReport = New StiReport() Report.Load("report.xml") 'Compile the report first Report.Compile() 'Initialize the field in a report Report.CompiledReport("Parameters") = OurParameters Report.Render()
在上面的步驟都完成后你就可以從腳本中訪問(wèn)你的應(yīng)用程序字段了。示例:
{Parameters.SomeParameter}
在列名稱(chēng)前添加一個(gè)@符號(hào),示例:@class
購(gòu)買(mǎi)最新正版授權(quán)!詳情請(qǐng)""
迎春納福,金猴獻(xiàn)瑞,革新之年雙節(jié)同慶,惠享不停驚喜連連!優(yōu)惠詳情點(diǎn)擊查看>>
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請(qǐng)務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請(qǐng)郵件反饋至chenjj@fc6vip.cn