打印word文档时,仅使用vb.net打印第一页



我有这个代码:

Dim objWordApp As New word.Application
            Dim objDoc As word.Document
            objWordApp.Documents.Open("c:integra-billingfinal" + wordfilename, False, True)
            objWordApp.Visible = False
            objDoc = objWordApp.ActiveDocument
            objWordApp.DisplayAlerts = word.WdAlertLevel.wdAlertsNone
            'now print the word document
            objWordApp.PrintOut()
            'now close it
            objWordApp.Documents.Close(word.WdSaveOptions.wdDoNotSaveChanges)
            objWordApp.Quit()
            objWordApp = Nothing

打开、打印和关闭word文档

我如何使它只打印单词文档的第一页

这可能会有所帮助:

http://msdn.microsoft.com/en-us/library/b9f0ke7y.aspx?cs-保存lang=1&cs lang=vb#code-snippet-2

有关打印当前页面的信息,请参阅VB示例,当前页面将是刚打开文档时的第一页。

最新更新