以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 文件套打中如何定义字体类型 大小及居中 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=54552) |
||||
-- 作者:李孝春 -- 发布时间:2014/7/30 16:19:00 -- 文件套打中如何定义字体类型 大小及居中 文件套打中如何定义字体类型 大小及居中 Dim doc As New PrintDoc \'定义一个报表 Dim rx As prt.RenderText \'定义一个文本对象 Dim rm As prt.RenderImage \'定义一个图形队形 Dim Currow As Row Dim tbl As Table = Tables("卷宗封面") For i As Integer = tbl.TopRow To tbl.BottomRow CurRow = tbl.rows(i) Dim rep As New prt.RenderEmpty \'定义一个新的空对象 rep.BreakBefore = prt.BreakEnum.Page \'打印前换页 doc.Body.Children.Add(rep ) \'加入到报表中 rx = new prt.RenderText rx.Text = CurRow("卷宗内别") 我想把这内容定义为宋体 四号字 且居中 并且在X之后的距离自动居中 rx.y = 80 rx.x = 36 doc.body.Children.Add(rx) rx = new prt.RenderText rx.Text = CurRow("案卷编号") rx.y = 97 rx.x = 36 doc.body.Children.Add(rx) rx = new prt.RenderText rx.Text = CurRow("案件来源") rx.y = 115 rx.x = 43 doc.body.Children.Add(rx) rx = new prt.RenderText rx.Text = CurRow("人员类别") rx.y = 133 rx.x = 32 doc.body.Children.Add(rx) rx = new prt.RenderText rx.Text = CurRow("人员名称") rx.y = 133 rx.x = 43 doc.body.Children.Add(rx) rx = new prt.RenderText rx.Text = CurRow("案由") rx.y = 149 rx.x = 50 doc.body.Children.Add(rx) rx = new prt.RenderText rx.Text = CurRow("处理结果") rx.y = 165 rx.x = 57 doc.body.Children.Add(rx) rx = new prt.RenderText rx.Text = CurRow("收案时期") rx.y = 205 rx.x = 36 doc.body.Children.Add(rx) rx = new prt.RenderText rx.Text = CurRow("结案日期") rx.y = 205 rx.x = 110 doc.body.Children.Add(rx) rx = new prt.RenderText rx.Text = CurRow("共卷") rx.y = 222 rx.x = 69 doc.body.Children.Add(rx) rx = new prt.RenderText rx.Text = CurRow("第几卷") rx.y = 222 rx.x = 109 doc.body.Children.Add(rx) rx = new prt.RenderText rx.Text = CurRow("共页码") rx.y = 222 rx.x = 152 doc.body.Children.Add(rx) rx = new prt.RenderText rx.Text = CurRow("承办人") rx.y = 240 rx.x = 59 doc.body.Children.Add(rx) rx = new prt.RenderText rx.Text = CurRow("归档日期") rx.y = 240 rx.x = 109 doc.body.Children.Add(rx) rx = new prt.RenderText rx.Text = CurRow("保管期限") rx.y = 240 rx.x = 170 doc.body.Children.Add(rx) Next Doc.Preview() \'预览报表 效果如下:
|
||||
-- 作者:Bin -- 发布时间:2014/7/30 16:20:00 -- http://www.foxtable.com/help/topics/1168.htm |
||||
-- 作者:李孝春 -- 发布时间:2014/7/30 17:44:00 -- 回复:(Bin)http://www.foxtable.com/help/topics/1... 代码已修正如下 红色部分代码运行时候报错: .NET Framework 版本:2.0.50727.4984 Foxtable 版本:2014.7.26.1 错误所在事件:窗口,卷宗封面,Button3,Click 详细错误信息: The added item already has the owner. 代码如下
Dim doc As New PrintDoc \'定义一个报表 Dim rx As prt.RenderText \'定义一个文本对象 Dim rm As prt.RenderImage \'定义一个图形队形 Dim Currow As Row Dim tbl As Table = Tables("卷宗封面") For i As Integer = tbl.TopRow To tbl.BottomRow CurRow = tbl.rows(i) Dim rep As New prt.RenderEmpty \'定义一个新的空对象 rep.BreakBefore = prt.BreakEnum.Page \'打印前换页 doc.Body.Children.Add(rep ) \'加入到报表中 rx = new prt.RenderText rx.Text = CurRow("卷宗内别") rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中 rx.Style.TextAlignVert = prt.AlignVertEnum.Center \'垂直居中 rx.Style.Font = New Font("黑体", 25, FontStyle.Bold) rx.Style.FontBold = True \'字体加粗 rx.y = 76 rx.x = 36 doc.body.Children.Add(rx) rx = new prt.RenderText rx.Text = CurRow("案卷编号") rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中 rx.Style.TextAlignVert = prt.AlignVertEnum.Center \'垂直居中 rx.Style.Font = New Font("黑体", 25, FontStyle.Bold) rx.Style.FontBold = True \'字体加粗 rx.y = 94 rx.x = 36 doc.body.Children.Add(rx) rx = new prt.RenderText rx.Text = CurRow("案件来源") rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中 rx.Style.TextAlignVert = prt.AlignVertEnum.Center \'垂直居中 rx.Style.Font = New Font("黑体", 25, FontStyle.Bold) \'rx.Style.FontBold = True \'字体加粗 rx.y = 113 rx.x = 43 doc.body.Children.Add(rx) rx = new prt.RenderText rx.Text = CurRow("人员类别") rx.Style.TextAlignHorz = prt.AlignHorzEnum.Left \'水平居中 rx.Style.TextAlignVert = prt.AlignVertEnum.Center \'垂直居中 rx.Style.Font = New Font("仿宋", 20, FontStyle.Bold) \'rx.Style.FontBold = True \'字体加粗 rx.y = 130 rx.x = 35 doc.body.Children.Add(rx) rx = new prt.RenderText rx.Text = CurRow("人员名称") rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中 rx.Style.TextAlignVert = prt.AlignVertEnum.Center \'垂直居中 rx.Style.Font = New Font("黑体", 25, FontStyle.Bold) \'rx.Style.FontBold = True \'字体加粗 rx.y = 128 rx.x = 43 doc.body.Children.Add(rx) rx = new prt.RenderText rx.Text = CurRow("案由") rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中 rx.Style.TextAlignVert = prt.AlignVertEnum.Center \'垂直居中 rx.Style.Font = New Font("黑体", 25, FontStyle.Bold) rx.Style.FontBold = True \'字体加粗中 rx.y = 146 rx.x = 43 doc.body.Children.Add(rx) rx = new prt.RenderText rx.Text = CurRow("处理结果") rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中 rx.Style.TextAlignVert = prt.AlignVertEnum.Center \'垂直居中 rx.Style.Font = New Font("黑体", 15, FontStyle.Bold) \'rx.Style.FontBold = True \'字体加粗 rx.y = 160 rx.x = 20 doc.body.Children.Add(rx) rx = new prt.RenderText rx.Text = Format(CurRow("收案时期"), "yyyy") rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中 rx.Style.TextAlignVert = prt.AlignVertEnum.Center \'垂直居中 rx.Style.Font = New Font("黑体", 15, FontStyle.Bold) rx.y = 205 rx.x = -8 doc.body.Children.Add(rx) rx = new prt.RenderText rx.Text = Format(CurRow("收案时期"), "mm") rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中 rx.Style.TextAlignVert = prt.AlignVertEnum.Center \'垂直居中 rx.Style.Font = New Font("黑体", 15, FontStyle.Bold) rx.y = 202 rx.x = 6 doc.body.Children.Add(rx) rx = new prt.RenderText rx.Text = Format(CurRow("收案时期"), "dd") rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中 rx.Style.TextAlignVert = prt.AlignVertEnum.Center \'垂直居中 rx.Style.Font = New Font("黑体", 15, FontStyle.Bold) rx.y = 202 rx.x = 18 doc.body.Children.Add(rx) rx = new prt.RenderText rx.Text = Format(CurRow("结案日期"),"yyyy") rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中 rx.Style.TextAlignVert = prt.AlignVertEnum.Center \'垂直居中 rx.Style.Font = New Font("黑体", 15, FontStyle.Bold) rx.y = 202 rx.x = 70 doc.body.Children.Add(rx) \'rx.Text = Format(CurRow("结案日期"),"mm") \'rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中 \'rx.Style.TextAlignVert = prt.AlignVertEnum.Center \'垂直居中 \'rx.Style.Font = New Font("黑体", 15, FontStyle.Bold) \'rx.y = 205 \'rx.x = 80 \'doc.body.Children.Add(rx) \' \'rx.Text = Format(CurRow("结案日期"),"dd") \'rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中 \'rx.Style.TextAlignVert = prt.AlignVertEnum.Center \'垂直居中 \'rx.Style.Font = New Font("黑体", 15, FontStyle.Bold) \'rx.y = 205 \'rx.x = 85 \'doc.body.Children.Add(rx) rx = new prt.RenderText rx.Text = CurRow("共卷") rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中 rx.Style.TextAlignVert = prt.AlignVertEnum.Center \'垂直居中 rx.Style.Font = New Font("黑体", 15, FontStyle.Bold) rx.y = 221 rx.x = -4 doc.body.Children.Add(rx) rx = new prt.RenderText rx.Text = CurRow("第几卷") rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中 rx.Style.TextAlignVert = prt.AlignVertEnum.Center \'垂直居中 rx.Style.Font = New Font("黑体", 15, FontStyle.Bold) rx.y = 220 rx.x = 35 doc.body.Children.Add(rx) rx = new prt.RenderText rx.Text = CurRow("共页码") rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中 rx.Style.TextAlignVert = prt.AlignVertEnum.Center \'垂直居中 rx.Style.Font = New Font("黑体", 15, FontStyle.Bold) rx.y = 220 rx.x = 75 doc.body.Children.Add(rx) rx = new prt.RenderText rx.Text = CurRow("承办人") rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中 rx.Style.TextAlignVert = prt.AlignVertEnum.Center \'垂直居中 rx.Style.Font = New Font("黑体", 15, FontStyle.Bold) rx.y = 238 rx.x = -16 doc.body.Children.Add(rx) rx = new prt.RenderText rx.Text = CurRow("归档日期") rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中 rx.Style.TextAlignVert = prt.AlignVertEnum.Center \'垂直居中 rx.Style.Font = New Font("黑体", 15, FontStyle.Bold) rx.y = 238 rx.x = 45 doc.body.Children.Add(rx) rx = new prt.RenderText rx.Text = CurRow("保管期限") rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中 rx.Style.TextAlignVert = prt.AlignVertEnum.Center \'垂直居中 rx.Style.Font = New Font("黑体", 15, FontStyle.Bold) rx.y = 238 rx.x = 95 doc.body.Children.Add(rx) Next Doc.Preview() \'预览报表 |
||||
-- 作者:Bin -- 发布时间:2014/7/30 17:47:00 -- 报什么错? |
||||
-- 作者:李孝春 -- 发布时间:2014/7/30 17:53:00 -- 回复:(Bin)报什么错? .NET Framework 版本:2.0.50727.4984 Foxtable 版本:2014.7.26.1 错误所在事件:窗口,卷宗封面,Button3,Click 详细错误信息: The added item already has the owner. |
||||
-- 作者:Bin -- 发布时间:2014/7/30 17:55:00 -- rx = new prt.RenderText rx.Text = Format(CurRow("结案日期"),"yyyy") rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中 rx.Style.TextAlignVert = prt.AlignVertEnum.Center \'垂直居中 rx.Style.Font = New Font("黑体", 15, FontStyle.Bold) rx.y = 202 rx.x = 70 doc.body.Children.Add(rx) \'rx.Text = Format(CurRow("结案日期"),"mm") \'rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中 \'rx.Style.TextAlignVert = prt.AlignVertEnum.Center \'垂直居中 \'rx.Style.Font = New Font("黑体", 15, FontStyle.Bold) \'rx.y = 205 \'rx.x = 80 \'doc.body.Children.Add(rx) 你上面加了一次怎么可以又加一次呢 rx = new prt.RenderText rx.Text = Format(CurRow("结案日期"),"yyyy") rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中 rx.Style.TextAlignVert = prt.AlignVertEnum.Center \'垂直居中 rx.Style.Font = New Font("黑体", 15, FontStyle.Bold) rx.y = 202 rx.x = 70 doc.body.Children.Add(rx) 去掉 \'rx.Text = Format(CurRow("结案日期"),"mm") \'rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中 \'rx.Style.TextAlignVert = prt.AlignVertEnum.Center \'垂直居中 \'rx.Style.Font = New Font("黑体", 15, FontStyle.Bold) \'rx.y = 205 \'rx.x = 80 \'doc.body.Children.Add(rx) |
||||
-- 作者:李孝春 -- 发布时间:2014/7/30 18:02:00 -- 回复:(Bin)rx = new prt.RenderText ... 去掉之后 不显示准确
|
||||
-- 作者:有点甜 -- 发布时间:2014/7/30 18:06:00 -- rx.Text = Format(CurRow("收案时期"), "mm")
改成
rx.Text = Format(CurRow("收案时期"), "MM") |
||||
-- 作者:李孝春 -- 发布时间:2014/7/30 18:24:00 -- 回复:(有点甜)rx.Text = Format(CurRow("收案时期"... 这个错误还是依旧 在命令窗口中现在显示为 |
||||
-- 作者:有点甜 -- 发布时间:2014/7/30 19:07:00 -- 回复9楼,错误的意思是,同一个控件,不能添加多次。
添加完 doc.body.Children(rx) 以后,记得要重新生成一个控件
rx = new prt.RenderText |