开发者论坛

 找回密码
 注册 (请使用非IE浏览器)
查看: 5966|回复: 2

实现与.NET 5.0接轨,Aspose.Words v20.12

[复制链接]

0

精华

0

贡献

119

赞扬

帖子
24
软币
353
在线时间
21 小时
注册时间
2019-10-24
发表于 2020-12-8 14:18:34 | 显示全部楼层 |阅读模式
                                                                                                                                Aspose.Words for .Net是一种高级Word文档处理API,用于执行各种文档管理和操作任务。API支持生成,修改,转换,呈现和打印文档,而无需在跨平台应用程序中直接使用Microsoft Word。2020年最后一次更新来啦,.NET版Aspose.Words更新至v20.12新版本!
主要特点如下:
  • 验证了Aspose.Words for .NET Standard可在.NET 5.0中工作。
  • 增加了在保存文档时嵌入PostScript Fonts的功能。
  • 实现了条件评估扩展点。
  • 为LINQ Reporting Engine提供了一个从动态插入的文档中导入样式的选项。
>>你可以下载Aspose.Words for .NET v20.12测试。
具体更新内容
序号概要类别
WORDSNET-16895添加功能以使用DOM插入样式分隔符新功能
WORDSNET-20552LINQ Reporting Engine-提供一种从动态插入的文档中导入样式的方法新功能
WORDSNET-18827添加选项以在加载文档时执行内存优化新功能
WORDSNET-21432检查Aspose.Words for .NET Standard是否可与.NET 5.0一起使用新功能
WORDSNET-21102添加功能以将插入的SVG导出为媒体文件夹中的SVG新功能
WORDSNET-21441提供对常见的StructuredDocumentRangeStart属性的访问新功能
WORDSNET-11665宏更好的支持,包括读取/添加/删除/导入/编辑新功能
WORDSNET-18804应该考虑dataLabel extLst中的ManualLayout设置增强功能
WORDSNET-3863考虑公开FontAttr.SpecialHidden属性增强功能
WORDSNET-12430在转换的DOCX中未激活单词拼写检查器增强功能
WORDSNET-14063ODT到PDF的转换与表的呈现有关增强功能
新功能解析 ①添加了新的公共属性SaveOptions.AllowEmbeddingPostScriptFonts(WORDSNET-21120) 添加了一个新的公共属性SaveOptions.AllowEmbeddingPostScriptFonts:

用例:
const string testDir = "\\TestDir\\";Document doc = new Document();DocumentBuilder builder = new DocumentBuilder(doc); // Create some content that will use PostScript font.builder.Font.Name = "PostScriptFont";builder.Writeln("Some text with PostScript font."); // Load the font with PostScript to use in the document.FontSourceBase otf = new MemoryFontSource(File.ReadAllBytes(testDir + "PostScriptFont.otf"));FontSourceBase[] sources = new FontSourceBase[] {otf};doc.FontSettings = new FontSettings();doc.FontSettings.SetFontsSources(sources); // Embed TrueType fonts.doc.FontInfos.EmbedTrueTypeFonts = true;// Allow embedding PostScript fonts while embedding TrueType fonts.SaveOptions saveOptions = SaveOptions.CreateSaveOptions(SaveFormat.Docx);saveOptions.AllowEmbeddingPostScriptFonts = true; // Save document with embedded PostScript font.doc.Save(testDir + "out.docx", saveOptions); ②插入SVG图像时更改了DocumentBuilder.InsertImage行为 插入SVG时,我们更改了DocumentBuilder.InsertImage行为。较早的Aspose.Words将SVG插入为EMF图元文件,以使插入的图像保持在矢量表示中。现在,AW将SVG插入为带有svgBlip扩展名的PNG,其中包含原始SVG图像,就像MS Word一样。
用例1:SVG图像以svgBlip扩展名的PNG格式插入到文档中,其中包含原始矢量SVG图像表示形式。
Document doc = new Document();DocumentBuilder builder = new DocumentBuilder(doc);builder.InsertImage("test.svg");doc.Save("out.docx"); 用例2:像MS Word一样,SVG图像以PNG格式保存到输出文档。
Document doc = new Document();DocumentBuilder builder = new DocumentBuilder(doc);builder.InsertImage("test.svg");doc.Save("out.doc"); 用例3:使用OptimizeFor方法针对旧版本的MS Word优化了文档。SVG作为EMF图元文件插入文档中,以使图像保持矢量表示形式(旧的Aspose.Word行为)。
Document doc = new Document();doc.CompatibilityOptions.OptimizeFor(Settings.MsWordVersion.Word2003);DocumentBuilder builder = new DocumentBuilder(doc);builder.InsertImage("test.svg");doc.Save("out.doc"); ③实施条件评估扩展点 实现了条件评估的扩展点。这使用户可以对IF和COMPARE字段实施自定义评估。

用例:
public class ComparisonExpressionEvaluator : IComparisonExpressionEvaluator{        public ComparisonExpressionEvaluator(ComparisonEvaluationResult result)        {                mResult = result;        }         public ComparisonEvaluationResult Evaluate(Field field, ComparisonExpression expresion)        {                return mResult;        }         private readonly ComparisonEvaluationResult mResult;}ComparisonEvaluationResult result = new ComparisonEvaluationResult(true);ComparisonExpressionEvaluator evaluator = new ComparisonExpressionEvaluator(result); document.FieldOptions.ComparisonExpressionEvaluator = evaluator;
如果您有任何疑问或需求,请随时加入Aspose技术交流群(761297826),我们很高兴为您提供查询和咨询
                                       
                                    

评分

参与人数 1赞扬 +1 收起 理由
pevos + 1 赞一个

查看全部评分

回复

使用道具 举报

0

精华

148

贡献

475

赞扬

帖子
56
软币
993
在线时间
51 小时
注册时间
2019-10-29
发表于 2021-1-31 13:37:15 | 显示全部楼层
实现与.NET 5.0接轨
回复

使用道具 举报

0

精华

11

贡献

20

赞扬

帖子
6
软币
123
在线时间
3 小时
注册时间
2020-7-30
发表于 2021-1-31 23:10:16 | 显示全部楼层
这个新版还没用过,一直都是用的旧版版。
回复

使用道具 举报

Archiver|手机版|小黑屋|开发者网 ( 苏ICP备08004430号-2 )
版权所有:南京韵文教育信息咨询有限公司

GMT+8, 2024-4-26 07:49

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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