报表打印控件myprint使用说明:
调用方法:
Login(username as string,regcode as string) '系统登录,用户名、注册码
SetRowCount(rows as Integer) '设置表格的行数
SetColumnCount(cols as Integer) '设置表格的列数
SetRowHeight(nRow as Integer,height as Integer) '设置行高
SetColumnWidth(nCol as Integer,width as Integer) '设置列宽
SetFixedRows(nrow as Integer)'设置不滚动区域,通常将报表头设为不滚动区域
JoinCell(startrow as integer,startcol as integer,endrow as integer,endcol as integer) '合并多个单元格
HideCellLines(nrow as integer,ncol as integer,nline as integer) '隐藏某个单元个的表格线
PrintPreview() '打印预览
Print() '打印
SetCellText(row as Integer,col as Integer,txt as String,horzStyle as Integer,vertStyle as Integer,multilines as intger,fontname As string,fontsize as integer)
'设置单元格的显示文本、风格、字体、大小
SetTitle(title as String ,fontname As string ,fontsize as Integer) '设置报表标题
SetHeader(lefttitle as string,righttitle as string ,fontname As string ,fontsize as Integer) '设置表眉
SetFooter(lefttitle as string,righttitle as string ,fontname As string ,fontsize as Integer) '设置表脚
DrawHeaderText(posx As Integer,posy As Integer,nText As string) '在表头显示文本
AutoSize() '单元格是否自动根据字符串大小自动缩放
FitToPaperSize(bFit as Integer)'是否根据纸张大小缩放报表
AlignCenter(bCenter as integer)'是否居中
SetLineWidth(nwidth as Integer)'设置整个报表的线宽
SetUserPaperSize(width,length) '设置自定义纸张大小,以毫米为单位
以下为VB语法的简单例子
Dim Grid As Variant
Dim count As Integer
Set Grid = CreateObject("MyPrint.GridCtrl")
count = 60
Call Grid.Login("用户名", "2444-22AB-856F-14A6")
Call Grid.SetRowCount(count + 1)
Call Grid.SetColumnCount(7)
Call Grid.SetCellText(0, 0, "姓名", 1,1,0, "宋体", 13)
Call Grid.SetCellText(0, 1, "性别", 0,1,0, "宋体", 13)
Call Grid.SetCellText(0, 2, "出生年月", 0,1,0, "宋体", 13)
Call Grid.SetCellText(0, 3, "地址", 0,1,0, "宋体", 13)
Call Grid.SetCellText(0, 4, "毕业学校", 0,1,0, "宋体", 13)
Call Grid.SetCellText(0, 5, "所学专业", 0,1,0, "宋体", 13)
Call Grid.SetCellText(0, 6, "工作单位", 0,1,0, "宋体", 13)
Dim J As Integer
J = 1
For J = 1 To count
Call Grid.SetCellText(J, 0, "testddddddd" & CStr(J), 1, 0,0,"宋体", 13)
Call Grid.SetCellText(J, 3, "中国报表aaaaaaaaaaa" & CStr(J), 1, 1, 0, "楷体GB2312", 16)
Next
Call Grid.AutoSize
Call Grid.SetFixedRow(1)
Call Grid.SetTitle("报表打印控件演示", "宋体", 16)
Dim date1 As String
date1 = CStr(Year(Now)) + "年" + CStr(Month(Now)) + "月"
Call Grid.SetHeader("", date1, "宋体", 13)
Call Grid.PrintPreview