Foxtable(狐表)用户栏目专家坐堂 → [求助]看看这段代码哪里有问题


  共有1888人关注过本帖树形打印复制链接

主题:[求助]看看这段代码哪里有问题

帅哥哟,离线,有人找我吗?
鲁吉
  1楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:三尾狐 帖子:710 积分:5345 威望:0 精华:0 注册:2013/5/27 9:48:00
[求助]看看这段代码哪里有问题  发帖心情 Post By:2016/9/12 19:57:00 [只看该作者]

这是一段专业报表 的代码,提示有错误:没有为"Public Function Format(expression As Object,[Style As String = ""])As String"的参数"expression"指定参数      不能保存
涉及日期的几段都不行

Dim doc As New PrintDoc '定义一个报表
Dim rx As New prt.RenderText '定义一个文本对象
Dim CurRow As Row = Tables("责令改正").Current
rx.Style.LineSpacing = 200 '设置双倍行距
doc.Body.Children.Add(rx) '将文本对象加入到报表

rx = new prt.RenderText
rx.Text = CurRow(format[发出日期],"yyy")
rx.Style.Font = New Font("楷体", 14, FontStyle.Bold)
rx.x = 147
rx.y = 52
doc.body.Children.Add(rx)

rx = new prt.RenderText
rx.Text = CurRow("编号")
rx.Style.Font = New Font("楷体", 12, FontStyle.Bold)
rx.x = 169
rx.y = 52
doc.body.Children.Add(rx)

rx = new prt.RenderText
rx.Text = CurRow("被责令单位")
rx.Style.Font = New Font("楷体", 14, FontStyle.Bold)
rx.x = 20
rx.y = 61
doc.body.Children.Add(rx)

rx = new prt.RenderText
rx.Text = CurRow("事由")
rx.Style.TextIndent = 30 '首行缩进9毫米
rx.Style.LineSpacing = 200 '设置双倍行距
rx.Style.Font = New Font("楷体", 14, FontStyle.Bold)
rx.x = 25
rx.y = 72
doc.body.Children.Add(rx)

rx = new prt.RenderText
rx.Text = CurRow("违反的法律法规")
rx.Style.LineSpacing = 200 '设置双倍行距
rx.Style.TextIndent = 15 '首行缩进9毫米
rx.Style.Font = New Font("楷体", 14, FontStyle.Bold)
rx.x = 25
rx.y = 103
doc.body.Children.Add(rx)

rx = new prt.RenderText
rx.Text = CurRow(<format[限定日期],"yyy">)
rx.Style.Font = New Font("楷体", 14, FontStyle.Bold)
rx.x = 62
rx.y = 139
doc.body.Children.Add(rx)

rx = new prt.RenderText
rx.Text = CurRow(<format[限定日期],"MM">)
rx.Style.Font = New Font("楷体", 14, FontStyle.Bold)
rx.x = 94
rx.y = 139
doc.body.Children.Add(rx)

rx = new prt.RenderText
rx.Text = CurRow(<format[限定日期],"dd">)
rx.Style.Font = New Font("楷体", 14, FontStyle.Bold)
rx.x = 111
rx.y = 139
doc.body.Children.Add(rx)

rx = new prt.RenderText
rx.Text = CurRow("改正内容")
rx.Style.Font = New Font("楷体", 14, FontStyle.Bold)
rx.Style.LineSpacing = 200 '设置双倍行距
rx.x = 40
rx.y = 162
doc.body.Children.Add(rx)

rx = new prt.RenderText
rx.Text = CurRow("要求")
rx.Style.Font = New Font("楷体", 14, FontStyle.Bold)
rx.Style.LineSpacing = 200 '设置双倍行距
rx.x = 40
rx.y = 162
doc.body.Children.Add(rx)

rx = new prt.RenderText
rx.Text = CurRow(<format[发出日期],"yyy">)
rx.Style.Font = New Font("楷体", 14, FontStyle.Bold)
rx.x = 110
rx.y = 218
doc.body.Children.Add(rx)

rx = new prt.RenderText
rx.Text = CurRow(<format[发出日期],"MM">)
rx.Style.Font = New Font("楷体", 14, FontStyle.Bold)
rx.x = 135
rx.y = 218
doc.body.Children.Add(rx)

rx = new prt.RenderText
rx.Text = CurRow(<format[发出日期],"dd">)
rx.Style.Font = New Font("楷体", 14, FontStyle.Bold)
rx.x = 154
rx.y = 218
doc.body.Children.Add(rx)

Doc.Preview() '预览报表
[此贴子已经被作者于2016/9/12 20:19:49编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:107727 积分:547968 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2016/9/12 20:22:00 [只看该作者]

日期的格式全部按这种方式改改

rx.Text = format(CurRow("发出日期"),"yyy")

rx.Text = format(CurRow("发出日期"),"MM")

 回到顶部
帅哥哟,离线,有人找我吗?
鲁吉
  3楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:三尾狐 帖子:710 积分:5345 威望:0 精华:0 注册:2013/5/27 9:48:00
  发帖心情 Post By:2016/9/12 20:37:00 [只看该作者]

谢谢,能打出来了,但有一个问题:日期的格式是2016-09-12,打出来的月份却是00

 回到顶部
帅哥哟,离线,有人找我吗?
鲁吉
  4楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:三尾狐 帖子:710 积分:5345 威望:0 精华:0 注册:2013/5/27 9:48:00
  发帖心情 Post By:2016/9/12 20:58:00 [只看该作者]

如果用rx.Text = format(CurRow("发出日期"),"M")
打印出来的是2016    9月12日12   把汉字带出来了,还带了日
我要的是2016       9       12 这样的

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:107727 积分:547968 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2016/9/12 21:05:00 [只看该作者]

不可能的,上例子说明

 回到顶部