以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  通过ADOBE虚拟打印机将文件导出为PDF格式文件,能否再以当前标题命名文件  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=11559)

--  作者:kevin
--  发布时间:2011/8/2 20:56:00
--  通过ADOBE虚拟打印机将文件导出为PDF格式文件,能否再以当前标题命名文件
通过ADOBE虚拟打印机将文件导出为PDF格式文件,能否再以当前文件标题命名文件存到指定文件夹内,或者用日期做为文件名,存在到指定的文件夹内.
--  作者:blackzhu
--  发布时间:2011/8/3 7:59:00
--  

Tables("订单明细").Sort = "订单号"

\'选择全表

CurrentTable.Select(0, 0, CurrentTable.Rows.Count - 1, CurrentTable.Cols.Count - 1)

Dim T,T1,T2,T3,T4 As String

If FileSys.FileExists(ProjectPath & "Attachments\\规格\\" & Tables("订单情况").Current("IO") & "\\ " & Tables("订单情况").Current("IO") & T3 &  T2 & T4 & T & ".xls") Then

    FileSys.DeleteFile(ProjectPath & "Attachments\\规格\\" & Tables("订单情况").Current("IO") & "\\ " & Tables("订单情况").Current("IO") & T3 & T2 & T4 & T & ".xls")

End If

T =  e.Form.Controls("ComboBox1").value

T1 = ProjectPath & "Attachments\\" & T & ".xls"

T2 = e.Form.Controls("ComboBox8").value

T3 = e.Form.Controls("ComboBox5").value

T4 =  e.Form.Controls("ComboBox10").value

If T IsNot Nothing Then

    If T.Indexof(T) > -1 Then

        Dim Book As New XLS.Book(T1)

        Dim v As Double = DataTables("装箱单").Compute("Sum(箱数)","口岸 = \'" &  T3 & " \'")

        Book.Marks.Add("箱数",v)

        Dim v3 As Double = DataTables("装箱单").Compute("Sum(箱数)","口岸 = \'" &  T2 & " \'")

        Book.Marks.Add("箱数1",v3)

        Dim v1 As Double = DataTables("装箱单").Compute("Sum(总件数)","口岸 = \'" &  T3 & " \'")

        Book.Marks.Add("件数",v1)

        Dim v2 As Double = DataTables("订单明细").Compute("Sum(TOTAL)")

        Book.Marks.Add("总件数",V2 & "PCS")

        Book.Build()

        Book.Save(ProjectPath & "Attachments\\规格\\" & Tables("订单情况").Current("IO") & "\\" & Tables("订单情况").Current("IO") & T3 & T2 & T4 & T & ".xls")

        Dim App As New MSExcel.Application

        Dim Wb As MSExcel.Workbook = App.WorkBooks.Open(ProjectPath &  "Attachments\\规格\\" & Tables("订单情况").Current("IO") & "\\" & Tables("订单情况").Current("IO") & T3 & T2 & T4 & T &".xls")

        Dim Wd As MSExcel.Window = Wb.Windows(1)    \'表示当前工作簿窗口

        Wd.DisplayZeros = False                 \'不显示0值

        App.Visible = True

        Wb.Save

    End If

End If


这个代码是我的,打印的格式是XLS,是根据IO号打印到此文件夹中,自己修改一下.


--  作者:andy
--  发布时间:2011/8/3 13:28:00
--  
图片点击可在新窗口打开查看