找回密码
 加入
搜索
查看: 5072|回复: 9

[系统综合] 谁能给个调用word模板打印的例子

  [复制链接]
发表于 2010-10-15 08:17:14 | 显示全部楼层 |阅读模式
如题,最近正在为自己的店铺编一个简单的进销存软件,但是现在被打印这块给难住了,谁能教教我怎么才能调用word模板打印


谢谢啦!
发表于 2010-10-15 09:34:50 | 显示全部楼层
没有打印机。
在官网找了个UDF,你去看看http://www.autoitscript.com/foru ... =1&#entry838932
发表于 2010-10-15 10:03:05 | 显示全部楼层
在UDF中仔细找了下,的确有针对WORD的打印函数。
#include <Word.au3>
_WordDocPrint ( ByRef $o_object [, $b_Background = 0 [, $i_Copies = 1 [, $i_Orientation = -1 [, $b_Collate = 1 [, $s_Printer = "" [, $i_Range = 0 [, $i_From = "" [, $i_To = "" [, $s_Pages = "" [, $i_PageType = 0 [, $i_Item = 0]]]]]]]]]]] )

UDF中例子如下:
; *******************************************************
; Example 1 - Create a word window, open a document, set the text,
;                                print with defaults, and quit without saving changes.
; *******************************************************
;
#include <Word.au3>
$oWordApp = _WordCreate (@ScriptDir & "\Test.doc")
$oDoc = _WordDocGetCollection ($oWordApp, 0)
$oDoc.Range.Text = "This is some text to print."
_WordDocPrint ($oDoc)
_WordQuit ($oWordApp, 0)

; *******************************************************
; Example 2 - Create a word window, open a document, set the text,
;                                print using landscape, and quit without saving changes.
; *******************************************************
;
#include <Word.au3>
$oWordApp = _WordCreate (@ScriptDir & "\Test.doc")
$oDoc = _WordDocGetCollection ($oWordApp, 0)
$oDoc.Range.Text = "This is some text to print."
_WordDocPrint ($oDoc, 0, 1, 1)
_WordQuit ($oWordApp, 0)

; *******************************************************
; Example 3 - Create a word window, open a document, set the text,
;                                print to a printer named "My Printer", and quit without saving changes.
; *******************************************************
;
#include <Word.au3>
$oWordApp = _WordCreate (@ScriptDir & "\Test.doc")
$oDoc = _WordDocGetCollection ($oWordApp, 0)
$oDoc.Range.Text = "This is some text to print."
_WordDocPrint ($oDoc, 0, 1, 0, 1, "My Printer")
_WordQuit ($oWordApp, 0)
发表于 2010-10-15 12:14:19 | 显示全部楼层
很简单 直接用word录制一个宏 然后调用application类改写成au3的就行了.
发表于 2010-10-15 14:46:02 | 显示全部楼层
很简单 直接用word录制一个宏 然后调用application类改写成au3的就行了.
xrbenbeba 发表于 2010-10-15 12:14



楼上给个例子看看
 楼主| 发表于 2010-10-15 21:19:21 | 显示全部楼层
回复 3# 3mile


    3Q!  我有时间试试看
 楼主| 发表于 2010-10-15 21:53:47 | 显示全部楼层
回复 3# 3mile


    刚刚我试了下,我需要的是调用WORD模板,而不是创建WORD再打印,像图片中那样,图片中那个模板是RTF的

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2010-10-15 22:16:06 | 显示全部楼层
回复 7# guland
因为没有打印机,没法给出具体的代码。
不过我想,可不可以用_WinAPI_CreateFile打开设备,使其作打印的动作呢?
 楼主| 发表于 2010-10-15 23:29:48 | 显示全部楼层
回复 8# 3mile


    打印时可以实现的,我只是需要打印变量,模板是可以随意修改的
发表于 2010-10-16 09:13:53 | 显示全部楼层
$i_Item 参数设置为3行不行
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-19 14:49 , Processed in 0.081929 second(s), 25 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表