以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 错误 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=70896) |
-- 作者:cjl333333333 -- 发布时间:2015/7/1 0:09:00 -- 错误 索引 -1 不是为负数,就是大于行数。 我有个报表,为什么有此单要打印时会出现这个问题,有的不会? |
-- 作者:sloyy -- 发布时间:2015/7/1 0:14:00 -- 可能是数据为空时没处理好 |
-- 作者:cjl333333333 -- 发布时间:2015/7/1 0:26:00 -- \'Tables("制程指令").Sort = "工艺顺序 DESC" Dim tb As Table = Tables("制程指令") Dim AAA As Double = Tables("用料指令").Compute("SUM(订单用量)","类型 = \'原材料\'AND 制程 = \'印刷\'") For i As Integer = 0 To TB.Rows.Count-1 这个问题是因为先排序后它才会产生这样的,如果我不排序它就不会了?这个怎么回事 |
-- 作者:狐狸爸爸 -- 发布时间:2015/7/1 8:32:00 -- 贴出完整的代码看看。 |
-- 作者:大红袍 -- 发布时间:2015/7/1 9:13:00 -- 3楼的代码不会报错,你确定是 Tables("制程指令").Sort = "工艺顺序 DESC" 才出的问题?
贴出全部代码 |
-- 作者:cjl333333333 -- 发布时间:2015/7/1 20:27:00 -- Dim rx3 As New prt.RenderTable Dim doc1 As New PrintDoc() |
-- 作者:cjl333333333 -- 发布时间:2015/7/1 20:27:00 -- ElseIf Tables("制程指令").Rows(I)("制程") Like "复合*" Then Dim BBB As Double = Tables("用料指令").Compute("SUM(订单用量)","类型 = \'原材料\'AND 制程 =\'" & TB.Rows(I)("制程")&"\'") doc1.PageSetting.Width = 295 \'纸张宽度为200毫米 doc1.PageSetting.Height = 215 \'纸张高度为170毫米 doc1.PageSetting.Landscape = True Doc1.PageSetting.LeftMargin = 5 \'设置左边距 Doc1.PageSetting.RightMargin = 5 \'设置右边距 Doc1.PageSetting.TopMargin = 5 \'设置上边距 Doc1.PageSetting.BottomMargin = 5 \'设置下边距 Dim rt1 As New prt.RenderTable() \'定义一个表格对象 Dim rx1 As New prt.RenderText \'定义一个文本对象 \'加入标题 rx1.text = "生产跟踪绩效表"&"("& TB.Rows(I)("制程")&") 第 张" rx1.Style.FontBold = True \'字体加粗 rx1.Style.FontSize = 16 \'大体大小为16磅 rx1.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中排列 rx1.Style.Spacing.Bottom = 3 \'和下面的对象(表格)距离3毫米 doc1.Body.Children.Add(rx1) \'加入到报表中 rt1.Rows.Count = 32 \'设置总行数 rt1.Cols.Count = 15 \'设置总列数 rt1.Height = 190 \'设置表格的高度为80毫米 rt1.Cols(0).Width = 22 rt1.Cols(1).Width = 22 rt1.Cols(2).Width = 22 rt1.Cols(3).Width = 22 rt1.Cols(4).Width = 22 rt1.Cols(5).Width = 22 rt1.Cols(5).Width = 22 rt1.Cols(13).Width = 22 rt1.Cols(14).Width = 22 rt1.Cells(0,1).SpanCols = 2 rt1.Cells(0,7).SpanCols = 8 rt1.Cells(0,5).SpanCols = 2 rt1.Cells(1,2).SpanCols = 2 rt1.Cells(1,5).SpanCols = 2 rt1.Cells(1,7).SpanCols = 8 rt1.Cells(2,1).SpanCols = 4 rt1.Cells(2,5).spanrows = 2 \'第1行第5个单元格向下合并6行(用于显示照片) rt1.Cells(2,6).spanrows = 2 rt1.Cells(2,7).spanrows = 2 rt1.Cells(2,8).spanrows = 2 rt1.Cells(2,9).spanrows = 2 rt1.Cells(2,10).spanrows = 2 rt1.Cells(2,11).spanrows = 2 rt1.Cells(2,12).spanrows = 2 rt1.Cells(2,13).spanrows = 2 rt1.Cells(2,14).spanrows = 2 rt1.Cells(13,0).spanrows = 4 rt1.Cells(17,0).SpanCols = 5 rt1.Cells(18,2).SpanCols = 3 rt1.Cells(19,2).SpanCols = 3 rt1.Cells(20,2).SpanCols = 3 rt1.Cells(21,2).SpanCols = 3 rt1.Cells(22,2).SpanCols = 3 rt1.Cells(22,6).SpanCols = 9 rt1.Cells(23,1).SpanCols = 14 rt1.Cells(24,1).SpanCols = 14 rt1.Cells(25,0).SpanCols = 5 rt1.Cells(25,6).SpanCols = 2 rt1.Cells(26,2).SpanCols = 3 rt1.Cells(26,6).SpanCols = 2 rt1.Cells(27,0).SpanCols = 2 rt1.Cells(27,2).SpanCols = 2 rt1.Cells(27,6).SpanCols = 2 rt1.Cells(28,6).SpanCols = 2 rt1.Cells(29,6).SpanCols = 2 rt1.Cells(28,1).SpanCols = 4 rt1.Cells(28,5).SpanCols = 6 rt1.Cells(28,12).SpanCols = 3 rt1.Cells(29,1).SpanCols = 4 rt1.Cells(29,5).SpanCols = 6 rt1.Cells(29,12).SpanCols = 3 rt1.Cells(30,1).SpanCols = 4 rt1.Cells(30,5).SpanCols = 4 rt1.Cells(30,7).SpanCols = 6 rt1.Cells(31,0).SpanCols = 5 rt1.Cells(31,5).SpanCols = 9 rt1.Cells(30,5).SpanCols = 8 rt1.Cells(31,13).SpanCols = 2 rt1.CellStyle.Spacing.All = 1 \'单元格内容缩进1毫米 rt1.Style.GridLines.All = New prt.Linedef \'设置网格线 rt1.Style.TextAlignVert = prt.AlignVertEnum.Center \'内容垂直居中下面很简单,指定每一个单元格的内容 rt1.Cells(0,0).Text= "生产单号" rt1.Cells(0,1).Text = TB.Rows(I)("指令ID") rt1.Cells(0,3).Text = "制程" rt1.Cells(0,4).Text = TB.Rows(I)("制程") rt1.Cells(0,5).Text = "产品资料" rt1.Cells(0,7).Text = TB.Rows(I)("产品资料") rt1.Cells(1,0).Text = "任务米数" rt1.Cells(1,1).Text = TB.Rows(I-1)("预计本道成品米数") rt1.Cells(1,2).Text = "预计本道成品米数" rt1.Cells(1,4).Text = TB.Rows(I)("预计本道成品米数") rt1.Cells(1,5).Text = "额定用料" rt1.Cells(1,7).Text = TB.Rows(I)("标准用料")&" 预计应领物料为:" & BBB & "Kg" rt1.Cells(2,0).Text = "机台" rt1.Cells(2,1).Text ="当班生产参数设定" rt1.Cells(3,1).Text ="装网辊" rt1.Cells(3,2).Text ="装压辊" rt1.Cells(3,3).Text ="换胶" rt1.Cells(3,4).Text ="更换其它" rt1.Cells(2,5).Text ="产出记录" rt1.Cells(2,6).Text ="材料卷号" rt1.Cells(2,7).Text ="材料重量" rt1.Cells(2,8).Text ="半成品卷号" rt1.Cells(2,9).Text ="半成品重量" rt1.Cells(2,10).Text ="产出卷号" rt1.Cells(2,11).Text ="产出重量" rt1.Cells(2,12).Text ="产出米数" rt1.Cells(2,13).Text ="生产自检情况" rt1.Cells(2,14).Text ="品检检查情况" rt1.Cells(4,0).Text ="生产类型" rt1.Cells(5,0).Text ="初始□接班□" rt1.Cells(5,1).Text ="设备参数" rt1.Cells(5,2).Text ="设定" rt1.Cells(5,3).Text ="检测1" rt1.Cells(5,4).Text ="检测2" rt1.Cells(6,1).Text ="一放张力" rt1.Cells(7,1).Text ="二放张力" rt1.Cells(8,1).Text ="牵引张力" rt1.Cells(9,1).Text ="烘箱张力" rt1.Cells(10,1).Text ="收卷张力锥度" rt1.Cells(11,1).Text ="胶水项目" rt1.Cells(11,2).Text ="批号-名称" rt1.Cells(11,3).Text ="用量" rt1.Cells(11,4).Text ="作业粘度" rt1.Cells(12,1).Text ="胶水型号" rt1.Cells(13,1).Text ="固化剂型号" rt1.Cells(14,1).Text ="溶剂" rt1.Cells(15,1).Text ="机台初始米数" rt1.Cells(15,2).Text ="机台产完米数" rt1.Cells(15,3).Text ="熟化温度" rt1.Cells(15,4).Text ="熟化时间" rt1.Cells(4,5).Text ="承上累计" rt1.Cells(6,0).Text ="生产日期" rt1.Cells(8,0).Text ="开始时间" rt1.Cells(10,0).Text ="结束时间" rt1.Cells(12,0).Text ="生产人员" rt1.Cells(17,0).Text ="明细生产时间【R运行,S准备,D停机,A调整,J校机】" rt1.Cells(5,5).Text ="1" rt1.Cells(6,5).Text ="2" rt1.Cells(7,5).Text ="3" rt1.Cells(8,5).Text ="4" rt1.Cells(9,5).Text ="5" rt1.Cells(10,5).Text ="6" rt1.Cells(11,5).Text ="7" rt1.Cells(12,5).Text ="8" rt1.Cells(13,5).Text ="9" rt1.Cells(14,5).Text ="10" rt1.Cells(15,5).Text ="11" rt1.Cells(16,5).Text ="12" rt1.Cells(17,5).Text ="13" rt1.Cells(18,5).Text ="14" rt1.Cells(19,5).Text ="15" rt1.Cells(20,5).Text ="本单合计" rt1.Cells(21,5).Text ="总合计" rt1.Cells(22,5).Text ="备注" rt1.Cells(18,0).Text ="时间" rt1.Cells(18,1).Text ="状态" rt1.Cells(18,2).Text ="工作内容" rt1.Cells(23,0).Text ="生产反馈" rt1.Cells(22,5).Text ="备注" rt1.Cells(24,0).Text ="现场巡检反馈" rt1.Cells(25,0).Text ="以下部分品控部记录确认(说明:比例是用产出半成品米克重/投入原材料米克重)" rt1.Cells(25,0).Text ="品控过程反馈" rt1.Cells(25,2).Text ="反馈人及时间" rt1.Cells(25,5).Text ="废品记录" rt1.Cells(25,6).Text ="本班废品" rt1.Cells(25,8).Text ="原因" rt1.Cells(25,9).Text ="复废" rt1.Cells(25,10).Text ="原因" rt1.Cells(25,11).Text ="印废" rt1.Cells(25,12).Text ="料损" rt1.Cells(25,13).Text ="原因" rt1.Cells(25,14).Text ="机速" rt1.Cells(26,5).Text ="A班" rt1.Cells(27,0).Text ="投入原材料1米克重" rt1.Cells(27,2).Text ="产出半成品1米克重" rt1.Cells(27,4).Text ="比例" rt1.Cells(27,5).Text ="B班" rt1.Cells(28,0).Text ="品控本单总结" rt1.Cells(28,5).Text ="品控确认废品原因" rt1.Cells(28,11).Text ="确认人" rt1.Cells(28,13).Text ="生产人员" rt1.Cells(29,0).Text ="检验报告编号" rt1.Cells(29,5).Text ="仓库废品重量确认" rt1.Cells(29,11).Text ="确认人" rt1.Cells(30,0).Text ="记录人" rt1.Cells(30,5).Text ="生产审核人" rt1.Cells(31,0).Text ="品控本单通行确认及时间" rt1.Cells(31,5).Text ="领取本单物料确认及时间" doc1.Body.Children.Add(rt1) \'将表格对象加入到报表中 End If Next Doc.Preview() Doc1.Preview() Tables("制程指令").Sort = "工艺顺序" |
-- 作者:大红袍 -- 发布时间:2015/7/1 20:35:00 -- 你确定是 Tables("制程指令").Sort = "工艺顺序 DESC" 才出的问题?
你上面的代码没什么问题,做个可测试的例子发上来。 |
-- 作者:cjl333333333 -- 发布时间:2015/7/1 21:04:00 -- 相关的表比较多,太难做了。有时会有时不会的。
|
-- 作者:大红袍 -- 发布时间:2015/7/1 21:07:00 -- http://www.foxtable.com/help/topics/1485.htm
|