开发者论坛

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

Aspose.Words v20.1更新

[复制链接]

0

精华

0

贡献

119

赞扬

帖子
24
软币
353
在线时间
21 小时
注册时间
2019-10-24
发表于 2021-1-6 13:40:14 | 显示全部楼层 |阅读模式
本帖最后由 mnrssj 于 2021-1-12 10:34 编辑

Aspose.Words for .Net是一种高级Word文档处理API,用于执行各种文档管理和操作任务。API支持生成,修改,转换,呈现和打印文档,而无需在跨平台应用程序中直接使用Microsoft Word。2021年第一版更新来啦,.NET版Aspose.Words更新至v21.1新版本!

主要特点如下:  

  • 在DocumentBuilder类中引入了StartColumnBookmark和EndColumnBookmark方法。
  • 添加MarkdownSaveOptions.ImageSavingCallback以控制在转换为Markdown格式后如何保存图像。
  • 添加了在加载HTML时忽略HTML元素的功能。
  • TableStyle.VerticalAlignment已公开。

>>你可以点击这里下载Aspose.Words for .NET v21.1测试。 Aspose.Words for java下载这里

        具体更新内容
概要
类别
                                WORDSNET-4987                                                        支持OOXML SmartArt(图表)的“冷”渲染                                                        新功能                        
                                WORDSNET-20666                                                        添加功能以创建移动修订                                                        新功能                        
                                WORDSNET-21389                                                        将IImageSavingCallback添加到MarkdownSaveOptions中                                                        新功能                        
                                WORDSNET-17026                                                        LINQ Reporting  Engine-支持部分打破了数据带和条件块的内部                                                        新功能                        
                                WORDSNET-20367                                                        向Node类添加字段,以便用户可以在Aspose.Words文档模型中存储一些自定义元数据                                                        新功能                        
                                WORDSNET-18882                                                        添加功能以将表的列添加为书签                                                        新功能                        
                                WORDSNET-21114                                                        添加功能以使用TableStyle获取或设置单元格垂直对齐方式                                                        新功能                        
                                WORDSNET-21426                                                        MS Word应自动选择插入的OLE对象的默认图标                                                        增强功能                        
                                WORDSNET-21576                                                        将LastChild属性和AppendChild()方法添加到StructuredDocumentRangeStart类                                                        增强功能                        
                                WORDSNET-21433                                                        改进URI处理以处理相对超链接                                                        增强功能                        
                                WORDSNET-21493                                                        在父子层次结构中将Word转换为JSON                                                        增强功能                        
        新功能解析         

①WORDSNET-21203:添加了新的公共属性Node.CustomNodeId:

客户现在可以跟踪模型树中的节点位置,并根据分配的标识符绑定外部数据,用例如下:

[C#] 纯文本查看 复制代码
DocumentBuilder builder = new DocumentBuilder();Shape shape = builder.InsertShape(ShapeType.Rectangle, 100, 100);shape.CustomNodeId = 100;     

②WORDSNET-21114:添加了新的公共属性TableStyle.VerticalAlignment

该选项允许设置表格样式单元格的垂直对齐方式,用例如下:

[C#] 纯文本查看 复制代码
Document doc = TestUtil.Open(fileName);TableStyle style = (TableStyle)doc.Styles\["Custom Table 1"\];style.VerticalAlignment = CellVerticalAlignment.Center;    

③WORDSNET-21389:添加MarkdownSaveOptions.ImageSavingCallback

        说明将文档保存为Markdown格式时如何使用“ MarkdownSaveOptions.ImageSavingCallback”

[C#] 纯文本查看 复制代码
public void HandleDocument(){    const string outFileName = "SavingCallback.DocumentParts.Rendering.md";     // Open a document to be converted to Markdown.    Document doc = new Document("C:\\Rendering.docx");     // We can use an appropriate SaveOptions subclass to customize the conversion process.    MarkdownSaveOptions options = new MarkdownSaveOptions();     // If we convert a document that contains images into Markdown, we will end up with one Markdown file which links to several images.    // Each image will be in the form of a file in the local file system.    // There is also a callback that can customize the name and file system location of each image.    options.ImageSavingCallback = new SavedImageRename(outFileName);     // The ImageSaving() method of our callback will be run at this time.    doc.Save($"C:\\{outFileName}", options);}/// <summary>/// Renames saved images that are produced when an Markdown document is saved./// </summary>public class SavedImageRename : IImageSavingCallback{    public SavedImageRename(string outFileName)    {        mOutFileName = outFileName;    }     void IImageSavingCallback.ImageSaving(ImageSavingArgs args)    {        string imageFileName = $"{mOutFileName} shape {++mCount}, of type {args.CurrentShape.ShapeType}{Path.GetExtension(args.ImageFileName)}";         args.ImageFileName = imageFileName;        args.ImageStream = new FileStream($"C:\\{imageFileName}", FileMode.Create);         Assert.True(args.ImageStream.CanWrite);        Assert.True(args.IsImageAvailable);        Assert.False(args.KeepImageStreamOpen);    }     private int mCount;    private readonly string mOutFileName;}

如果您有任何疑问或需求,请随时加入Aspose技术交流群(761297826),我们很高兴为您提供查询和咨询

回复

使用道具 举报

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

GMT+8, 2024-3-28 17:24

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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