以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  foxtable设置自由合并模式后导出excel变了  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=69504)

--  作者:雁过不留痕8
--  发布时间:2015/6/6 10:58:00
--  foxtable设置自由合并模式后导出excel变了
如图foxtable设置自由合并模式后导出excel变了,原来合并的行又分开了,变成这样了
装箱清单
堆垛数箱数箱条码条形码资产编号出厂编号标识代码
11623001900000000155855862300010000011234582020000011234582000000112345820623000100000112345820
11623001900000000155855862300010000011234582190000011234582100000112345821623000100000112345821
11623001900000000155855862300010000011234582260000011234582200000112345822623000100000112345822
11623001900000000155855862300010000011234582330000011234582300000112345823623000100000112345823
11623001900000000155855862300010000011234582400000011234582400000112345824623000100000112345824
11623001900000000155855862300010000011234582570000011234582500000112345825623000100000112345825
11623001900000000155855862300010000011234582640000011234582600000112345826623000100000112345826
11623001900000000155855862300010000011234582710000011234582700000112345827623000100000112345827
11623001900000000155855862300010000011234582880000011234582800000112345828623000100000112345828
11623001900000000155855862300010000011234582950000011234582900000112345829623000100000112345829
11623001900000000155855862300010000011234583010000011234583000000112345830623000100000112345830
11623001900000000155855862300010000011234583180000011234583100000112345831623000100000112345831

--  作者:雁过不留痕8
--  发布时间:2015/6/6 10:59:00
--  
foxtable中堆垛数、箱数相同的都合并的,合并代码如下
With Tables("甘肃表装箱清单")
    .MergeMode = MergeModeEnum.free \'自由合并模式
    .MergeCols.Clear() \'清除原来的合并列
    .MergeCols.Add("装箱清单_堆垛数") \'加入要合并的列
    .MergeCols.Add("装箱清单_箱数") \'加入要合并的列
    .MergeCols.Add("装箱清单_箱条码") \'加入要合并的列
\'
    .AllowMerge = True \'启用合并模式
End With

--  作者:雁过不留痕8
--  发布时间:2015/6/6 10:59:00
--  
怎样才能导出excel是合并模式的
--  作者:雁过不留痕8
--  发布时间:2015/6/6 11:00:00
--  
箱数箱条码条形码资产编号出厂编号
1623001900000000155855862300010000011234582020000011234582000000112345820
62300010000011234582190000011234582100000112345821
62300010000011234582260000011234582200000112345822
62300010000011234582330000011234582300000112345823
62300010000011234582400000011234582400000112345824
62300010000011234582570000011234582500000112345825
62300010000011234582640000011234582600000112345826
62300010000011234582710000011234582700000112345827
62300010000011234582880000011234582800000112345828
62300010000011234582950000011234582900000112345829
62300010000011234583010000011234583000000112345830
62300010000011234583180000011234583100000112345831
62300010000011234583250000011234583200000112345832
62300010000011234583320000011234583300000112345833
62300010000011234583490000011234583400000112345834

--  作者:雁过不留痕8
--  发布时间:2015/6/6 11:03:00
--  
合并和导出代码
With Tables("甘肃表装箱清单")
    .MergeMode = MergeModeEnum.free \'自由合并模式
    .MergeCols.Clear() \'清除原来的合并列
    .MergeCols.Add("装箱清单_堆垛数") \'加入要合并的列
    .MergeCols.Add("装箱清单_箱数") \'加入要合并的列
    .MergeCols.Add("装箱清单_箱条码") \'加入要合并的列
\'
    .AllowMerge = True \'启用合并模式
End With
DataTables("甘肃表装箱清单").save
Dim dlg As New SaveFileDialog \'定义一个新的SaveFileDialog 
dlg.Filter= "Excel文件|*.xls" \'设置筛选器
If dlg.ShowDialog = DialogResult.Ok Then \'如果用户单击了确定按钮
     Tables("甘肃表装箱清单").SaveExcel(dlg.FileName, "甘肃表装箱清单")  \'保存文件
End If

--  作者:sloyy
--  发布时间:2015/6/6 11:22:00
--  
有2个办法实现:

1 先取消合并模式后导出数据,导出excel报表后再设置合并模式

2 直接SaveExcel