以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 提取文件夹下所有WORD文档的文件名 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=176972) |
-- 作者:zhuxinhui -- 发布时间:2022/5/5 12:53:00 -- 提取文件夹下所有WORD文档的文件名 Dim r As String Dim rr As String For Each File As String In FileSys.GetFiles(ProjectPath & "\\Attachments\\") \'\'If FileSys.GetName(File) Like ".DOC" Then r = r &"|"& File rr = rr &"|"& FileSys.GetName(File) \'\'End If Next Dim cmb As WinForm.ComboBox = e.form.Controls("ComboBox1") cmb.ComboList = rr 想提取文件夹下所有WORD文档的文件名,放在e.form.Controls("ComboBox1")供选择使用 这个文件格式怎样加条件呢??
|
-- 作者:有点蓝 -- 发布时间:2022/5/5 13:54:00 -- If FileSys.GetName(File).tolower Like "*.doc*" Then |
-- 作者:zhuxinhui -- 发布时间:2022/5/5 14:40:00 -- 提取完文本后想设置打印页置 Dim f As String = e.Form.Controls("ComboBox1").value Dim TemplateName As String = ProjectPath & "Attachments\\" & f Dim ReportName As String = ProjectPath & "Reports\\" & f Dim doc As New WordReport(Tables("销售出库"), TemplateName, ReportName) doc.BuildOne(Tables("销售出库").Current) doc.Show() Dim doc As New PrintDoc() \'= ProjectPath & "Attachments\\销售出库.doc" \'定义一个报表 doc.PageSetting.Width = 210 doc.PageSetting.Height = 140 doc.PageSetting.LeftMargin = 10 \'设置左边距 doc.PageSetting.RightMargin = 10 \'设置右边距 doc.PageSetting.Landscape = False \'\'\'\'\'\'\'\'逻辑型,是否横向打印 doc.PageSetting.TopMargin = 10 \'\'\'\'\'\'上边距,单位为毫米 doc.PageSetting.BottomMargin = 10 \'\'\'\'\'\'\'\'底边距,单位为毫米 doc.Preview() \'预览 怎样把这二个连在一起,想把生成的WORD文档设置 为210*140的连续打印格式
|
-- 作者:有点蓝 -- 发布时间:2022/5/5 15:07:00 -- word和专业报表不是一个东西,没有办法合并到一起使用。 word打印设置要使用vba控制,具体参数看微软帮助:https://docs.microsoft.com/zh-cn/dotnet/api/microsoft.office.interop.word.pagesetup?redirectedfrom=MSDN&view=word-pia#properties 用法按类似execl vba里的打印设置:http://www.foxtable.com/webhelp/topics/2121.htm
|
-- 作者:zhuxinhui -- 发布时间:2022/5/5 15:52:00 -- 有点蓝老师:现在是不是,先生成WORD文档保存起来先,再使用VBA代码对文档进行设置并打印 |
-- 作者:有点蓝 -- 发布时间:2022/5/5 16:04:00 -- 是的 |
-- 作者:zhuxinhui -- 发布时间:2022/5/5 17:05:00 -- Dim f As String = e.Form.Controls("ComboBox1").value Dim TemplateName As String = ProjectPath & "Attachments\\" & f Dim ReportName As String = ProjectPath & "Reports\\" & f Dim Doss As New WordReport(Tables("销售出库"), TemplateName, ReportName) Doss.BuildOne(Tables("销售出库").Current) Doss.Show() Dim app As New MSWord.Application Dim WordD As MSWord.Document = app.Documents.Open(ReportName) With WordD.PageSetup \'.LineNumbering.Active = False .Orientation = False \'\'\'\'\'\'\'页面方向为纵向 .TopMargin = 3.3 \'\'\'\'\'\'\'\'\'\'\'上边距 .BottomMargin = 3.3 \'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'下边距 .LeftMargin = 2.8 \'\'\'\'\'\'\'\'\'\'\'\' \'左边距 .RightMargin = 2.8 \'\'\'\'\'\'\'\'\'\'\'\'\'右边距 .Gutter = 0 \'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'装订线 \'.HeaderDistance = 1.5 \'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'页眉 \'.FooterDistance = 1.8 \'\'\'\'\'\'\'\'\'\'\'\'\'页脚 .PageWidth = 21 \'\'\'\'\'\'\'\'\'\'页面宽度 .PageHeight = 14 \'\'\'\'\'\'\'\'\'\'\'页面高度\' \'.OddAndEvenPagesHeaderFooter = False \'不勾选"奇偶页不同" \'.DifferentFirstPageHeaderFooter = False \'不勾选"首页不同" \'.SuppressEndnotes = False \'不隐藏尾注 \'.MirrorMargins = False \'不设置首页的内外边距 \'.TwoPagesOnOne = False \'.BookFoldPrinting = False \'.BookFoldRevPrinting = False \'不设置手动双面打印 \'.BookFoldPrintingSheets = 1 \'默认打印份数为1 End With WordD.PrintPreview() 生成还是达不到210*140打印格式设置的效果 哪里出错了呢???? 这个连打搞了我好几日了 |
-- 作者:有点蓝 -- 发布时间:2022/5/5 17:20:00 -- Doss.Show()改为Doss.quit 另外页面设置的尺寸是磅,要自己转换一下,请仔细看微软的帮助
|
-- 作者:zhuxinhui -- 发布时间:2022/5/5 17:57:00 -- .PageWidth = CentimetersToPoints(21) \'纸张宽21cm .PageHeight = CentimetersToPoints(29.7) \'纸张高29.7cm .TopMargin = CentimetersToPoints(2) \'上边距2cm .BottomMargin = CentimetersToPoints(1.5) \'下边距1.5cm .LeftMargin = CentimetersToPoints(2.5) \'左边距2.5cm .RightMargin = CentimetersToPoints(1.5) \'右边距1.5cm .HeaderDistance = CentimetersToPoints(0.5) \'页眉0.5cm .FooterDistance = CentimetersToPoints(0.5) \'页脚0.5cm 这个不能用于FT吗? |
-- 作者:有点蓝 -- 发布时间:2022/5/5 20:38:00 -- .PageWidth = app.CentimetersToPoints(21) |