我只會用 VBA
開啟 Word 新檔案
隨便錄個巨集
進入編輯巨集畫面
貼上以下程式碼
按 F5 執行
(游標要放在 Sub BatchPrintWordDocuments 那列)
Sub BatchPrintWordDocuments()
Dim objWordApplication As New Word.Application
Dim strFile As String
Dim strFolder As String
strFolder = InputBox("Enter the folder address", "Folder Address", "For example:E:\test word\test\")
strFile = Dir(strFolder & "*.doc*", vbNormal)
While strFile <> ""
With objWordApplication
.Documents.Open (strFolder & strFile)
.ActiveDocument.PrintOut Range:=wdPrintFromTo, From:="1", To:="2"
.ActiveDocument.Close
End With
strFile = Dir()
Wend
Set objWordApplication = Nothing
End Sub
參考資料來源的方法二
他可以選
在不然就先複製一份,之後把不要的內容刪掉,剩下你要的在印出來就好了~
我搜尋「word cli」
有看到這個專案 waylan/msword-cli
For example, to open a document, print two copies of pages 2, 3, 4, and 6 of that document, and then close the document, the following single command is all that is needed:
msw open somedoc.docx print --count 2 --pages "2-4, 6" close
PS. 因為我沒有 word 所以無法測試