以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 预览报错:无法创建新的堆站防护页面 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=194101) |
-- 作者:xxfoxtable -- 发布时间:2024/11/10 21:40:00 -- 预览报错:无法创建新的堆站防护页面 Dim doc As New PrintDoc \'定义一个报表 doc.PageSetting.Width = CStr(Tables("物流单打印设置").Current("纸宽")) doc.PageSetting.Height = CStr(Tables("物流单打印设置").Current("纸高")) doc.PageSetting.TopMargin = CStr(Tables("物流单打印设置").Current("上边距")) doc.PageSetting.LeftMargin = CStr(Tables("物流单打印设置").Current("左边距")) doc.PageSetting.RightMargin = CStr(Tables("物流单打印设置").Current("右边距")) doc.PageSetting.BottomMargin = CStr(Tables("物流单打印设置").Current("下边距")) Doc.PrinterName = Tables("物流单打印设置").Current("默认打印机") doc.AutoRotate = False Dim str As String For Each dr As Row In Tables("开单明细_table1").Rows If yd <> dr("运单号") Then Dim rt As New prt.RenderTable() \'定义一个表格对象 Dim rx As New prt.RenderText \'定义一个文本对象 Dim ra As New prt.RenderArea \'定义一个容器 ra.SplitVertBehavior = prt.SplitBehaviorEnum.Never \'禁止容器因为分页而被垂直分割 Dim kh As DataRow = DataTables("客户档案").SQLFind("序号=\'" & dr("客户序号") & "\'") rx.text = Tables("物流单打印设置").Current("标题一") rx.Style.FontBold = True \'字体加粗 rx.Style.FontSize = CStr(Tables("物流单打印设置").Current("标题一字体大小")) rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center rx.Style.Spacing.Bottom = CStr(Tables("物流单打印设置").Current("表头与表格的距离")) ra.Children.Add(rx) \'加入到容器中 Dim rm As New prt.RenderImage \'定义一个图片对象 rm.Image = GetImage(ProjectPath & "Attachments\\Logo.jpg") \'设置图片 \'rm.Style.Borders.All = New prt.Linedef(1, Color.Red) \'设置边框 rm.Style.ImageAlign.StretchHorz = True \'禁止拉伸 rm.Style.ImageAlign.StretchVert = True rm.Width = CStr(Tables("物流单打印设置").Current("Logo宽度")) rm.Height = CStr(Tables("物流单打印设置").Current("Logo高度")) rm.X = CStr(Tables("物流单打印设置").Current("logo左位置")) rm.y = CStr(Tables("物流单打印设置").Current("logo上位置")) rm.Style.ImageAlign.AlignHorz = prt.ImageAlignHorzEnum.Center ra.Children.Add(rm) \'加入到容器中 rx = New prt.RenderText rx.text = dr("出发地") & "→" & dr("目的地") rx.Style.FontSize = CStr(Tables("物流单打印设置").Current("出发地目的地字体大小")) rx.Style.FontBold = True rx.x = CStr(Tables("物流单打印设置").Current("出发地左位置")) rx.y = CStr(Tables("物流单打印设置").Current("出发地上位置") + Tables("物流单打印设置").Current("上边距")) \'rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中排列 \'rx.Style.Spacing.Bottom = 1 \'和下面的对象(表格)距离3毫米 ra.Children.Add(rx) \'加入到容器中 rx = New prt.RenderText rx.text = Tables("物流单打印设置").Current("业务受理电话") rx.Style.FontSize = CStr(Tables("物流单打印设置").Current("表格字体大小")) rx.Style.FontBold = False rx.x = CStr(Tables("物流单打印设置").Current("业务受理电脑左位置")) rx.y = CStr(Tables("物流单打印设置").Current("业务受理电话上位置") + Tables("物流单打印设置").Current("上边距")) \'\'rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中排列 \'\'rx.Style.Spacing.Bottom = 1 \'和下面的对象(表格)距离3毫米 ra.Children.Add(rx) \'加入到容器中 \'指定行数?列数?列宽?行高 rx = New prt.RenderText rx.text = Tables("物流单打印设置").Current("电话") rx.Style.FontBold = False \'rx.Style.FontBold = True \'字体加粗 rx.Style.FontSize = CStr(Tables("物流单打印设置").Current("表格字体大小")) rx.x = CStr(Tables("物流单打印设置").Current("电话左位置")) rx.y = CStr(Tables("物流单打印设置").Current("业务受理电话上位置") + Tables("物流单打印设置").Current("上边距")) \'rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中排列 \'rx.Style.Spacing.Bottom = 1 \'和下面的对象(表格)距离3毫米 ra.Children.Add(rx) \'加入到容器中 \'报表_table1表格样式 rt.Cols.Count = 11 \'报表_table1总列数 rt.Cols(0).Width = CStr(Tables("物流单打印设置").Current("第一列宽度")) rt.Cols(1).Width = CStr(Tables("物流单打印设置").Current("第二列宽度")) rt.Cols(2).Width = CStr(Tables("物流单打印设置").Current("第三列宽度")) rt.Cols(3).Width = CStr(Tables("物流单打印设置").Current("第四列宽度")) rt.Cols(4).Width = CStr(Tables("物流单打印设置").Current("第五列宽度")) rt.Cols(5).Width = CStr(Tables("物流单打印设置").Current("第六列宽度")) rt.Cols(6).Width = CStr(Tables("物流单打印设置").Current("第七列宽度")) rt.Cols(7).Width = CStr(Tables("物流单打印设置").Current("第八列宽度")) rt.Cols(8).Width = CStr(Tables("物流单打印设置").Current("第九列宽度")) rt.Cols(9).Width = CStr(Tables("物流单打印设置").Current("第十列宽度")) rt.Cols(10).Width = CStr(Tables("物流单打印设置").Current("第十一列宽度")) rt.CellStyle.Spacing.All = 0 \'单元格内容缩进1毫米 rt.Style.GridLines.All = New prt.Linedef \'报表_table1网格线 \'rt.Style.TextAlignHorz = prt.AlignVertEnum.Center \'内容垂直居中 rt.Style.TextAlignVert = prt.AlignHorzEnum.Center \'垂直居中 Dim i As Integer = 1 rt.Cells(i, 0).SpanCols = 8 rt.Cells(i, 0).Text = "日期:" & Format(dr("到货日期"), "yyyy年MM月dd日") rt.Cells(i, 0).Style.GridLines.Right = New prt.LineDef("0mm", Color.white) rt.Cells(i, 8).SpanCols = 3 rt.Cells(i, 8).Text = "Ne:" & dr("运单号") rt.Cells(i, 8).Style.GridLines.left = New prt.LineDef("0mm", Color.white) rt.Rows(i).Height = CStr(Tables("物流单打印设置").Current("表格高度")) i = i + 1 rt.Cells(i, 0).Text = "收货人" rt.Cells(i, 0).Style.TextAlignHorz = prt.AlignVertEnum.Center rt.Cells(i, 1).SpanCols = 3 rt.Cells(i, 1).Text = dr("客户名称") rt.Cells(i, 4).Text = "地址" rt.Cells(i, 4).Style.TextAlignHorz = prt.AlignVertEnum.Center rt.Cells(i, 5).SpanCols = 3 rt.Cells(i, 6).Text = kh("地址") rt.Cells(i, 8).Text = "电话" rt.Cells(i, 8).Style.TextAlignHorz = prt.AlignVertEnum.Center rt.Cells(i, 9).SpanCols = 2 rt.Cells(i, 9).Text = kh("联系电话") rt.Rows(i).Height = CStr(Tables("物流单打印设置").Current("表格高度")) i = i + 1 \'rt.Rows(7).Style.TextAlignHorz = prt.AlignVertEnum.Top \'唯独第7行是备注,内容靠上对齐 \'下面很简单,指定每一个单元格的内容 rt.Cells(i, 0).SpanCols = 2 rt.Cells(i, 0).Text = "运输方式" rt.Cells(i, 0).Style.TextAlignHorz = prt.AlignVertEnum.Center rt.Cells(i, 2).Text = "件数" rt.Cells(i, 2).Style.TextAlignHorz = prt.AlignVertEnum.Center rt.Cells(i, 3).SpanCols = 2 rt.Cells(i, 3).Text = "重量" rt.Cells(i, 3).Style.TextAlignHorz = prt.AlignVertEnum.Center rt.Cells(i, 5).Text = "单价" rt.Cells(i, 5).Style.TextAlignHorz = prt.AlignVertEnum.Center rt.Cells(i, 6).Text = "保险" rt.Cells(i, 6).Style.TextAlignHorz = prt.AlignVertEnum.Center rt.Cells(i, 7).Text = "中转费" rt.Cells(i, 7).Style.TextAlignHorz = prt.AlignVertEnum.Center rt.Cells(i, 8).Text = "送货费" rt.Cells(i, 8).Style.TextAlignHorz = prt.AlignVertEnum.Center rt.Cells(i, 9).Text = "其他费用" rt.Cells(i, 9).Style.TextAlignHorz = prt.AlignVertEnum.Center rt.Cells(i, 10).Text = "合计" rt.Cells(i, 10).Style.TextAlignHorz = prt.AlignVertEnum.Center rt.Rows(i).Height = CStr(Tables("物流单打印设置").Current("表格高度")) \'rt.Rows(2).Style.Borders.Top = New prt.Linedef \'恢复第二行底端的网格线 rt.Rows(0).style.Font = New Font("宋体", Tables("物流单打印设置").Current("表格字体大小")) \'rt.Rows(0).Height = CStr(Tables("物流单打印设置").Current("表格高度")) \'rt.RowGroups(0,3).Header = prt.TableHeaderEnum.All \'前四行作为表头 i = i + 1 Dim je As Integer = 0 Dim j As Integer = 1 For Each r As DataRow In DataTables("开单明细").SQLSelect("运单号=\'" & dr("运单号") & "\'") rt.Cells(i, 0).SpanCols = 2 rt.Cells(i, 0).Text = r("运输方式") rt.Cells(i, 0).Style.TextAlignHorz = prt.AlignHorzEnum.center rt.Cells(i, 2).Text = r("件数") rt.Cells(i, 2).Style.TextAlignHorz = prt.AlignHorzEnum.center rt.Cells(i, 3).SpanCols = 2 If r("重量") = 0 Then rt.Cells(i, 3).Text = "" Else rt.Cells(i, 3).Text = r("重量") End If rt.Cells(i, 3).Style.TextAlignHorz = prt.AlignHorzEnum.center If r("单价") = 0 Then rt.Cells(i, 5).Text = "" Else rt.Cells(i, 5).Text = r("单价") End If rt.Cells(i, 5).Style.TextAlignHorz = prt.AlignHorzEnum.center If r("保险") = 0 Then rt.Cells(i, 6).Text = "" Else rt.Cells(i, 6).Text = r("保险") End If rt.Cells(i, 6).Style.TextAlignHorz = prt.AlignHorzEnum.center If r("中转费") = 0 Then rt.Cells(i, 7).Text = "" Else rt.Cells(i, 7).Text = r("中转费") End If rt.Cells(i, 7).Style.TextAlignHorz = prt.AlignHorzEnum.center If r("送货费") = 0 Then rt.Cells(i, 8).Text = "" Else rt.Cells(i, 8).Text = r("送货费") End If rt.Cells(i, 8).Style.TextAlignHorz = prt.AlignHorzEnum.center If r("付重庆") = 0 Then rt.Cells(i, 9).Text = "" Else rt.Cells(i, 9).Text = r("付重庆") End If rt.Cells(i, 9).Style.TextAlignHorz = prt.AlignHorzEnum.center rt.Cells(i, 10).Text = r("应收金额") rt.Cells(i, 10).Style.TextAlignHorz = prt.AlignHorzEnum.center \'\'rt.Rows(i).Style.Font=new Font("宋体",Tables("物流单打印设置").Current("表体字体大小"),FontStyle.Bold) rt.Rows(i).Style.Font = New Font("宋体", Tables("物流单打印设置").Current("表格字体大小")) rt.Rows(i).Height = CStr(Tables("物流单打印设置").Current("表格高度")) je = je + r("应收金额") j = j + 1 i = i + 1 Next Do While j < 5 rt.Cells(i, 0).SpanCols = 2 rt.Cells(i, 0).Text = "" rt.Cells(i, 2).Text = "" rt.Cells(i, 3).SpanCols = 2 rt.Cells(i, 3).Text = "" rt.Cells(i, 5).Text = "" rt.Cells(i, 6).Text = "" rt.Cells(i, 7).Text = "" rt.Cells(i, 8).Text = "" rt.Cells(i, 9).Text = "" rt.Cells(i, 10).Text = "" \'\'rt.Rows(i).Style.Font=new Font("宋体",Tables("物流单打印设置").Current("表体字体大小"),FontStyle.Bold) rt.Rows(i).Style.Font = New Font("宋体", Tables("物流单打印设置").Current("表格字体大小")) rt.Rows(i).Height = CStr(Tables("物流单打印设置").Current("表格高度")) j = j + 1 i = i + 1 Loop rt.Cells(i, 0).SpanCols = 2 rt.Cells(i, 0).Text = "合计大写:" rt.Cells(i, 0).Style.TextAlignHorz = prt.AlignHorzEnum.center rt.Cells(i, 2).SpanCols = 8 rt.Cells(i, 2).Text = CUMoney(je) rt.Cells(i, 2).Style.TextAlignHorz = prt.AlignHorzEnum.center \'rt.Cells(i, 7).SpanCols = 2 \'rt.Cells(i, 7).Text = "提货方式" \'rt.Cells(i, 7).Style.TextAlignHorz = prt.AlignHorzEnum.center \'rt.Cells(i, 9).SpanCols = 2 \'rt.Cells(i, 9).Text = Args(8) ‘提货方式 Args(10)是备注 \'rt.Cells(i, 9).Style.TextAlignHorz = prt.AlignHorzEnum.center rt.Cells(i, 10).Text = "备注" rt.Cells(i, 10).Style.TextAlignHorz = prt.AlignHorzEnum.center rt.Rows(i).Style.Font = New Font("宋体", Tables("物流单打印设置").Current("表格字体大小")) rt.Rows(i).Height = CStr(Tables("物流单打印设置").Current("表格高度")) i = i + 1 rt.Cells(i, 0).SpanCols = 2 rt.Cells(i, 0).Text = "付款方式:" rt.Cells(i, 0).Style.TextAlignHorz = prt.AlignHorzEnum.center rt.Cells(i, 2).SpanCols = 3 rt.Cells(i, 2).Text = dr("结算方式") rt.Cells(i, 2).Style.TextAlignHorz = prt.AlignHorzEnum.center rt.Cells(i, 5).SpanCols = 2 rt.Cells(i, 5).Text = "提货方式:" rt.Cells(i, 5).Style.TextAlignHorz = prt.AlignHorzEnum.center rt.Cells(i, 7).SpanCols = 3 rt.Cells(i, 7).Text = dr("提货方式") rt.Cells(i, 7).Style.TextAlignHorz = prt.AlignHorzEnum.center rt.Cells(i, 10).SpanRows = 2 rt.Cells(i, 10).Text = dr("备注") rt.Cells(i, 10).Style.TextAlignHorz = prt.AlignHorzEnum.center rt.Rows(i).Style.Font = New Font("宋体", Tables("物流单打印设置").Current("表格字体大小")) rt.Rows(i).Height = CStr(Tables("物流单打印设置").Current("表格高度")) i = i + 1 rt.Cells(i, 0).SpanCols = 10 ra = rt.Cells(i, 0).Area rx = New prt.RenderText \'创建一个文本 rx.Text = Tables("物流单打印设置").Current("注意事项") rx.Style.Font = New Font("宋体", Tables("物流单打印设置").Current("注意事项字体大小")) rx.Style.FontBold = True \'字体加粗 ra.Children.Add(rx) rx = New prt.RenderText \'创建一个文本 rx.Text = Tables("物流单打印设置").Current("注意事项1") rx.Style.Font = New Font("宋体", Tables("物流单打印设置").Current("注意事项字体大小")) rx.Style.FontBold = True \'字体加粗 ra.Children.Add(rx) rx = New prt.RenderText \'创建一个文本 rx.Text = Tables("物流单打印设置").Current("注意事项2") rx.Style.Font = New Font("宋体", Tables("物流单打印设置").Current("注意事项字体大小")) rx.Style.FontBold = True \'字体加粗 ra.Children.Add(rx) rx = New prt.RenderText \'创建一个文本 rx.Text = Tables("物流单打印设置").Current("注意事项3") rx.Style.Font = New Font("宋体", Tables("物流单打印设置").Current("注意事项字体大小")) rx.Style.FontBold = True \'字体加粗 ra.Children.Add(rx) rx = New prt.RenderText \'创建一个文本 rx.Text = Tables("物流单打印设置").Current("注意事项4") rx.Style.Font = New Font("宋体", Tables("物流单打印设置").Current("注意事项字体大小")) rx.Style.FontBold = True \'字体加粗 \' ra.Children.Add(rx) ra.Style.Spacing.Top = 2 ra.Style.Spacing.Bottom = 2 i = i + 1 rt.Cells(i, 0).SpanCols = 11 rt.Cells(i, 0).Text = Tables("物流单打印设置").Current("说明") rt.Rows(i).Style.Font = New Font("宋体", Tables("物流单打印设置").Current("表格字体大小")) rt.Rows(i).Height = CStr(Tables("物流单打印设置").Current("表格高度")) i = i + 1 rt.Cells(i, 0).SpanCols = 3 rt.Cells(i, 0).Text = "送货单位及经办人:" rt.Cells(i, 0).Style.TextAlignHorz = prt.AlignHorzEnum.Right rt.Cells(i, 3).SpanCols = 3 rt.Cells(i, 3).Text = Vars("uname") rt.Cells(i, 3).Style.TextAlignHorz = prt.AlignHorzEnum.left rt.Cells(i, 6).SpanCols = 3 rt.Cells(i, 6).Text = "收货单位及经办人:" rt.Cells(i, 6).Style.TextAlignHorz = prt.AlignHorzEnum.Right rt.Cells(i, 9).SpanCols = 2 rt.Cells(i, 9).Text = "" rt.Rows(i).Style.Font = New Font("宋体", Tables("物流单打印设置").Current("表格字体大小")) rt.Rows(i).Height = CStr(Tables("物流单打印设置").Current("表格高度")) ra.Children.Add(rt) \'加入到容器中 Doc.Body.ChildRen.Add(ra) \'将容器加入到报表中 End If yd = dr("运单号") Next Doc.Preview()
[此贴子已经被作者于2024/11/10 21:52:14编辑过]
|
-- 作者:有点蓝 -- 发布时间:2024/11/10 21:53:00 -- 提示死循环了。减少代码测试,然后逐步添加,看是添加什么代码后出错。 |
-- 作者:xxfoxtable -- 发布时间:2024/11/10 22:02:00 -- 我把内部循环语句都去掉了,就剩下最外层的了,也不行 [此贴子已经被作者于2024/11/10 22:03:32编辑过]
|
-- 作者:有点蓝 -- 发布时间:2024/11/10 22:30:00 -- 继续减少代码,减少到最少,比如只打印个标题,然后逐步添加,只打印表格标题,只打印一行,只........... |