文档彩票走势图>>Aspose中文文档>>打印文件
打印文件
Aspose.Words是一种高级Word文档处理API,用于执行各种文档管理和操作任务。API支持生成,修改,转换,呈现和打印文档,而无需在跨平台应用程序中直接使用Microsoft Word。
Aspose API支持流行文件格式处理,并允许将各类文档导出或转换为固定布局文件格式和最常用的图像/多媒体格式。
VSTO
调用要打印的Document对象的PrintOut方法。以下代码示例打印活动的整个文档或任何当前活动页面:
this.Application.ActiveDocument.PrintOut(true, false, Word.WdPrintOutRange.wdPrintAllDocument, Item: Word.WdPrintOutItem.wdPrintDocumentContent, Copies: "1", Pages: "", PageType: Word.WdPrintOutPages.wdPrintAllPages, PrintToFile: false, Collate: true, ManualDuplexPrint: false); object copies = "1"; object pages = "1"; object range = Word.WdPrintOutRange.wdPrintCurrentPage; object items = Word.WdPrintOutItem.wdPrintDocumentContent; object pageType = Word.WdPrintOutPages.wdPrintAllPages; object oTrue = true; object oFalse = false; Word.Document document = this.Application.ActiveDocument; document.PrintOut( ref oTrue, ref oFalse, ref range, ref missing, ref missing, ref missing, ref items, ref copies, ref pages, ref pageType, ref oFalse, ref oTrue, ref missing, ref oFalse, ref missing, ref missing, ref missing, ref missing);
点击复制
下面是打印单个文档或特定文档的任何页面的代码示例:
string FileName = "YourFileName.docx"; Document doc = new Document(FileName); doc.Print(); PrinterSettings PrinterSettings = new PrinterSettings(); PrinterSettings.MinimumPage = 1; PrinterSettings.MaximumPage = doc.PageCount; PrinterSettings.FromPage = 1; PrinterSettings.ToPage = doc.PageCount; doc.Print(PrinterSettings);
点击复制
下载示例代码