以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 专业报表 调整表格位置 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=95448) |
-- 作者:jinzhengbe -- 发布时间:2017/1/19 22:18:00 -- 专业报表 调整表格位置 如图所示 中间的图是现在当前打印的样式,我想把表格的位置向右移动 调整表格的x和容器的x都不行, 所以想请教各位大神一下, 怎么才能使表格向右移动呢? 下面有贴代码请各位多多指点
Dim ra As new prt.RenderArea Dim Doc As New PrintDoc \'定义一个报表 Doc.PageSetting.LeftMargin = 2 \'设置左边距 Doc.PageSetting.RightMargin = 2 \'设置右边距 Doc.PageSetting.TopMargin= 8 \'设置上边距 Doc.PageSetting.BottomMargin = 5 \'设置底边距 Doc.PageSetting.Width=89 \'宽度 Doc.PageSetting.Height=229 \'高度 Doc.PageSetting.Landscape = False \'横向打印 Doc.PageSetting.Color = False \'彩色打印 Dim tb As Table \'定义一个数据表 Dim cn As String \'定义一个Grid Dim ColNames As String() \'定义一个数据表列数组 Dim Col_lst As new List(of String) \'列集合 Dim c As Integer Dim iw As Integer Dim ar1 As String Dim li As Integer Dim Grid9 As New prt.RenderTable \'定义一个报表数据表对象 tb= Tables("weixindanhao.weixin") \'定义一个数据表 cn="name|30|shuliang|10|price|20" \'显示列 ColNames=cn.split("|") \'显示列转换 iw=0 For c = 0 To ColNames.Length -1 If c Mod 2=0 Then iw+=ColNames(c+1) Grid9.Cells(0,c/2).Text = ColNames(c) Grid9.Cols(c/2).Width = ColNames(c+1) If tb.DataTable.datacols(ColNames(c)).IsDate Then If ColNames(c).contains("-") Then Grid9.Cells(1, c/2).Text ="[Format(Fields!"&ColNames(c)&".Value,""yyyy-MM-dd"")]" \'日期列调整 Else Grid9.Cells(1, c/2).Text ="[Format(Fields!"&ColNames(c)&".Value,""yyyy/MM/dd"")]" \'日期列调整 End If Else Grid9.Cells(1, c/2).Text ="[Fields!" & ColNames(c) & ".Value]" \'设置绑定表达式 End If End If Next Grid9.RowGroups(1,1).DataBinding.DataSource = BindTables("weixindanhao.weixin") \'将第二行绑定到订单表 Grid9.Width=iw \'自动宽度 Grid9.Style.TextAlignHorz=prt.AlignHorzEnum.Left \'文本对齐,水平 Grid9.Style.TextAlignVert=prt.AlignVertEnum.Top \'文本对齐,垂直 Grid9.Style.Font=New System.Drawing.Font("Gulim",9,0,3,1,False) \'文本字体 Grid9.Style.BackColor=Color.FromKnownColor(164) \'背景颜色 Grid9.Style.TextColor=Color.FromKnownColor(35) \'字体颜色 Grid9.CellStyle.Spacing.All=0.5 \'单元格文本内距 \'Grid9.x=3 Grid9.RowGroups(0,tb.HeaderRows).Style.TextAlignHorz=prt.AlignHorzEnum.Left \'文本对齐,水平 Grid9.RowGroups(0,tb.HeaderRows).Style.TextAlignVert=prt.AlignVertEnum.Top \'文本对齐,垂直 Grid9.RowGroups(0,tb.HeaderRows).Style.Font=New System.Drawing.Font("宋体",9.5,0,3,134,False) \'文本字体 Grid9.RowGroups(0,tb.HeaderRows).Style.BackColor=Color.FromKnownColor(164) \'背景颜色 Grid9.RowGroups(0,tb.HeaderRows).Style.TextColor=Color.FromKnownColor(35) \'字体颜色 Grid9.RowGroups(0,tb.HeaderRows).CellStyle.Spacing.All=0.5 \'单元格文本内距 Grid9.Style.GridLines.All = New Prt.LineDef("0.2",Color.FromKnownColor(35)) \'所有网格线 Grid9.Style.GridLines.Vert = New Prt.LineDef("0.2",Color.FromKnownColor(35)) \'所有网格线 Grid9.Style.GridLines.Horz = New Prt.LineDef("0.2",Color.FromKnownColor(35)) \'所有网格线 Dim LineLine3 As New prt.LineDef(1,Color.FromKnownColor(35),DashStyle.Solid) Dim Line3 As New prt.RenderLine(8,10,76,10, LineLine3) \'定义一个线段对象 Dim LineLine4 As New prt.LineDef(1,Color.FromKnownColor(35),DashStyle.Solid) Dim Line4 As New prt.RenderLine(9.75,30,75.75,30, LineLine4) \'定义一个线段对象 Dim txt As new prt.RenderText txt.text = "false" txt.x = 10 txt.y = 20 ra = new prt.RenderArea ra.children.add(line3) ra.children.add(txt) ra.children.add(line4) Doc.Body.Children.Add(Grid9) \'将数据表加入到报表 Doc.Body.Children.Add(ra) \'将线条加入到报表 doc.Preview() \'预览 [此贴子已经被作者于2017/1/20 12:41:07编辑过]
|
-- 作者:有点色 -- 发布时间:2017/1/20 0:34:00 -- 尽量少设置x、y属性,不然很布局的。
你可以用这些属性
http://www.foxtable.com/webhelp/scr/1178.htm
http://www.foxtable.com/webhelp/scr/1173.htm
|