/lib/reportXEx.aardio

扩展reportX报表控件,依赖于reportX.aardio库。

代码如下:

//reportXEx 报表控件扩展版
import reportX

class reportXEx{
    ctor(winform){  
    	this = ..reportX(winform);
    	if(!this) return;
	}; 
   
   	setTable = function(t){
   		this.InvalidatePaint()
		var fields = t.fields;
		var start = 0;
  		if( #fields ){ 
			start = 1
  			this.rowCount = #t+1;
			this.colCount = #fields
			for(i=1;#fields;1){
				this.setCellValue(i,1,fields[i])
			}
		}else{
			this.rowCount = #t;
			this.colCount = #t[1]
		}
		var itemText
		for(i=1;#t;1){
			for (cols=1;#fields){
				itemText = t[i][fields[cols]]:"";
				itemText = ..string.toUnicode( tostring(itemText) );
				this.setCellValue(cols,i+start,itemText)
			}
		}
		this.ValidatePaint()
	};
	
	setBorder = function(aCol=1,aRow=1,bCol=-1,bRow=-1,aBorderType=0,aBorderWidth=1,aBorderStyle=0){
		this.InvalidatePaint()
		var col1 = aCol:1
		var row1 = aRow:1
		var col2 = bCol:col1
			if (col2 = -1) col2 = this.ColCount;
		var row2 = bRow:row1
			if (row2 = -1) row2 = this.RowCount;
		for(c=col1;col2;1){
			for(r=row1;row2;1){
				this.SetCellBorder(c,r,aBorderType,aBorderWidth,aBorderStyle);
			}
		}
		this.ValidatePaint()
    } 
    
    setColBestWidth = function(...){
   		this.InvalidatePaint()
    	var cols={...}
    	if (!#cols){
    		for(i=1;this.ColCount;1){
				 this.SetColWidth(i,this.GetColBestWidth(i))   			
    		}
    	}else{
    		for(i=1;#cols;1){
				 this.SetColWidth(cols[i],this.GetColBestWidth(cols[i]))   			
    		}
    	}
    	this.ValidatePaint()
    }
} 

/**intellisense()
reportXEx = reportX报表控件扩展版
reportXEx(__/*窗口对象*/) = 创建reportX报表控件
reportXEx() = !reportX.

//表操作
!reportX.setTable(__) = 设置表内容。\n用于将数据库getTable()等命令返回的内容,填充到表格。\n可含有字段信息数组 fields = {"字段1","字段2"}。
!reportX.setBorder() = 设置表格线。\n\n参数:开始列号、开始行号、终止列号、终止行号、边框类型、边框宽度、边框风格\n\n开始列号、开始行号:默认为 1\n结束列号、结束行号:默认为-1\n     0:与开始行、开始列一致\n    -1:表格行数、表格列数\n边框类型:0:四周边框(默认) 1:左边框 2:上边框 3:右边框 4:下边框 5:斜线 6:反斜线\n边框宽度:默认为 1\n边框风格:0:实线(默认);1:虚线;2:点;3:点虚线;4点点虚线
!reportX.InvalidatePaint() = 禁止刷新
!reportX.ValidatePaint() = 允许刷新
!reportX.setColBestWidth(__) = 设置最佳列宽\n可以设置多列。默认为全部列。
!reportX.SetPoleText(0/*顶部标题*/,__/*列号*/,"") = 设置顶部标题栏文本。
!reportX.SetPoleText(1/*左侧标题*/,__/*行号*/,"") = 设置左侧标题栏文本。
!reportX.GetPoleText(0/*顶部标题*/,__/*列号*/) = 获取顶部标题栏文本。返回文本。
!reportX.GetPoleText(1/*左侧标题*/,__/*行号*/) = 获取左侧标题栏文本。返回文本。

//获取单元格内容
!reportX.GetCellButtonText(__,) = 取单元格按钮文本\n参数:列号、行号\n返回:文本内容
!reportX.GetCellButtonScript(__,) = 取单元格脚本内容\n参数:列号、行号\n返回:脚本内容
!reportX.GetCellCaption(__,) = 取单元格显示内容\n参数:列号、行号\n返回:显示内容
!reportX.GetCellCode(__,) = 取单元格条码类型\n参数:列号、行号\n返回:条码类型(0:39码;1:128码)
!reportX.GetCellControl(__,) = 取单元格输入控制\n参数:列号、行号\n返回:输入控制(0:无;1:字母;2:自然数;3:整数;4:字母数字;5:字母数字_;6:实数)

//设置单元格类型
!reportX.SetBarCodeCell(__,,0) = 将单元格作为条码类型单元格\n参数:列号、行号、条码类型(0:39码;1:128码)
!reportX.SetButtonCell(__,,"","") = 设置单元格为按钮格式。\n参数为(aCol,aRow,aNameText,scriptText)\n分别是:列号、行号、按钮文本、脚本文本
!reportX.SetCheckCell(__,,"") = 设置单元格为复选类型单元格。\n参数:列号、行号、复选文本。
!reportX.SetDateCell(__,) = 设置单元格为日期类型单元格。\n参数:列号、行号。
!reportX.SetDropCell(__,,"") = 设置单元格为选择类型单元格。\n参数:列号、行号、列表文本。
!reportX.SetLinkCell(__,,"","") = 设置单元格为链接类型单元格。\n参数:列号、行号、链接文本、链接地址。
!reportX.SetRadioCell(__,,"") = 设置单元格为单选类型单元格。\n参数:列号、行号、单选文本。
!reportX.SetRichTextCell(__,) = 设置单元格为富文本类型单元格。\n参数:列号、行号。
!reportX.SetTextCell(__,) = 设置单元格为文本类型单元格。\n参数:列号、行号。
!reportX.SetTimeCell(__,) = 设置单元格为时间类型单元格。\n参数:列号、行号。

//设置单元格样式
!reportX.SetCellCharCase(__,,0) = 设置单元格大小写。\n参数:列号、行号、大小写(0:正常;1:大写;2:小写)
!reportX.SetCellFontName(__,,"宋体") = 设置单元格字体名称。\n参数:列号、行号、字体名称
!reportX.SetCellFontSize(__,,14) = 设置单元格字号。\n参数:列号、行号、字号
!reportX.SetCellHAlignment(__,,1) = 设置单元格横向对齐方式。\n参数:列号、行号、横向对齐方式(0:左对齐; 1:中间对齐 2:右对齐)
!reportX.SetCellMultiLine(__,,true) = 设置单元格是否多行。\n参数:列号、行号、是否多行
!reportX.SetCellNextPos(__,,,) = 设置单元格在按回车时跳到的下一个单元。\n参数:列号、行号、下一点列号、下一点行号
!reportX.SetCellNote(__,,"") = 设置单元格注释。\n参数:列号、行号、注释。
!reportX.SetCellPrintHide(__,,true) = 设置单元格打印时是否隐藏。\n参数:列号、行号、是否隐藏。
!reportX.SetCellReadOnly(__,,true) = 设置单元格只读。\n参数:列号、行号、是否只读。
!reportX.SetCellRichTextValue(__,,"") = 设置单元格富文本。\n参数:列号、行号、富文本。
!reportX.SetCellScript(__,,"") = 设置单元格脚本。\n参数:列号、行号、脚本文本。
!reportX.SetCellTextLength(__,,0) = 设置单元格输入最大长度。\n参数:列号、行号、最大长度。
!reportX.SetCellVAlignment(__,,1) = 设置单元格纵向对齐方式。\n参数:列号、行号、纵向对齐方式(0:上对齐 1:中间对齐 2:下对齐)

//单元格操作
!reportX.SetCellBorder(__,,0,1,0) = 设置单元格表格线\n\n\n参数:列号、行号、边框类型、边框宽度、边框风格\n\n边框类型:0:四周边框 1:左边框 2:上边框 3:右边框 4:下边框 5:斜线 6:反斜线\n边框风格:0:实线;1:虚线;2:点;3:点虚线;4点点虚线

//行列操作
!reportX.ClearCell(__,,,) = 清空单元格\n参数:起始单元格列号、起始单元格行号、终止单元格列号、终止单元格行号
!reportX.AppendCol(1) = 添加列(在末尾)\n参数:要添加的列数。
!reportX.AppendRow(1) = 添加行(在末尾)\n参数:要添加的行数。

!reportX.InsertCol(__,1) = 在某列前插入列\n参数:列号、要插入的列数。
!reportX.InsertRow(__,1) = 在某行前插入行\n参数:行号、要插入的行数。
!reportX.DeleteRow(__,1) = 删除行\n参数:行号、要删除的行数。
!reportX.DeleteCol(__,1) = 删除列\n参数:列号、要删除的列数。
!reportX.MergeCell(__,,,) = 合并单元格。\n参数:起始单元格行号、起始单元格列号、终止单元格行号,终止单元格列号。
!reportX.SplitCell(__,,,) = 拆分单元格\n参数:起始单元格列号、起始单元格行号、终止单元格列号、终止单元格行号

!reportX.SetFrozenCol(__,) = 冻结列\n参数:开始列号、终止列号。
!reportX.SetFrozenRow(__,) = 冻结行\n参数:开始行号、终止行号。
!reportX.SetColHide(__,true) = 隐藏列\n参数:列号、是否隐藏。
!reportX.SetRowHide(__,true) = 隐藏行\n参数:行号、是否隐藏。

!reportX.GetColBestWidth(__) = 获得最佳列宽\n参数:列号;\n返回:最佳列宽值。
!reportX.GetColWidth(__) = 获得列宽\n参数:列号;\n返回:列宽值。
!reportX.GetRowBestHeight(__) = 获得最佳行高\n参数:行号;\n返回:最佳行高值。
!reportX.GetRowHeight(__) = 获得行高\n参数:行号;\n返回:行高值。

!reportX.SetColWidth(__,) = 设置列宽\n参数:列号、列宽值。
!reportX.SetRowHeight(__,) = 设置行高\n参数:行号、行高值。
!reportX.SortCol(__,,,,true) = 按列排序\n参数:排序列号、起始单元格列号、起始单元格行号、终止单元格列号、终止单元格行号、升序降序
!reportX.SortRow(__,,,,true) = 按行排序\n参数:排序行号、起始单元格列号、起始单元格行号、终止单元格列号、终止单元格行号、升序降序

//表属性
!reportX.AlternatingColor = 属性:报表交替颜色\n语法:.AlternatingColor [= long]\n注释:输入输出
!reportX.BottomHeight = 属性:底部高度\n语法:.BottomHeight [= long]\n注释:输入输出
!reportX.BottomMargin = 属性:下边距(单位十分之一毫米)\n语法:.BottomMargin [= long]\n注释:输入输出
!reportX.BottomRowCount = 属性:下端标题行\n语法:.BottomRowCount [= long]\n注释:输入输出
!reportX.CellHeight = 属性:单元格默认高度\n语法:.CellHeight [= long]\n注释:输入输出
!reportX.CellReadOnly = 属性:单元格只读\n语法:.CellReadOnly [= True/False]\n注释:输入输出
!reportX.CellSeparatorColor = 属性:单元格分割线颜色\n语法:.CellSeparatorColor [= long]\n注释:输入输出
!reportX.CellWidth = 属性:单元格默认宽度\n语法:.CellWidth [= long]\n注释:输入输出
!reportX.ColCount = 属性:列总数\n语法:.ColCount [= long]\n注释:输入输出
!reportX.ColTotal = 属性:交叉表列求和\n语法:.ColTotal [= long]\n注释:输入输出
!reportX.ConnectionString = 属性:数据库连接字符串\n语法:.ConnectionString [= BSTR]\n注释:输入输出
!reportX.DisplayColCount = 属性:显示列数\n语法:.DisplayColCount = long\n注释:输出\n
!reportX.DisplayRowCount = 属性:显示行数\n语法:.DisplayRowCount = long\n注释:输出\n
!reportX.DisplayZero = 属性:是否显示零值\n语法:.DisplayZero [=True/False]\n注释:输入输出
!reportX.EnterTo = 属性:回车时下一单元格方向\n语法:.EnterTo [= long]\n0:右下\n1:下右\n2:左上\n3:上左\n注释:输入输出
!reportX.ExecuteScript = 属性:单元格改变时是否自动执行脚本\n语法:.ExecuteScript [=True/False]\n注释:输入输出
!reportX.FontName = 属性:单元格默认字体\n语法:.FontName [= BSTR]\n注释:输入输出
!reportX.FontSize = 属性:单元格默认字号\n语法:.FontSize [= long]\n注释:输入输出
!reportX.FooterMargin = 属性:页脚边距(单位十分之一毫米)\n语法:.FooterMargin [= long]\n注释:输入输出
!reportX.GridLine = 属性:是否显示栅格线\n语法:.GridLine [= True/False]\n注释:输入输出
!reportX.GroupType = 属性:分组类型(0:顶部;1:中间;2:底部)\n语法:.GroupType [= long]\n注释:输入输出
!reportX.GroupPageBreak = 属性:分组分页\n语法:.GroupPageBreak [= True/False]\n注释:输入输出
!reportX.HeaderMargin = 属性:页眉边距(单位十分之一毫米)\n语法:.HeaderMargin [= long]\n注释:输入输出
!reportX.LeftCol = 属性:起始列号\n语法:.LeftCol [= long]\n注释:输入输出
!reportX.LeftColCount = 属性:左端标题列\n语法:.LeftColCount [= long]\n注释:输入输出
!reportX.LeftMargin = 属性:左边距(单位十分之一毫米)\n语法:.LeftMargin [= long]\n注释:输入输出
!reportX.MoveChart = 属性:能否移动图表\n语法:.MoveChart [= True/False]\n注释:输入输出
!reportX.Painted = 属性:能否刷新页面\n语法:.Painted [= True/False]\n注释:输入输出
!reportX.PageFontColor = 属性:页眉页脚颜色\n语法:.PageFontColor [= long] \n注释:输入输出
!reportX.PageFontName = 属性:页眉页脚字体\n语法:.PageFontName [= BSTR] \n注释:输入输出
!reportX.PageFontSize = 属性:页眉页脚字号\n语法:.PageFontSize [= long] \n注释:输入输出
!reportX.PageFontStyleBold = 属性:页眉页脚是否加粗\n语法:.PageFontStyleBold [= True/False] \n注释:输入输出
!reportX.PageFontStyleItalic = 属性:页眉页脚是否斜体\n语法:.PageFontStyleItalic [= True/False] \n注释:输入输出
!reportX.PageFooterCenterText = 属性:页脚中间内容\n语法:.PageFooterCenterText [= BSTR]\n注释:输入输出
!reportX.PageHeaderCenterText = 属性:页眉中间内容\n语法:.PageHeaderCenterText [= BSTR]\n注释:输入输出
!reportX.PageFooterLeftText = 属性:页脚左边内容\n语法:.PageFooterLeftText [= BSTR]\n注释:输入输出
!reportX.PageHeaderLeftText = 属性:页眉左边内容\n语法:.PageHeaderLeftText [= BSTR]\n注释:输入输出
!reportX.PageFooterRightText = 属性:页脚右边内容\n语法:.PageFooterRightText [= BSTR]\n注释:输入输出
!reportX.PageHeaderRightText = 属性:页眉右边内容\n语法:.PageHeaderRightText [= BSTR]\n注释:输入输出
!reportX.PageHeight = 属性:打印高度(单位十分之一毫米)\n语法:.PageHeight [= long] \n注释:输入输出
!reportX.PageWidth = 属性:打印宽度(单位十分之一毫米)\n语法:.PageWidth [= long] \n注释:输入输出
!reportX.PaperSize = 属性:纸类型\n1:Letter 8 1/2 × 11 in\n2:Letter Small 8 1/2 × 11 in\n3:Tabloid 11 × 17 in\n4:Ledger 17 × 11 in\n5:Legal 8 1/2 × 14 in\n6:Statement 5 1/2 × 8 1/2 in\n7:Executive 7 1/2 × 10 in\n8:A3 297 × 420 mm\n9:A4 210 × 297 mm\n10:A4 small 210 × 297 mm\n11:A5 148 × 210 mm\n12:B4 250 × 354 mm\n13:B5 182 × 257 mm\n14:Folio 8 1/2 × 13 in\n15:Quarto 215 × 275 mm\n16:10 × 14 in\n17:11 × 17 in\n18:Note 8 1/2 × 11 in\n19:Envelope #9 3 7/8 × 8 7/8 in\n20:Envelope #10 4 1/8 × 9 1/2 in\n21:Envelope #11 4 1/2 × 10 3/8 in\n22:Envelope #12 4 3/4 × 11 in\n23:Envelope #14 5 × 11 1/2 in\n24:C size sheet\n25:D size sheet\n26:E size sheet\n27:Envelope DL 110 × 220 mm\n28:Envelope C5 162 × 229 mm\n29:Envelope C3 324 × 458 mm\n30:Envelope C4 229 × 324 mm\n31:Envelope C6 114 × 162 mm\n32:Envelope C65 114 × 229 mm\n33:Envelope B4 250 × 353 mm\n34:Envelope B5 176 × 250 mm\n35:Envelope B6 176 × 125 mm\n36:Envelope Italy 110 × 230 mm\n37:Envelope Monarch 3 7/8 × 7 1/2 in\n38:Envelope Invite 3 5/8 × 6 1/2 in\n39:US Std Fanfold 14 7/8 × 11 in\n40:German Std Fanfold 8 1/2 × 12 in\n41:German Legal Fanfold 8 1/2 × 13 in\n256:自定义纸张 mm × mm\n以上各种类型均需打印机支持\n语法:.PaperSize [= long] \n注释:输入输出
!reportX.PaperSource = 属性:纸张来源\n语法:.PaperSource [= long] \n注释:输入输出
!reportX.PoleColor = 属性:标杆颜色\n语法:.PoleColor [= long] \n注释:输入输出
!reportX.PoleHeight = 属性:顶部标杆高度\n语法:.PoleHeight [= long] \n注释:输入输出
!reportX.PoleReadOnly = 属性:标杆只读\n语法:.PoleReadOnly [= True/False] \n注释:输入输出
!reportX.PoleSelectColor = 属性:标杆被选择时颜色\n语法:.PoleSelectColor [= long] \n注释:输入输出
!reportX.PoleSeparatorColor = 属性:标杆分割线颜色\n语法:.PoleSeparatorColor [= long] \n注释:输入输出
!reportX.PoleWidth = 属性:左侧标杆宽度\n语法:.PoleWidth [= long] \n注释:输入输出
!reportX.PrintArea = 属性:打印页号(“1”,“1-3”,“1,4”)\n语法:.PrintArea [= BSTR] \n注释:输入输出
!reportX.PrintBackColor = 属性:是否打印单元格背景色\n语法:.PrintBackColor [=VARIANT_BOOL] \n注释:输入输出
!reportX.PrintBorders = 属性:是否打印单元格边框\n语法:.PrintBorders [=VARIANT_BOOL]\n注释:输入输出
!reportX.PrintCopies = 属性:打印份数\n语法:.PrintCopies [=long] \n注释:输入输出
!reportX.PrintIndex = 属性:打印机索引\n语法:.PrintIndex [= long] \n注释:输入输出
!reportX.PrintOrder = 属性:打印顺序\nTrue:先列后行\nFalse:向行后列\n语法:.PrintOrder [=VARIANT_BOOL]\n注释:输入输出
!reportX.PrintOrientation = 属性:打印方向\n语法:.PrintOrientation [=VARIANT_BOOL]\n注释:输入输出
!reportX.PrintPage = 属性:打印页号\n语法:.PrintPage [=BSTR] \n注释:输入输出
!reportX.PrintZoom = 属性:打印比例\n语法:.PrintZoom [=long] \n注释:输入输出
!reportX.QueryFrom = 属性:数据库表\n语法:.QueryFrom [= BSTR]\n注释:输入输出
!reportX.QueryHaving = 属性:数据库过滤\n语法:.QueryHaving [= BSTR]\n注释:输入输出
!reportX.QueryWhere = 属性:数据库筛选\n语法:.QueryWhere [= BSTR]\n注释:输入输出
!reportX.ReportLeft = 属性:报表左边\n语法:.ReportLeft [= long]\n注释:输入输出
!reportX.ReportTop = 属性:报表顶部\n语法:.ReportTop[= long]\n注释:输入输出
!reportX.ReportType = 属性:报表类型(0:列表报表;1:分组报表;2:交叉表报表)\n语法:.ReportType [= long]\n注释:输入输出
!reportX.RightColCount = 属性:右端标题列\n语法:.RightColCount [= long]\n注释:输入输出
!reportX.RightMargin = 属性:右边距(单位十分之一毫米)\n语法:.RightMargin [= long]\n注释:输入输出
!reportX.RightWidth = 属性:右侧宽度\n语法:.RightWidth [= long]\n注释:输入输出
!reportX.RowCount = 属性:行总数\n语法:.RowCount [= long]\n注释:输入输出
!reportX.RowTotal = 属性:交叉表行求和\n语法:.RowTotal [= long]\n注释:输入输出
!reportX.Saved = 属性:是否保存\n语法:.Saved [= True/False]\n注释:输入输出
!reportX.SeperatorLine = 属性:是否显示分页线\n语法:.SeperatorLine [= True/False]\n注释:输入输出
!reportX.TopMargin = 属性:上边距(单位十分之一毫米)\n语法:.TopMargin [= long]\n注释:输入输出
!reportX.TopReport = 属性:数据库表前几行\n语法:.TopReport [= long]\n注释:输入输出
!reportX.TopRowCount = 属性:顶端标题行\n语法:.TopRowCount [= long]\n注释:输入输出
!reportX.TopRow = 属性:起始行号\n语法:.TopRow [= long]\n注释:输入输出
!reportX.UpdateChart = 属性:能否自动根据数据来源更新图表\n语法:.UpdateChart [= True/False]\n注释:输入输出

end intellisense**/