Aspose.Words for .NET使用教程(四):渲染和打印及文档内容功能

Aspose.Words无需Microsoft Word也可在任何平台上满足Word文档的一切操作需求。本文将以表格的形式与大家分享Aspose.Words for .NET的渲染和打印及文档内容功能。

下表总结并比较了Aspose.Words for .NET的功能可用性。欢迎收藏~

渲染和打印


Aspose.Words提供文档页面的高保真渲染。

功能.NET.NET Standard 2.0Xamarin.AndroidXamarin.iOSXamarin.Mac
将文档布局到具有高保真度的页面(与MicrosoftWord®完全相同)可以使用以下所有格式。
将单个页面或完整文档渲染为PDF,XPS或SWF。
将文档页面呈现为BMP图像。xxx
将文档页面渲染为图像(PNG,EMF,JPEG,GIF)。
将单个形状从文档渲染为栅格或矢量图像。
指定图像分辨率,质量,压缩和其他选项。
使用变换将页面或形状渲染到具有特定大小的.NET Graphics对象。
使用.NET打印基础结构打印文档页面。xxxx
在渲染或打印之前更新TOC,页码和其他字段。

文档内容功能


Aspose.Words提供了一个由100多个公共类组成的丰富对象模型,它允许你以编程方式生成,组合,修改,解析或以其他方式检查加载的文档。

功能.NET.NET Standard 2.0Xamarin.AndroidXamarin.iOSXamarin.Mac
访问,创建,修改段落和文本。
访问,创建,修改图像,文本框和形状。
访问,创建,修改表,行和单元格。
访问,创建,修改字段,表单字段,超链接和书签。
访问,创建,修改文档部分,页眉和页脚。
访问,创建,修改脚注,尾注和注释。
访问,创建,修改自定义XML,智能标签和结构化文档标签(内容控件)。
使用类似XmlDocument的类和方法访问和修改所有文档元素。
更新字段结果IF,公式和其他流行字段类型。
重建和更新目录(TOC)字段与Microsoft Word完全相同。
在文档之间复制和移动文档元素。
加入并拆分文档。
获取并设置内置和自定义文档属性。
加入并拆分文档。
指定文档保护,打开受保护和加密的文档。
查找和替换文本,枚举文档内容。
接受文档中的所有修改。
从文档中保留或提取OLE对象和ActiveX控件。
从文档中保留或删除VBA宏。保留VBA宏数字签名。
检测并验证文档中的数字签名。
插入HTML文本。

本文分享到此结束,下一次将与大家分享Aspose.Words for .NET的文档格式功能,邮件合并功能及报告功能,敬请期待~

                                                           为你推荐:Aspose专题 - Aspose最新资源合集

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
首先机子上安装有office,在COM中添加引用Microsoft.Word.11.0.Object.Library(或11.0以上) Microsoft.Office.Interop.Word.Application myWordApp = null; Microsoft.Office.Interop.Word.Document doc = null; object Filename = path + "\\" + TaskID + ".docx";//目的文件 object templateFile = System.Windows.Forms.Application.StartupPath + @"\Template.docx";//模板文件,有一个五列一行的表 System.IO.File.Copy(templateFile.ToString(), Filename.ToString(), true);//模板WORD中有一个五列的表头,分别是卡号,串口号,发送指令条数,接收指令条数,收发成功率 myWordApp = new Microsoft.Office.Interop.Word.Application(); doc = myWordApp.Documents.Open(ref Filename, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing); /////显示页码 object oAlignment = Microsoft.Office.Interop.Word.WdPageNumberAlignment.wdAlignPageNumberCenter; object oFirstPage = true; oAlignment = Microsoft.Office.Interop.Word.WdPageNumberAlignment.wdAlignPageNumberCenter; myWordApp.Selection.Sections[1].Footers[Microsoft.Office.Interop.Word.WdHeaderFooterIndex.wdHeaderFooterPrimary].PageNumbers.Add(ref oAlignment, ref oFirstPage); myWordApp.Selection.Sections[1].Footers[Microsoft.Office.Interop.Word.WdHeaderFooterIndex.wdHeaderFooterPrimary].PageNumbers.NumberStyle = Microsoft.Office.Interop.Word.WdPageNumberStyle.wdPageNumberStyleNumberInDash; for (int i = 2; i < 102; i++)//举例100台 { doc.Tables[1].Rows.Add(ref Nothing);//表格增加一行 doc.Tables[1].Cell(i, 1).Range.Text = "250297";//卡号 doc.Tables[1].Cell(i, 2).Range.Text = "COM12";//串口号 doc.Tables[1].Cell(i, 3).Range.Text = "100";//发送指令条数 doc.Tables[1].Cell(i, 4).Range.Text = "99";//接收指令条数 doc.Tables[1].Cell(i, 5).Range.Text = "99%";//收发成功率 } doc.SaveAs(ref Filename, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing); object savechanges = Microsoft.Office.Interop.Word.WdSaveOptions.wdDoNotSaveChanges;//不保存挂起的更改 ////下面是直接打印文档不显示 //doc.PrintOut(ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing); object readOnly=false; object isVisable = true;////文档打开状态为可视 doc = myWordApp.Documents.Open(ref Filename, ref Nothing, ref readOnly, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref isVisable, ref Nothing, ref Nothing, ref Nothing, ref Nothing); doc.PrintPreview();//打印预览
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值