fastreport 中有sql语句中like的用法用法吗

FastReport报表控件使用技巧总结-FastReport中文网
电话:023-
最受欢迎的文章
2012年06月(6)2012年07月(83)2012年08月(62)2012年09月(30)2012年10月(8)2012年11月(11)2012年12月(9)2013年01月(7)2013年02月(1)2013年03月(1)2013年04月(1)2013年05月(2)2013年06月(1)2013年07月(2)2013年08月(4)2013年09月(4)2013年10月(3)2013年11月(2)2013年12月(1)2014年01月(1)2014年03月(1)2015年06月(2)2015年10月(1)2015年11月(9)2015年12月(2)2016年02月(1)2016年04月(1)2016年05月(16)2016年07月(4)
热门Tag标签
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
FastReport报表控件使用技巧总结
作者:zhuhm&&&&来源:FastReport中文网&&&&浏览:Loading... &&&& 日期:
1.FastReport中如何访问报表中的对象?
可以使用FindObject方法。
TfrxMemoView(frxReport1.FindObject('memo1')).Text:='FastReport';
2.FastReport中如何使用上下标?
设置frxmemoview.AllowHTMLTags:= T在Text输入如下
上标:mm&sup&2&/sup&
下表:k&sub&6&/sub&
举一反三,你还可以使用其他HTML标记。
3.FastReport中如何打印总页数?
设置两次报表后加入引号内内容 "第[Page#]页共[TotalPages#]页"
4.FastReport中如何动态加入变量及变量组?
建立变量组名
frxreport1.Variables.Add .Name:=' '+变量组名;
建立变量名
frxreport1.Variables.AddVariable('组名,如果为不存的组或空,则为默认组,这里不需要空格',变量名,变量初始值);
例如要建立变量组Yuan,二个变量Yuan1,Yuan2,则为
frxreport1.Variables.Add .Name:=' Yuan'注意前面是空格
frxreport1.Variables.AddVariable('Yuan',Yuan1,初始值)
frxreport1.Variables.AddVariable('Yuan',Yuan2,初始值)
5.FastReport中如何加入自定义函数?
Fastreport可以自己加入需要的函数,来实现特定的功能。过程就是:
1)添加函数到报表中。
frxreport1.AddFunction('完整的函数声明');
如有一个自定义函数,为GetName(Old:String):S这个函数通过数据集的一个字段,得到另一个返回值。
则语句为:frxreport1.AddFunction('Function
GetName(Old:String):S');
2)脚本中使用函数。
在脚本中或报表中使用自定义函数,就像使用其它Fastreport内置函数一样。
3)程序中处理函数。
使用函数是通过frxreport1的OnUserFunction函数来实现的。
OnUserFunction的声明如下:Function(constMethodName:
Svar Params: Variant):
比如上面的函数,首先要有一个函数,这个函数是GetName的实现部分。如有一个在程序中实现的函数。
RealGetName(Old:String):S这个函数名是无所谓的,也可以是GetName。
在OnUserFunction的事件处理中有如下代码即可完成自定义函数在报表中的使用。
if CompareText(MethodName,'GetName')=0
thenResult:=RealGetName(VarToStr(Params[0]));
我一般都是使用CompareText来比较函数名,因为我发现二个版本的Fastreport,一个是MethodName全部自动变成了小写,一个是全部自动变成了大写,所以干脆用CompareText来比较,肯定不会出错。
如果有多个参数,则依次传递Params[0],Params[1]即可,要保持顺序一致。
这里要注意一点,如果参数为指针,则不能直接使用Pointer(Integer(Params[0]))。因为实际传递过来的是指针的整数值,可以使用Pointer(StrToInt(VarToStr(Params[0])))。
6.FastReport中如何共用TFrxreport及TfrxDBDataSet?
一个程序中,不管多么大的程序,只要打印或预览时是模式的,则完全可以共用一个TFrxreport变量及几个TfrxDBDataSet。只不过,要注意完成一个报表程序的步骤,主要是下面几步
1)清除报表,得到一个全新的报表内容。
Frxreport1.clear。
2)设置要使用的TfrxDBDataSet的别名,如果不需要可以省略这一步,但一般最好不同的报表用不同的别名。
注意这一步要在加载报表文件之前,因为一般设计报表文件时已经包含了别名信息。
frxDBDataSet1.UserName:=别名;
3)加载报表或动态建立一个TfrxReportPage。
Frxreport1.LoadFromFile(报表文件的完整文件名);
4)关联TfrxDBDataSet与TDataset,并设置要使用哪些TfrxDBDataSet。
Frxreport1.DataSets.C//先清除原来的数据集
frxDBDataSet1.DataSet:=dataset1;//关联Fastreport的组件与TDataset数据集。
Frxreport1.DataSets.Add(frxDBDataSet1);//加载关联好的TfrxDBDataSet到报表中。
经过这几步后,就可以像单独使用一个Tfrxreport一样使用共用的报表组件了
7.FastReport中如何使用脚本,脚本中使用变量?
很多时候,我们希望把对报表的控制放到报表的脚本中,通常我这样做有二个原因:
1)能够根据字段内容的变化而使用不同的设置,因为如果想在程序中实现这样功能,就不得不用自定义函数,函数的实现要放到程序中,函数可能需要传递很多参数,效率低下。
2)把不同报表的控制放到脚本中,可以实现报表的模块化,程序只是简单的设置数据集的关系,并加载硬盘上的报表文件,不同报表的不同实现方式,显示方式,均放到报表文件中,程序简洁
,易维护,易升级。
当然,这样的缺点就是程序中加载报表时的数据集别名必须与设计报表时的别名一致。
脚本的使用与通常程序的使用并没有太多的区别,就是像正常的程序那样引用控件的名称即可。
但注意对变量的使用,需要把变量名或表达式用&&括起来。
实现打印分组的页数。基本的原理就是:
1)必须使用二遍报表,因为FS算总页数就是需要二遍报表的。
2)在第一遍报表中,在GroupBand打印前,动态的建立整数型数组变量,用以保存上一个分组的总页数。
3)在最后一遍报表时,需要显示分组页数的Tfrxmemoview取得数组中的数据,但最后一个分组不会有总数,可以通过总页数减去GroupBand事件中保存的页数来取得。
4)代码中处理了一页多组,及一组多页打印分组头的情况。可以看到这些特殊处理的代码说明。
5)我特意在分组尾及页脚都用了Tfrxmemoview来显示这些数据,说明在不同情况下的显示。
8.FastReport中如何在脚本中根据字段名改变Tfrxmemoview的内容?
假设有数据表“用户”,字段ID为用户标识,Name为用户名,打印时要求,如果用户名为空,则打印“无用户名”,否则打印出“用户名:实际的用户”,则可以在ID的Tfrxmemoview控件的
OnAfterData事件中写如下脚本。
if&frxDBDataSet1."Name"&='' then
Memo2.Text:='无用户名'
Memo2.Text:='用户名:[frxDBDataSet1."Name"]'
Memo2是放置用户名称数据的Tfrxmemoview控件。
这里注意,要在脚本中访问变量需要把变量用&&包括起来。
9.FastReport中如何动态调整高度?
我经常使用下面的几个函数来实现Band及Tfrxmemoview高度的动态调整,需要注意的是:下面的函数只能调整一个Band中多行的最后一行,如果只有一行(多数情况下应该是这样)就无所谓了
,而且这是在宽度已经固定的前提下。在想要调整高度的Band的OnBeforePrint事件中写SetMemo(Sender);,代码如下,粘贴到代码页中就可以使用。
下面的代码也可以演变一些,实现动态宽度等。我多处都判断了Tag是否为7635,因为我经常需要单独调用其中的某个函数。
//7635为保留数字,表示不作任何调整,通常用在多行的最上方
function Biger(Old:Extended):I
Result:=Trunc(Old);
if Frac(Old)&0 then
Result:=Result+1;
procedure JustHeight(Sender:TfrxComponent);
RealHeight:I
RealHeight:=Biger(TFrxMemoView(Sender).CalcHeight+TFrxMemoView(Sender).Top);
ifBiger(TfrxBand(Sender.Parent).Height)&RealHeight
//若MEMO的高度小于BAND但计算高度大于BAND,则在调整BAND的函数中就会被调整
TfrxBand(Sender.Parent).Height:=Biger(RealHeight);
JustBandHeight(Sender.Parent);
TfrxMemoView(Sender).Height:=TfrxBand(Sender.Parent).Height
-TfrxMemoView(Sender).T
procedureJustBandHeight(Sender:TfrxComponent);
for I:=0 to Sender.Objects.Count-1 do
if TObject(Sender.Objects.Items[I]) isTFrxMemoView
ifTFrxMemoView(Sender.Objects.Items[I]).Tag=7635 then
//如果小才改变,如果大则不能改变
ifBiger(TfrxMemoView(Sender.Objects.Items[I]).Height+
TfrxMemoView(Sender.Objects.Items[I]).Top)&&Biger(TfrxBand(Sender).Height)then
TfrxMemoView(Sender.Objects.Items[I]).Height:=
Biger(TfrxBand(Sender).Height-TfrxMemoView(Sender.Objects.Items[I]).Top);
procedure JustMemo(Sender:TfrxComponent);
if not Engine.FinalPass then E
if Sender.Tag&&7635 then
JustHeight(Sender);
procedure SetMemo(Sender:TfrxComponent);
for I:=0 to Sender.Objects.Count-1 do
if TObject(Sender.Objects.Items[I]) isTFrxMemoView
ifTfrxMemoView(Sender.Objects.Items[I]).Tag&&7635
TfrxMemoView(Sender.Objects.Items[I]).OnAfterData:='JustMemo';
10.FastReport中如何实现套打?
纸张是连续的带锯齿的已经印刷好的,类似于通信公司发票这里设计的是客户销售记录。
客户有两个要求:
1、因为打印纸张是印刷的,明细记录只有8行,所以,如果明细记录如果不到8行,就将公司名称、销售记录打印在上面,下一个公司的信息打印在下一页,而不能接在该页上(呵呵,是啊,如
果接在一起,那印刷单就失去意义了)
2、如果销售记录超过8行,则从第9行开始的销售记录打印在下一页(所谓下一页,其实就是锯齿分割的下一*,称呼“下一份”比较妥切?),并且抬头(也就是公司名称)也要打上(如果不打印抬头,撕下了后,可能弄混淆了,不知道这一页是哪个公司的)
问题描述标准说法是不是应该叫“打印固定行”、“强制换页”?
回答:每页打印抬头的问题,就是把包含公司名称的Band每页重复打印即可。属性中有一个的。
勾选就行了。
至于固定行,实际上设计套打时,页面大小都是固定的,每一行的高度也都是固定的,页眉与页脚也是固定的,这样设计出来的报表可打印的行数自然就是你要求的 8行了。根本不需要什么强
制换页。因为根据纸张会自动换页的。你要做的就是设计好纸张尽寸、页面布局,就得了,套打是一种最简单的打印,不用想的太复杂。
11.FastReport中如何实现连续打印?
很多人认为Fr不能实现连续打印,以为只能通过自己写函数调用打印函数来实现连续打印,实际上,Fr可以轻易的实现连续打印,同时,实现时又是非常简单,你甚至可以在你的程序的打印设
置中简单的让客户选择是否连续打印,其它都可以保持不变。
function PelsTomm(Pels:Extended):E
Result:=Pels/Screen.PixelsPerInch*25.4;
procedurePrintSerial(Frx:TFrxRSequencePage:Byte=0);
P:TfrxReportP
{必须是二遍报表,否则无法计算总页数。下面的方法只适用于没有页脚的情况,因为如果有页脚的话FreeSpace就始终为0了。可以用报表脚来代替。因为是连续打印,也可以看作只有一页,报表脚也就相当于页脚了}
if not Frx.Engine.DoublePass then E
//SequencePage指要连续打印的页面,普通报表就是0
P:=TfrxReportPage(Frx.Pages[SequencePage]);
R1:=P.TopMargin+P.BottomM
while Frx.PrepareReport do
if (Frx.Engine.TotalPages&=1) thenB
R:=Pelstomm(Frx.Engine.TotalPages*Frx.Engine.PageHeight-
Frx.Engine.FreeSpace)+R1;
P:=TfrxReportPage(Frx.Pages[SequencePage]);
P.PaperHeight:=R;
{必须用上面的循环代码来得到准确的空白区域不能用通过计算总页数减去各页的页边距的方法来获得空白区域因为如果碰到一条记录过宽的情况导致换页,就不准确了。}
R:=Pelstomm(Frx.Engine.TotalPages*Frx.Engine.PageHeight-
Frx.Engine.FreeSpace)+R1;
P:=TfrxReportPage(Frx.Pages[SequencePage]);
P.PaperHeight:=R;
在预览或打印前先调用PrintSerial即可。
12.如何在程序中指定打印机名称?
frxReport1.Report.PrintOptions.Printer := '打印机名称';
13.如何使用打印机直接打印?
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender:TObject);
Printer.PrinterIndex := 0;{网络打印机也是要安装在你本地的操作系统中的,直接使用顺序
Printers.Printer.SetPrinter('HP1020','HP1020','LPT1',0);{打印机名字,驱动,端口等,
自查,我是用虚拟打印机测试的}
Printers.Printer.BeginD
Printers.Printer.Canvas.TextOut(10,10,'打印这一行字');
Printers.Printer.EndD
14.如何打印空白处?
在打印报表的Band处的OnBeforePrint事件中添加代码:
while FreeSpace & 20 do
ShowBand(Child1)
15.如何打印指定行数后换页?
在master band中OnBeforePrint事件中写代码:
vLineCount:
vLineCount := vLineCount + 1;
if vLineCount = 10 then
vLineCount := 0;
16.fastreport中如何把数据显示为百分比
DisplayFormat属性,其中的Kind你设置成fkNumeric,FormatStr
[&frxDBDataset1."sjl"&*100#n%2.2f]%”。
17.FastReport如何打印表格式的空行?
PageLine: //在现在页列印到第几行
PageMaxRow: integer=15; //设定每页列数
MasterData1OnBeforePrint(Sender:TfrxComponent);
PageLine := &Line& mod PageMaxR
if(PageLine = 1) and (&line& & 1) then
child1.visible := F
//Footer1高度设为0
procedure Footer1OnBeforePrint(Sender:TfrxComponent);
i:= iif(PageLine=0, PageMaxRow, PageLine);
child1.visible := T
while i & PageMaxRow do
i:= i + 1;
Engine.ShowBand(Child1); //印空白表格
child1.visible := F
Tag标签:&&
&|&&|&&|&&|&法律顾问:欣力律师事务所
-FastReport中文网版权所有 Copyright 2012
FastReport,报表控件,FastReport报表,VCL报表,.NET报表,COM/ActiveX报表,OLAP控件,联机分析处理
400-700-102010293人阅读
废话不说直接正题!
1 下载FastReport.NET。网上搜索一下,下载资源一大把,这是收费的,所以我使用了demo版;
  注意:FastReport.NET 和FastReport Studio不是同一个东西,别下错了;
  FR.NET只支持VS;
  官网:,有说明文档使用手册下载,论坛也很不错,问题解答的很详细;
2& 先在本机上安装好VS(我试验的时候使用的是2008),再安装FR.NET,启动VS,新建一个ASP.NET WEB应用程序项目;
3& 页面设计:在VS中设计Default.aspx页面时,可直接在工具箱中拖出一个 WebReport控件放置于页面上:
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& 图一
4 数据源指定:FR支持多种数据源(详见其说明),可以在aspx页面上选定数据源,或者进入FR设计器中再指定;
& 拖放一个SqlDataSouce控件到页面上,设定好,在测试连接的时候最好预览下数据,确保数据源能正常使用;
& 选定WebReport控件,如图一,会有一个“&”标记按钮出现,点击,会出现如图二所示对话框:
 &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&  
                        图二
& 点击“Select Data Source”,弹出一个对话框,选择刚刚配置好的SqlDataS
5 设计:点击图二中的“Design Report...”就会打开FR设计器,如图三所示:
                    图三
  在设计器里,大家可以尽情地发挥,设计出你最喜欢(多数时候得老板喜欢)的样式,FR已经提供了很多模板,很漂亮,大家稍微改动
  一下就能得到自己的模板(.frx文件)。我这里只是简单的拖放了几个文本控件,然后将它们绑定到了前面选定好的datasouce上,大家可以自己
  动手点点看,这一点很简单,也许你是第一次用,但凭猜想你也可以做出来。
6 codding/运行:设计好后点保存,然后关掉设计器(必须关掉,因为它是以置顶子窗体弹出来的,不关掉不能操作VS)。
  在aspx页面上选中webreport控件,查看它的事件,为它添加上StartReport事件,写上几行代码就OK了,如图四:
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& 图四
注意:在Page_load事件中也有一行代码,我这里的webreport控件的名字就叫“WebReport1”;
保存,运行,大家就可以看到效果了~
到此,这个简单示例就完成了;刚开始使用FR千万记得查看用户手册,你的很多疑问在这里可以找到答案;
另:很多人在问FastReport如何从页面传递参数的问题,我在这里简单说下吧:
& FR的参数分两种,Query Parameter 和Report Parameter;
& Query Parameter (查询参数):是在FR中用向导设定DataSouce时,可以用带参数的SQl文来指定,形如:
&&& select * from table where country = @parameterName
&&& 对于这种参数,在用向导创建DataSouce时,会弹出一个窗口来让你对参数进行编辑,如图五:
&&&&&&&&&&&&&&&&& 图五
查询参数的名字是& qparam1,大家需要给它指定表达式 ,Expression属性中 “[param1]”就是一个表达式,param1是一个报表参数
Report Parameter。这意思就是,在运行时,qparam1的值将会和param1一致;
Report Parameter(报表参数):它的值你可以在FR的脚本中指定,也可以在aspx页面的cs代码中指定(参见图四中被注释掉的代码);看图三设计器界面图,在右边的窗口里,你可以找到参数这一项,你可以在这里新建/编辑一个报表参数;
现在大家应该明白如何从页面传递参数的值,并把它用于SQl查询中了;
但实际上还有一个问题,使用Query Parameter 时,它只能是一个简单值,不能是复杂的字符串,比如这样的SQL文:
select * from table where country in ('en','cn')
如果你想把('en','cn') 这整个部分设定为一个参数那是不行的,向导会报错,这时如何解决?
在FR设计器中,大家可以看到它是有自己的脚本的(C#语言),在其中添加上_StartReport事件,代码如下所示:
using System.C
using System.Collections.G
using System.Windows.F
using System.D
using System.D
using FastR
using FastReport.D
using FastReport.D
using FastReport.B
using FastReport.T
using FastReport.U
using FastReport.C
namespace FastReport
public class ReportScript
private void _StartReport(object sender, EventArgs e)
string str1 = (Report.Parameters.FindByName(&param1&)).Value.ToString();
TableDataSource datasource = Report.GetDataSource(&protable&) as TableDataS
datasource.SelectCommand =
&select * from protable where & + str1 ;
& 再结合图四中被注释掉的传参代码,大家应该全明白了……ok,就到这里吧。
学海无涯,回头没岸
&&相关文章推荐
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:133749次
积分:1470
积分:1470
排名:千里之外
转载:59篇
评论:11条
(2)(8)(5)(9)(5)(5)(1)(3)(1)(13)(4)(3)(3)(3)FastReport用户手册
FastReport.Net User's manual?
Fast Reports Inc.
Table of contentsChapter I Fundamentals 1212 12 14 16 17 18 21 21 22 24 25 27 27 29 29 30 31 32 33 34 36 39 39 40 43 44 45 45 46 47 48 48 50The report Report designer Report options Report pages Managing pages Page properties Bands Bands in designer Configuring bands Printing Bands Band properties Report objects Common object properties The &Text& object Text editing Displaying the expressions Displaying the data columns HTML tags Object's properties The &Rich Text& object The &Picture& object The &Line& object The &Shape& object The &Barcode& object The &CheckBox& object The &Table& object The &Matrix& object The &Chart& object The &Zip Code& object The &Cellular Text& object Your first report in the FastReport Example 1. Creating a report manually Example 2. Creating a report with the wizardChapter II Report creationChoosing data for a report Dynamic layout CanGrow, CanShrink properties ShiftMode property GrowToBottom property Anchor property Dock property Formatting5657 58 58 59 59 59 60 62Table of contents3 Border and fill Text formatting Styles Data formatting Conditional highlighting Hiding zero values Hide duplicate values Highlight odd/even data rows Report with one &Data& band Connecting a band to data source Printing the text Sorting the data Filtering the data Data header and footer Breaking data and keeping it together Printing empty data rows Printing &No data& text Printing hierarchy Master-detail report Master-master report Master-detail-detail report Multicolumn reports Page columns Data band columns &Booklet&-type reports Adding page into a report Page settings Printing on odd/even pages Groups and totals Creating groups Sorting the data Nested groups Managing groups Printing total values Repeating the header and footer Group properties Subreports Printing modes Side-by-side subreports Nested subreports Table-type reports Configuring columns Managing the size of the column Configuring rows Managing the size of the row Configuring cells Joining and splitting cells Inserting objects in cells Printing a table Printing complex headers62 63 63 64 66 68 69 70 71 71 71 71 73 74 75 77 79 80 83 86 88 89 89 90 92 92 92 93 95 97 99 100 101 102 103 104 106 106 107 107 108 108 108 109 109 110 110 110 111 1134Table of contents Using totals Table layout Examples Example 1. Printing the whole table from top to bottom Example 2. Printing the table from top to bottom with a repeating row Example 3. Printing the whole table from left to right Example 4. Printing a table from left to right with a repeating column Example 5. Printing a table with repeating rows and columns Example 6. Using the data source Example 7. Inserting page breaks Example 8. Printing totals Matrix-type reports A few theory Configuring the matrix Configuring headers Configuring cells Styling the matrix Row and column size management Examples Example 1. Simple matrix Example 2. Multilevel headers Example 3. Printing the name of the month Example 4. Conditional highlighting Example 5. Highlighting even rows Example 6. Using Expressions Example 7. Pictures in cells Example 8. Objects in cells Example 9. Filling a matrix manually Interactive reports Hyperlink Hyperlink configuration Link to the URL Link to the page number Link to a bookmark Link to a detailed report Link to a detailed page Custom link Report outline Examples Example 1. Link to a web page Example 2. Building a detailed report Example 3. Interactive &Matrix& object Example 4. Report with table of contents, navigation and outline Report inheritance Creating a report Changing the base report Limitations Reports with charts Chart elements Chart editor115 115 116 116 116 117 118 118 119 120 121 122 122 123 125 125 126 127 128 129 130 131 132 134 135 136 137 139 143 143 143 144 145 145 145 146 147 148 150 150 151 156 160 162 163 163 164 165 165 166Table of contents5 Handling series Setting up the appearance Connecting chart to data Sorting the data Grouping the data Collecting the data Exploding the values Setting up auto-series Interactive charts167 168 170 171 172 173 174 175 176Chapter III DataThe &Data& window Data sources Creating a data source Creating a SQL query Query parameters Passing a value to the parameter Editing a connection Editing a data source Aliases Hierarchical data sources Relations Creating a relation Editing a relation System variables Functions Mathematical Abs Acos Asin Atan Ceiling Cos Exp Floor Log Maximum Minimum Round Sin Sqrt Tan Truncate Text Asc Chr Insert Length LowerCase PadLeft180180 181 182 185 187 188 189 189 190 190 191 194 194 195 196 196 196 197 197 197 198 198 198 198 199 199 199 200 200 200 201 201 201 201 202 202 202 202 2036Table of contents PadRight Remove Replace Substring TitleCase Trim UpperCase Date & Time AddDays AddHours AddMinutes AddMonths AddSeconds AddYears DateDiff DateSerial Day DayOfWeek DayOfYear DaysInMonth Hour Minute Month MonthName Second Year Formatting Format FormatCurrency FormatDateTime FormatNumber FormatPercent Conversion ToBoolean ToByte ToChar ToDateTime ToDecimal ToDouble ToInt32 ToRoman ToSingle ToString ToWords ToWordsEnGb ToWordsRu Program Flow Choose IIf Switch203 204 204 204 205 205 205 206 206 206 206 206 207 207 207 207 208 208 208 208 209 209 209 209 210 210 210 210 214 215 216 216 217 217 217 217 217 218 218 218 218 219 219 219 220 221 222 222 222 222Table of contents7 Totals Creating a total Conditional totals Running totals Page totals Printing the total in the header Report parameters Creating a parameter Using parameters in a report223 223 225 226 226 227 228 229 229Chapter IV ExpressionsExpression editor Reference to report objects Using .Net functions Reference to data elements Reference to data sources Reference to system variables Reference to total values Reference to report parameters232233 233 234 235 235 236 237 237Chapter V ScriptGeneral information Event handlers Report events Using .Net objects Reference to report objects Report and Engine objects Reference to data sources Rererence to system variables Reference to total values Reference to report parameters Examples Example 1. Changing object's appearance Example 2. Highlighting even rows of the band Example 3. Data filtering Example 4. Calculating total Example 5. Shifting the print position240241 242 242 243 244 245 248 249 249 249 251 251 252 252 253 254Chapter VI Dialogue formsControls Referencing to a control from code Data filtering Automatic filtering - how it works Filter operations Adding filter into a report Filtering on data range Filtering on related data column Filtering using cascading lists Controlling the filtering from code Examples258258 260 260 261 262 263 264 264 264 265 2658Table of contents Example 1. &Hello, FastReport!& Example 2. Ask for a text from the user Example 3. Handling dialogue controls Example 4. Handling report objects Example 5. Simple filter Example 6. Automatic filtering Example 7. Automatic filtering by range Example 8. Filtering by related data column265 266 267 268 269 270 271 272Chapter VII Preview, print, exportEditing the report Printing the report Exporting the report Saving in FPX format Export to Adobe Acrobat (PDF) Export to Word (RTF) Export to HTML Export to MHT (web archive) Export to Excel (XML) Export to Excel 2007 Export to PowerPoint 2007 Export to OpenOffice Calc Export to CSV Export to TXT Export to picture Report design recommendations Sending the report by email276277 278 280 280 281 282 283 284 285 286 287 288 289 290 291 292 293Table of contents9
ChapterIFundamentals FundamentalsIn this chapter we will learn the principles of working with a report in the FastReport. We will also take a close look at report elements such as report pages, bands, and report objects.The reportThe report building process can be represented as follows:Report template (later-Report) - this is, what we see in the designer. Reports are saved in files with an extension .FRX. A Report can be created with the help of designer or programmatically. Data can be any: this is data, defined in the program, or data from DBMS, for example, MS SQL. FastReport can also work with business-logic objects (later - business-objects). Prepared Report - this is what we see in the preview window. Prepared report can be previewed, printed, saved in one of the supported formats (.doc, .xls, .pdf and others), or can be sent by email.Report designerIn order to create a report template, a report designer is used. A designer gives the user comfortable facilities for designing the report and allows previewing the report at the same time. The report designer is the compound part of FastReport and does not depend on the development environment (for example, MS Visual Studio). If you are a software developer, you may include the report designer into your application. This will give your end-users the ability to either change the existing report or create a new one.12Fundamentals Fundamentals13 Report optionsA window with report options can be called in the &Report|Options...& menu. You will see a dialogue window with several tabs:On the &General& tab, you can control the following report parameters: ? &Double pass& parameter allows to enable two report passes. This can be necessary when you use the &total number of pages& ? &Compress report file& parameter allows saving a report in a compressed form. For compressing, zip algorithm is used, that is why you can easily extract original contents with the ? &Use file cache& parameter allows to save the memory when creating a report. Use this parameter if your report ha ? &Convert null values& controls converting the null value data column into the default value (0,empty string, false - depending on the data type of a column); ? &Text quality& parameter allows choosing the mode of text displaying in the report. This mode does not affect pr ? &Smooth graphics& parameter allows to enable the smooth mode when drawing graphical objects (line, border, picture). On the “Description& tab, you can give the description of the report. All these parameters are not obligatory, and they serve for informational purposes:14Fundamentals On the &Script& tab, you can choose the script language for the report. Detailed work with script can be found in the &Script& chapter. On the &Security& tab you can give the password which will be requested when opening the report. A report which has a password, is saved in an encoded form, so do not forget your password! Restoring a report in this case will be practically impossible. On the &Inheritance& tab, you can control report inheritance. This functionality will be looked at later.Fundamentals15 Report pagesTemplate consists of one (mostly) or several report pages. Report page, in turn, contains bands. Report objects like Text, Picture and others are placed on the band:Report template can consist of several pages. For example, you can create a template containing title-page and a page with data. When creating such a report, the first page will be printed first, then the second page and so on. Every page of template can generate one or several pages of a prepared report C this depends on the data it contains:Report pages are also used when working with subreports. Contrary to other report generators, subreports in FastReport are saved in a separate template page, and not in a separate file. Apart from report pages, a template can contain one or more dialogue forms. Dialogue forms can be used for inquiring some parameters before creating a report. Detailed work with dialogue forms will be covered in the &Dialogue forms& chapter.16Fundamentals Managing pagesWhen you have created a new report, it already contains one page with several bands. For adding a new page, click the button. A page can also be added by clicking the and choosing &New Report Page& in the window. buttonIn a similar way, dialogue forms can be added into the report. For this, use the Template pages are displayed in the designer as tabs:button.The first tab is the report code. It can neither be moved nor deleted. In order to switch to the needed page, simply click on its tab. Changing order of the pages can be done with the help of the mouse. For this, left click on the tab and, without leaving the mouse, move the tab to the desired place. For deleting a page, click the one page. button. This button is not active if the report consists of onlyFundamentals17 Page propertiesEvery report page can have its own settings, such as paper size, orientation (landscape or portrait), margins, columns, paper source and others. Report template can contain several pages with different orientations and paper sizes. The window with page setup can be called by clicking the button or by choosing the &File|Page setup...& menu item.The &Paper& group allows to set the paper size and orientation. It is possible to choose one of the supported sizes, by using the drop-down list. It contains all paper sizes which are supported by the current printer. Current printer can be configured by using &File|Printer Setup...& menu. The &Margins& group allows to setup page margins. The &Mirror margins on even pages& options can be used to print booklets:The &Source& group allows choosing the source of the paper. Note that the sources can be18Fundamentals given separately, that of the first page of the prepared report, and that of the rest of pages:The source can be chosen in the &Print& dialog as well. The &Columns& group allows setup the column parameters for multi-columned report. For this, the number of columns need to be indicated and (optional) correct the width of the column and the position of every column:The &Other& group allows giving certain helpful page properties. It is possible to indicate duplex mode for duplex printing if your printer supports this mode. Here it is also possible to set the watermark, which will be printed on prepared report pages:Fundamentals19 The &Extra design width& checkbox allows to increase the page width in the design mode. It may be useful if you work with such objects as &Table& or &Matrix&. The duplex mode can be chosen in the &Print& dialog as well.20Fundamentals BandsThe band is an object which is located directly on the report page and is a container for other objects like &Text&, &Picture& and others. In all, in FastReport there are 13 types of bands. Depending on its type, the band is printed in a certain place in the report. Band How it's printed It is printed once at the very beginning of the report. You can choose the order of printing - before the &Page Header& band or after it - with the help of the &TitleBeforeHeader& page property. Changing this property can be done with the help of &Properties& window. By default, property is equal to true, that is, report title is printed before page header. It is printed once at the end of the report, after the last data row, but before the &Page Footer& band. It is printed on top of every page of the report. It is printed at the bottom of every page of the report. This band is used when printing a multi-columned report (when the number of columns indicated in the page setup & 1). It is printed on top of every column after the Page Header band. Printed at the bottom of every column, before the Page Footer band. This band is connected to the data source and is printed as many times as there are rows in the source. This band is connected to the &Data& band and is printed before the first data row. This band is connected to the &Data& band and is printed after the last data row. It is printed at the beginning of every group, when the value of the group condition changes. It is printed at the end of every group. This band can be connected to any band, including another child band. It is printed immediately after its parent. Printed as a background on every report page.Report TitleReport Summary Page Header Page Footer Column HeaderColumn Footer Data Data Header Data Footer Group Header Group Footer Child OverlayBands in designerA band in the designer appears in form of a rectangular area. A band, like many other report objects, can have a border and fill (by default they are disabled). Apart from this, a band displays a grid. To set the grid mode, go the &View|Options...& menu and choose &Report page&. Grid can also be enabled or disabled in the &View& menu.Fundamentals21 You can set the band's height in three ways: ? place the mouse pointer at the bottom of the band. The cursor shape will be changed to &horizontal splitter& and you can resize a band. ? drag the band handle on the left ruler. ? use &Properties& window to set the band's Height property. The designer has two modes of displaying bands, between which you can switch at any time. In the first mode, every band has got a header, which contains the title of the band and useful information about it (for example, the name of the data source to which it is connected).In the second mode, the band does not have a header. Instead of that, on the left side of the window, the structure of the bands is displayed. This mode helps to easily understand the structure of the report, especially if it was not created by you.You can switch between these modes by clicking thebutton.Configuring bandsYou can configure the bands in the &Configure Bands& window. It can be called from the &Report|Configure Bands...& menu or with the help of the &Configure bands& button, placed over the bands tree:22Fundamentals In this window, it is possible to add bands into the report, delete them or change their order. To add a band, click the &Add& button or right click on band tree. A context menu will come up containing a list of bands. A band which cannot be added is dimmed.The &Add& operation depends on what band was chosen in the band tree. For example, addingFundamentals23 &Data Header& and &Data Footer& bands is possible only if the &Data& band was selected beforehand. There is also another way of configuring some bands. This can be done from the &Report& menu:To delete a band, select it and press &Delete& key. When configuring bands, FastReport does not allow to do operations which leads to the creation of a wrong report template. For example, you cannot delete the &Data& band, which is connected to the group - for this, the group needs to be deleted first. Another example, when deleting the &Data& band, its header and footer are deleted automatically. Also, it is not possible to delete a band if it is the only one on the page.Printing BandsSo, there are several bands placed on the page. How will FastReport compose a prepared report? Let us look at the following example:The &Report Title& band will be printed first. The &Page Header& band will be printed immediately after it. Further, the &Data& band will be printed as many times as there are rows in the data source, to which the band is connected. After all the rows of the &Data& band have been printed, the &Report Summary& band is printed and at the bottom of the page - the &Page Footer& band. Printing of the report ends with this. A prepared report will be looking something like this:24Fundamentals In the process of printing, FastReport checks if there is enough space on the current page of the prepared report, so that the band can be printed. If there isn’t enough space, the following occurs: ? ? ? ? pa pa continues to print the band which did not fit on the previous page.Band propertiesEvery band has several useful properties, which affect the printing process. They can be configured by using the band’s context menu.To do this, right-click on an empty space on the band, not occupied by other objects. Also, it is possible by clicking on the band header (if the classic display mode is used) or on band structure (otherwise). Another method C choose a band and change the corresponding properties in the &Properties& window. Property CanGrow, CanShrink Description These properties determine whether a band can grow or shrink depending on the size of the objects contained in the band. If both properties are disabled, the band will always have the size specified in the designer. Read more about this in the &Report Creation& chapter. If the property is enabled, FastReport tries to print a part of the band’s contents on the available space, that is, &break& the band. Read more about this in the &Report Creation& chapter. Printing a band with such property begins on a new page. This property is usually used
that is, every group is printed on a new page.CanBreakStartNewPageFundamentals25 PrintOnBottomA band with this property is printed at the bottom of the page, before the &Page Footer& band .This can be useful when printing certain documents, where the total sum is supposed to be printed at the bottom of the page. The bands - &Data Header&, &Data Footer&, &Group Header& and &Group Footer& - have got this property. This type of band will be printed on each new page, when data printing is being done. Read more about this in the &Report Creation& chapter.RepeatOnEveryPage26Fundamentals Report objectsA wide variety of objects can be used in a report. Icon Name &Text& (TextObject) &Picture& (PictureObject) &Line& (LineObject) &Shape& (ShapeObject) &Rich Text& (RichObject) &Barcode& (BarcodeObject) &CheckBox& (CheckBoxObject) &Table& (TableObject) &Matrix& (MatrixObject) &Chart& (MSChartObject) &Zip Code& (ZipCodeObject) &Cellular Text& (CellularTextObject) Description Displays one or several text lines. Displays a picture. Displays a line. A line can be vertical, horizontal or diagonal. Displays one of the geometrical shapes rectangle, ellipse, triangle and others. Displays a formatted text (in RTF format). Displays a barcode. Displays a checkbox which can have two states - &Enabled& or &Disabled&. Displays a table containing rows, columns and cells. Displays a matrix (also known as &Crosstab&). Displays a chart. Displays a zip code. Displays each character of a text in its individual cell.An object can be used to display an information (&Text& object) or to improve the report appearance (&Picture&, &Line&, &Shape& objects). Complex objects like &Table& and &Matrix& can contain other simple objects.Common object propertiesAll report objects are inherited from one basic class (ReportComponentBase) and have got certain set of common properties. Before studying each object, we will look at these properties. You can change the value of properties with the help of the &Properties& window. Some properties can be changed using the object's context menu or toolbars (for example, border and fill).Fundamentals27 Property Left, Top, Width, Height AnchorDescription A report object, as a rule, is a rectangle. It has coordinates (properties Left, Top) and size (properties Width, Height). This property determines how the object will be changing its position and/or its size when the container on which it is laying grows or shrinks. By using Anchor, it can be done in such a way that, the object expands or moves synchronously with container. Read more about this property in the &Dynamic layout& chapter. This property determines on which side of the container the object will be docked. Read more about this property in the &Dynamic layout& chapter. These properties control the object's border and fill. They can be changed using the &Border and Fill& toolbar. These properties allow fitting the height of the object in such a way that it fits the whole text. Read more about this property in the &Dynamic layout& chapter. An object, whose property is enabled, will be moving up and down, if the object above on can either grow or shrink. Read more about this property in the &Dynamic layout& chapter. An object, whose property is enabled, will be stretched to the bottom of a band. Read more about this property in the &Dynamic layout& chapter. Objects &Text& and &Rich Text& have this property. It determines whether the object’s contents can be broken into parts. This property determines on which pages the object can be printed. Read more about this property in the &Booklet-type report& chapter. This property determines the type of mouse cursor when it is located over an object. The property works only in the preview window. This property determines whether the object will be displayed in the report. Invisible object is never displayed in the preview window and is never printed on the printer as well. This property determines whether the object will be printed on the printer. If this property is disabled, then the object will be visible in the preview window but it will not be printed. This property makes it possible to make the report object interactive. Read more about this property in the &Interactive reports& chapter. This property is used together with the &Hyperlink& property. It can contain any expression. The expression will beDockBorder, Fill CanGrow, CanShrinkShiftModeGrowToBottomCanBreakPrintOnCursorVisiblePrintableHyperlinkBookmark28Fundamentals calculated when the report will be working, and its value will be used as bookmark's name. Restrictions Style This property restricts certain operations, such as moving, resizing, deleting the object. You can assign the style name to this property. When this is done, the object will become like it has been indicated in the style. If the parameters of the style changes, the appearance of the object changes as well.The &Text& objectThe &Text& object is the main object which you will use often. It looks like this:The object can display any text data, specifically: ? ? ? ? ? ? one o any combination of the above items.Text editingIn order to edit an object's text, just double click on it. You will see a text editor:Fundamentals29 There is a data tree on the right side of the editor, which elements can be added into the text. This can be done by dragging the element onto needed place by using the mouse. Another way to insert an element into the text - double click on the element, and it will be added onto the cursor's current position. In order to save the changes and close the editor window, click the OK button or press the Ctrl+Enter keys. Another method of editing a text - in-place editing. To do this, select the &Text& object and press Enter. To finish editing, click somewhere outside the objects bounds or press Ctrl+Enter. Press Esc key to cancel the changes. When editing an object in-place, its size can be changed by using a mouse.Displaying the expressionsThe &Text& object can contain a plain text mixed with expressions. For example: Today is [Date] When printing such an object, all expressions contained in the text will be calculated. So the result may look like this: Today is 12.09.2010 As seen, expressions are identified by square brackets. This is set in the &Brackets& property, which by default contains the string &[,]&.When needed, you can use a different set of symbols, for example &&,&&, or &&!,!&&. In the last case, an expression in the text will be like this: Today is &!Date!& Apart from this, it is possible to disable all expressions. To do this, set the AllowExpressions property to false. In this case the text will be shown &as is&. Inside the square brackets, you can use any valid expression. Read more about expressions in the &Expressions& chapter. For example, an object with the following text: 2 * 2 = [2 * 2] will be printed like this: 2*2=4 Frequent mistake - attempt to write an expression outside the square brackets. Reminding, that it is considered an expression and gets executed only that, which is located inside square brackets. For example: 2 * 2 = [2] * [2] This text will be printed this way: 2*2=2*2 There may be elements inside an expression that needs own square brackets. For example, it may be a reference to a system variable (see the &Expressions& chapter for details). Let's look30Fundamentals at the following example: The next page: [[Page] + 1] The text contains an expression [Page] + 1. Page is a system variable which returns the number of the current report page. It is included in own brackets. These brackets must be square brackets, regardless of the &Text& object settings. Strict speaking, we were supposed to use two pairs of square brackets when using the &Date& system variable in the examples above: Today is [[Date]] However FastReport allows to leave out unnecessary pair of brackets if there is only one member in an expression.Displaying the data columnsYou can print the data column in the following way: [Datasource name.Column name] As you can see, the square brackets are used here. The data source name and data column name are separated by the period. For example: [Employees.FirstName] Read more about using the data columns in the &Expressions& chapter. There are several ways to insert a data column into the &Text& object. 1. In the &Text& object's editor we write the name of the data column manually. This method is the most inconvenient as it is easy to make a mistake. 2. In the object's editor we choose the needed data column and drag&drop it into the text:3. Click on the small button in the upper right corner of the object and choose the dataFundamentals31 column from a list:4. Drag&drop a data column from the &Data& window into the report page. In this case the &Text& object is created which contains a link to the column.HTML tagsYou may use some simple HTML tags in the &Text& object. By default, to enable it, go &Properties& window and set the &HtmlTags& property to true. Here is a list of supported tags: Tag &b&...&/b& &i&...&/i& &u&...&/u& &strike&...&/strike& &sub&...&/sub& &sup&...&/sup& &font color=...&...&/ font& Description Bold text. Italic text. Underlined text. Strikeout text. Subscript. Superscript. Font color. The color may be either the named color (such as DarkGray), or a hexadecimal code in the #RGB format, for example #FF8030.The following examples demonstrate how these tags can be used. text &b&bold text&/b& &i&text in italic&/i& &b&&i&bold and in italic&/b&&/i& E = mc&sup&2&/sup& A&sub&1&/sub& = B&sup&2&/sup& this is regular text, &font color=red&and this is a red one&/font& this is regular text, &font color=#FF8030&and this is an orange one&/font& This text will be displayed in the following way:32Fundamentals Object's propertiesProperty AllowExpressions Angle AutoShrink AutoShrinkMinSize AutoWidth Brackets BreakTo Description This property allows to turn on or off the expression handling. It is on by default. This property indicates the text rotation, in degrees. This property allows to shrink the font size or font width automatically to fit the text. This property determines the minimum size of a font, or the minimum font width ratio, if the AutoShrink property is used. This property allows to calculate the width of object automatically. This property contains a pair of symbols that designate an expression. With this property you can organize the text flow from one text object to another. For example, we have &A& and &B& text objects. The &A& object contains the long text that does not fit in the object's bounds. You can set the A.BreakTo to B, so the &B& object will display the part of text that does not fit in &A&. This property determines whether it is necessary to clip a text outside of object's bounds. It is on by default. This property determines how the repeated values will be printed. Read more about this property in the &Formatting& chapter. This property determines the offset of the first TAB symbol, in pixels. Use this property to make the font wider or narrower. By default the property is set to 1. To make the font wider, set the property to value & 1. To make the font narrower, set the property to value between 0 and 1. This property is of string type. It allows to hide values that are equal to the value of this property. Read more about this property in the &Formatting& chapter. This property allows to hide zero values. Read more about this property in the &Formatting& chapter. This property allows to setup the conditional highlight. Read more about this in the &Formatting& chapter. These properties determine the text alignment. Allows simple HTML tags in the object's text. Read more about this property in the &HTML tags& chapter. This property allows to explicitly set the height of a text line. By default it is set to 0, so the default line spacing is used. The text that will be printed instead of a null value. You also need to uncheck the &Convert null values& option in the &Report/Options...& menu.Clip Duplicates FirstTabOffset FontWidthRatioHideValueHideZeros Highlight HorzAlign, VertAlign HtmlTags LineHeight NullValueFundamentals33 Padding RightToLeft TabWidth Text TextFill TrimmingThis property allows to setup the padding, in pixels. This property indicates whether the text should be displayed in rightto-left order. This property determines the width of the TAB symbol, in pixels. This property contains the text of the object. This property determines the text fill. Use this property editor to choose between different fill types. This property determines how to trim the text that does not fit inside the object's bounds. It is used only if the &WordWrap& property is set to false. This property allows to display a graphical line after each text line. This property can be used only if the text is top-aligned. This property determines whether it is necessary to wrap a text by words. This property changes the display mode of the &Text& object to match the screen and the final printout. This mode is also used if you use the justify-align or non-standard line height.Underlines WordWrap WysiwygThe &Rich Text& objectThis object displays the formatted text (in the RTF format). It looks like this:Try to use the &Text& object to display a text. When you export the report to some document formats, the &Rich Text& object will be exported as a picture.This object supports only the solid fill type. Gradient, hatch, glass fills are not supported. To edit the object, double click on it. You will see the editor window:34Fundamentals You can also use the Microsoft Word to create a text. When you have done, save the text in the .RTF format. Next, you need to open the &Rich Text& editor and load the .RTF file into it by pressing the button.The &Rich Text& object does not support all of the Microsoft Word formatting features. You can display a data in this object the following ways: ? you can insert an expression in the object's text, just as you do this in the &Text& object. Insert the necessary data
? use the &DataColumn& property to bind the object to the column. The object has the following properties: Property AllowExpressions Brackets DataColumn Text Padding Description This property allows to turn on or off the expression handling. It is on by default. This property contains a pair of symbols that designate an expression. The data column that this object is bound to. This property contains the RTF text. The padding, in pixels.Fundamentals35 The &Picture& objectAn object can display graphics in the following formats: BMP, PNG, JPG, GIF, TIFF, ICO, EMF, WMF. With the help of the &Picture& object, you can print your company logo, a photo of employee or any graphical information. The object looks like this:An object can show data from the following sources: Source File with a picture Data column Description Picture is loaded from a file and is saved inside the report. Picture is stored in the &Image& property. Picture from a data column. Name of the column is stored in the &DataColumn& property. Picture is loaded from a file with the given name. Name of file is stored in the &ImageLocation& property. Picture is never stored inside the report. You should distribute the picture file along with the report. Picture is loaded from the internet every time the report is created. Image is never stored inside the report. URL is stored the in the &ImageLocation& property.File nameURLIn order to call a picture editor, double click on the object. In the editor, you can choose the data source for the picture:36Fundamentals In order to bind the object to a data column, click on the small button in the upper right corner of the object and choose the data column from a list:You also can drag&drop a data column from the &Data& window into the report page. In this case the &Picture& object is created which contains a link to the column. The column you drag should have the &byte[]& data type. In the context menu of the &Picture& object you can choose the size mode: ? ? ? ? ? AutoSize. The object gets the size of the picture. CenterImage. The picture is centered inside the object. Normal. The picture is displayed in the left corner of the object. StretchImage. The picture is stretched to the size of the object. Zoom. The picture is stretched to the size of the object in accordance with the aspect ratio.The difference between modes is shown in the following picture:Fundamentals37 The &Picture& object has the following properties: Property Angle SizeMode Transparency Description The rotation angle, in degrees. Possible values for this property are 0, 90, 180, 270. The size mode. The degree of transparency of the pictures. The property can have values between 0 and 1. The value 0 (by default) means that the picture is opaque. The color which will be transparent when displaying the picture. The picture. The data column that this object is bound to. This property can contain name of the file or URL. The picture will be loaded from this location when building the report. The padding, in pixels. Shows the “No picture” picture, in case when the picture is empty. This property makes sense to use if the picture is downloaded from the Internet.TransparentColor Image DataColumn ImageLocation Padding ShowErrorImage38Fundamentals The &Line& objectThe &Line& object can display horizontal, vertical or diagonal line. The object is as follows:If possible, use the object's border instead of &Line& object. This will simplify the report and avoid possible problems with the export to different formats. FastReport designer has convenient tools for drawing a line. In order to insert a line into a report, click the button on the &Objects& toolbar and in the menu choose the &Line& object or &Diagonal Line&. Place the mouse cursor at the location where the line will start from. Then left click and hold the mouse, in order to draw the line. After this, you can draw the line again. When all the lines have been drawn, click on the button on the &Objects& toolbar.An ordinary line differs from a diagonal line in that you can make it only vertical or horizontal. Do not choose the &Double& line style for this object. This style applies only to the object's border. The &Line& object has the following properties: Property Diagonal Description The property determines weather the line is diagonal. An ordinary line can be turned into a diagonal one by enabling this property. These properties allow to setup the line caps. You can use one of the following cap styles: ? ? ? ? arrow.StartCap, EndCapSize of the cap can be set in the Width, Height properties of the cap. You can configure caps for each end of the line.The &Shape& objectThe &Shape& object displays one of the following shapes: ? ? ? ? ? diamond.Fundamentals39 The object is as follows:In order to insert a shape into the report, click the button on the &Objects& toolbar and choose the needed shape type. The shape, like any other report object, has a fill and border. Contrary to the &Text& object, you cannot control each border line. Also, don't use the &Double& line style. Instead of rectangular shape, use the object's borders if possible. The &Shape& object has the following properties: Property Shape Curve Description This property determines the type of shape. This property is used with the &RoundRectangle& shape. It allows to set the curve.The &Barcode& objectThe object displays barcodes in the report. It looks like this:The object supports the following types of barcodes: Code 2 of 5 Interleaved 2 of 5 Industrial 2 of 5 Matrix Codabar Code128 Code39 Code39 Extended Length Allowed symbols 0-9 0-9 0-9 0-9, -$:/.+ 128 ASCII chars 0-9,A-Z, -. *$/+% 128 ASCII chars40Fundamentals Code93 Code93 Extended EAN8 EAN13 MSI PostNet UPC A UPC E0 UPC E1 2-Digit Supplement 5-Digit Supplement PDF417 Datamatrix 12 6 6 2 5 8 130-9,A-Z, -. *$/+% 128 ASCII chars 0-9 0-9 0-9 0-9 0-9 0-9 0-9 0-9 0-9 any anyA detailed description of different barcode types can be found in the internet, for example, here:
Barcode data in an object is of a string type. The string can contain any symbol, allowed for the chosen type of barcode. You can choose the type of barcode in the context menu of the &Barcode& object. You can connect an object to data by using one of the following methods: ? set the barcode data in the &Text& ? bind the object to a data column using the &DataColumn& ? set the expression that returns the barcode data in the &Expression& property. The &Barcode& object has the following properties: Property Barcode Angle Zoom AutoSize Description This property contains barcode-specific settings. Expand this property to set these settings. This property determines the rotation of a barcode, in degrees. You can use one of the following values: 0, 90, 180, 270. This property allows to zoom a barcode. It is used along with the &AutoSize& property. If this property is on, the object will stretch in order to display a whole barcode. If this property is off, the barcode will stretch to to object's bounds. This property determines whether it is necessary to show the human-readable text.ShowTextFundamentals41 DataColumn Expression Text PaddingThe data column which this object is bound to. The expression that returns the barcode data. The barcode data. The padding, in pixels.The following properties are specific to the barcode type. To change them, select the barcode, go &Properties& window and expand the &Barcode& property. Property WideBarRatio Description This property is specific to all linear barcodes. It determines the wide-to-narrow bar ratio. For most of barcode types, the value for this property should be between 2 and 3. This property is specific to all linear barcodes. It determines whether is necessary to calculate the check sum automatically. If this property is off, you should provide the check digit in the barcode data. This property is specific to the Code128 barcode. This code has three different encodings - A, B, C. You should either set the encoding explicitly in the barcode data, or set this property to true. In this case the encoding will be chosen automatically. Use the following control codes in the barcode data: Code &A; &B; &C; &S; &1; &2; &3; &4; Meaning START A / CODE A START B / CODE B START C / CODE C SHIFT FNC1 FNC2 FNC3 FNC4CalcCheckSumAutoEncodeIf you set the &AutoEncode& property to true, all control codes will be ignored. Example of use the control codes: &C;1234&B;ABC AspectRatio This property is specific to the PDF417 barcode. It determines the height-to-width aspect ratio and is used to calculate the barcode size automatically (in case the &Columns& and &Rows& properties are not set).42Fundamentals CodePageThis property is specific to the PDF417 and Datamatrix barcode. It determines the code page which is used to convert non-ASCII chars. For example, the default windows codepage is 1251. These properties are specific to the PDF417 barcode. They determine the number of columns and rows in a barcode. If both properties are set to 0, the size of the barcode will be calculated automatically. In this case the &AspectRatio& property is used as well. This property is specific to the PDF417 barcode. It determines the PDF417 data compaction mode. This property is specific to the PDF417 barcode. It determines the error correction level. This property is specific to the PDF417 barcode. It determines the size of barcode element, in screen pixels. As a rule, the element's height should be greater than the element width by 3 times or more. This property is specific to the Datamatrix barcode. It determines the Datamatrix data encoding. This property is specific to the Datamatrix barcode. It determines the size of barcode element, in pixels. This property is specific to the Datamatrix barcode. It determines the size of barcode symbol.Columns, RowsCompactionMode ErrorCorrection PixelSizeEncoding PixelSize SymbolSizeThe &CheckBox& objectThe object displays the checkbox in the report. It looks as follows:The object can display two states: &Checked& and &Unchecked&. Use the following ways to handle the object's state: ? set the state in the &Checked& ? bind the object to a data column using the &DataColumn& ? set the expression that returns the true or false in the &Expression& property. The &CheckBox& object has the following properties: Property CheckedSymbol, UncheckedSymbol CheckColor Description These properties determine the symbol that is shown in the object, depending on the object's state. This property determines the color of the check symbol.Fundamentals43 CheckWidthRatioUse this property to set the check width ratio. The width of the check symbol depends on the size of the object. You can use values in the 0.2 - 2 range. This property allows to hide the object if it is unchecked. This property controls the state of the object. The data column which this object is bound to. The type of column should be either bool or int. The expression that returns the true or false.HideIfUnchecked Checked DataColumn ExpressionThe &Table& objectThe &Table& object is made up of rows, columns and cells. It is a simplified analog of Microsoft Excel table. It looks like this:You can learn more about this object in the &Creating reports& chapter. The &Table& object has the following properties: Property ColumnCount Description Use this property to quickly set the number of columns. If columns in a table are few, they get added, and when they are more, they get deleted. Use this property to quickly set the number of rows. If rows in a table are few, they get added, and when they are more, they get deleted. The property determines how many columns in the table are fixed. Fixed columns form the table header. Printing of the header is controlled by the &RepeatHeaders& property. The property determines how many rows in the table are fixed. Fixed rows form the table header. Printing of the header is controlled by the &RepeatHeaders& property. The property allows printing the table header on every new page. This property works only for tables which are formed dynamically.RowCountFixedColumnsFixedRowsRepeatHeaders44Fundamentals The &Matrix& objectThe &Matrix& object is, like the &Table& object, made up of rows, columns and cells. At the same time, it is not known beforehand how many rows and columns will be in the matrix this depends on the data to which it is connected. The object looks like this:You can learn more about this object in the &Creating reports& chapter. The &Matrix& object has the following properties: Property RepeatHeaders CellsSideBySide Description If matrix is divided on several pages, this property allows printing matrix header on each new page. This property determines how matrix cells will be located if the matrix has several data cell levels. Possible variants: ? the cells are di ? the cells are displayed under each other. Style AutoSize DataSource Using this property you can set a style for the whole matrix. You can choose one from predefined styles. This property allows to calculate the matrix size automatically. Disable it if you want to control the object size manually. The property allows connecting the matrix to the data source. This property is set up automatically when you drag data column to the matrix. However, if you use expressions in cells,check that this property was set up correctly. This property contains expression for data filtering which will be applicable to data source of the matrix (see &DataSource& property).FilterThe &Chart& objectThe &MS Chart& object allows to display charts. There are more than 30 different series types available - bars, columns, areas, lines, bubbles, pie, circular, financial, pyramidal, ranges. The object looks like this:Fundamentals45 You can learn more about this object in the &Report creation& chapter. The &Chart& object has the following properties: Property Chart AlignXValues Description Reference to Microsoft Chart object. This property allows to align X values in different chart series (by inserting empty values). It is used if the chart contains two series or more. These properties allows to set up automatically created series. Read more about this in the &Report creation& chapter. The property allows connecting the chart to the data source. This property contains expression for data filtering which will be applicable to data source of the chart (see &DataSource& property).AutoSeriesColumn, AutoSeriesColor, AutoSeriesSortOrder DataSource FilterThe &Zip Code& objectThe &Zip Code& object allows to print a zip code on envelopes. It may display numeric characters (0-9). The object is as follows:You can connect an object to data by using one of the following methods: ? set the zipcode data in the &Text& ? bind the object to a data column using the &DataColumn& ? set the expression that returns the zipcode data in the &Expression& property. The &Zip Code& object has the following properties:46Fundamentals Property SegmentCount SegmentWidth, SegmentHeight Spacing ShowGrid ShowMarkers DataColumn Expression TextDescription The number of segments in a code. This property is set to 6 by default. The size of a single code segment. The default size is 0.5х1cm. This property determines a distance between two segment's origins. The default value is 0.9cm. Determines whether it is necessary to display a grid. Determines whether it is necessary to display the markers (bold horizontal lines above the zipcode). The data column which this object is bound to. The expression that returns the zipcode data. The text containing a zipcode.The &Cellular Text& objectThis object can display each character of a text in its individual cell. It is often used to print some forms in financial applications. The object is as follows:In fact, this object is directly inherited from the &Text& object. You may connect it to data in the same manner. For example, you may invoke the object's editor and type the following text: [Employees.FirstName] The &Cellular Text& object has the f

我要回帖

更多关于 mysql中like的用法 的文章

 

随机推荐