怎样把不同的统计表导出至一个Excel表,比如货品出库记录统计表导出到货品出入记录的Book.Sheets("out") ,货品入库记录统计表导出至 Book.Sheets("in") 我用了同个表,里面有两个模板
ElseIf ts = "货品出库记录" Then
If FileSys.FileExists(ProjectPath & "模板\货品出入库记录.xls") = False Then
Messagebox.Show("货品出库记录Excel模板不存在或已经被删除,导出失败!","错误提示",MessageBoxButtons.OK, MessageBoxIcon.Warning)
Return
End If
Dim spbh As WinForm.TextBox = e.Form.Controls("TextBox1")
Dim fl As String = ProjectPath & "excel\" & spbh.text & " 货品出库记录.xls"
If FileIsOpened(fl)= True Then
MessageBox.Show("""货品出库记录.xls""文件正在打开中,请先关闭再执行导出操作!")
Return
End If
e.Form.Controls("打印预览").Enabled = True
e.Form.Controls("直接打印").Enabled = True
Dim Book As New XLS.Book(ProjectPath & "模板\货品出入库记录.xls")
Dim Sheet As XLS.Sheet = Book.Sheets("out")
With Sheet.PrintSetting
.PaperKind = 9
.MarginLeft = 15
.MarginRight = 5
.MarginTop = 5
.MarginBottom = 5
.LandScape = True
End With
Sheet(1,0).Value = "<报表统计_Table1>"
Book.Build() '生成细节区
Book.Save(fl) '保存工作簿
e.Form.Controls("打印预览").Enabled = True
e.Form.Controls("直接打印").Enabled = True
If MessageBox.Show("导出完成,是否打开货品出库记录表?", "完成提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) = 1 Then
Dim Proc As New Process '打开工作簿
Proc.File = fl
Proc.Start()
End If
ElseIf ts = "货品入库记录" Then
If FileSys.FileExists(ProjectPath & "模板\货品出入库记录.xls") = False Then
Messagebox.Show("货品入库记录Excel模板不存在或已经被删除,导出失败!","错误提示",MessageBoxButtons.OK, MessageBoxIcon.Warning)
Return
End If
Dim spbh As WinForm.TextBox = e.Form.Controls("TextBox1")
Dim fl As String = ProjectPath & "excel\" & spbh.text & " 货品出入库记录.xls"
If FileIsOpened(fl)= True Then
Dim Book As New XLS.Book(ProjectPath & "模板\货品出入库记录.xls")
Dim Sheet As XLS.Sheet = Book.Sheets("in")
With Sheet.PrintSetting
.PaperKind = 9
.MarginLeft = 15
.MarginRight = 5
.MarginTop = 5
.MarginBottom = 5
.LandScape = True
End With
Sheet(1,0).Value = "<报表统计_Table1>"
Book.Build() '生成细节区
Book.Save(fl) '保存工作簿
e.Form.Controls("打印预览").Enabled = True
e.Form.Controls("直接打印").Enabled = True
If MessageBox.Show("导出完成,是否打开货品入库记录表?", "完成提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) = 1 Then
Dim Proc As New Process '打开工作簿
Proc.File = fl
Proc.Start()
End If
Else
Dim Book As New XLS.Book(ProjectPath & "模板\货品出入库记录.xls")
Dim Sheet As XLS.Sheet = Book.Sheets("in")
With Sheet.PrintSetting
.PaperKind = 9
.MarginLeft = 15
.MarginRight = 5
.MarginTop = 5
.MarginBottom = 5
.LandScape = True
End With
Sheet(1,0).Value = "<报表统计_Table1>"
Book.Build() '生成细节区
Book.Save(fl) '保存工作簿
e.Form.Controls("打印预览").Enabled = True
e.Form.Controls("直接打印").Enabled = True
If MessageBox.Show("导出完成,是否打开货品入库记录表?", "完成提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) = 1 Then
Dim Proc As New Process '打开工作簿
Proc.File = fl
Proc.Start()
End If
End If
比如我导出了一个全部货品出库记录到out ,等于说已经打开了一个全部货品出入记录。我再导一个全部货品到in,又打开了一个全部货品出入记录,怎样改才能让他们同时存在于一个货品出入记录里