Aspose.Words for .Net是一种高级Word文档处理API,用于执行各种文档管理和操作任务。API支持生成,修改,转换,呈现和打印文档,而无需在跨平台应用程序中直接使用Microsoft Word。
令人兴奋的是,在3月开初,.NET版Aspose.Words迎来了2020第三次更新!新增了如下四大新功能亮点:
- Xamarin不再需要单独的DLL。
- FindReplaceOptions类扩展了新属性。
- 实现了“ Letterlike”符号的正确呈现。
- 支持在文本框范围内动态拉伸图像,从而为LINQ Reporting Engine保留图像的比例。
>>你可以下载Aspose.Words for .NET v20.3测试体验
具体更新内容
| key | 概述 | 类别 |
|---|---|---|
| WORDSNET-18362 | LINQ Reporting Engine-提供选项以使图像适合文本框范围,同时保持比例 | 新功能 |
| WORDSNET-19568 | 提供在IFieldMergingCallback.ImageFieldMerging内设置Shape的不同属性的功能 | 新功能 |
| WORDSNET-19912 | FindReplaceOptions的新属性 | 新功能 |
| WORDSNET-20012 | 实现侧面的颜色更改 | 新功能 |
| WORDSNET-3297 | 考虑添加通过书签获取表列的功能 | 新功能 |
| WORDSNET-19935 | 为体积形状实现正确的轮廓渲染 | 新功能 |
| WORDSNET-19469 | 从DOCX转换为PDF的图表中的轴,数据和图例标签丢失/错误/以不同的颜色显示 | 增强功能 |
| WORDSNET-19815 | 请勿将ODT图表转换为形状 | 增强功能 |
| WORDSNET-19998 | 为非凸形状实现正确的轮廓渲染 | 增强功能 |
公共API更改
添加了一个新的公共属性SaveOptions.UpdateLastPrintedProperty
用例
Document doc = new Document(docPath); SaveOptions saveOptions = new PdfSaveOptions(); saveOptions.UpdateLastPrintedProperty = false; doc.Save(pdfPath, saveOptions);
添加了ImageFieldMergingArgs.Shape属性
客户要求在合并图像合并字段(尤其是WrapType)时控制各种图像属性 。当前,只能 分别使用ImageFieldMergingArgs.ImageWidth 和 ImageFieldMergingArgs.ImageHeight属性设置图像的宽度或高度 。Aspose选择了一种更为通用的方法,并决定对插入的图像(或任何其他形状)提供完全控制。 ImageFieldMergingArgs.Shape 属性如下:
如摘要所示,此属性将覆盖其他属性,例如 ImageFileName 或 ImageStream ,即用户只需指定要插入的形状并设置所有必要的属性即可:
private class TestShapeSetFieldMergingCallback : IFieldMergingCallback
{
void IFieldMergingCallback.FieldMerging(FieldMergingArgs args)
{
// Implementation is not required.
}
void IFieldMergingCallback.ImageFieldMerging(ImageFieldMergingArgs args)
{
Shape shape = new Shape(args.Document);
shape.Width = 1000;
shape.Height = 2000;
shape.WrapType = WrapType.Square;
string imageFileName = "image.png";
shape.ImageData.SetImage(imageFileName);
args.Shape = shape;
}
}
FindReplaceOptions类扩展了新属性
用例1:说明如何忽略删除修订中的文本
// Create new document.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Insert non-revised text.
builder.Writeln("Deleted");
builder.Write("Text");
// Remove first paragraph with tracking revisions.
doc.StartTrackRevisions("author", DateTime.Now);
doc.FirstSection.Body.FirstParagraph.Remove();
doc.StopTrackRevisions();
Regex regex = new Regex("e");
FindReplaceOptions options = new FindReplaceOptions();
// Replace 'e' in document ignoring deleted text.
options.IgnoreDeleted = true;
doc.Range.Replace(regex, "*", options);
Console.WriteLine(doc.GetText()); // The output is: Deleted\rT*xt\f
// Replace 'e' in document NOT ignoring deleted text.
options.IgnoreDeleted = false;
doc.Range.Replace(regex, "*", options);
Console.WriteLine(doc.GetText()); // The output is: D*l*t*d\rT*xt\f
用例2:说明如何忽略插入修订中的文本
// Create new document.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Insert text with tracking revisions.
doc.StartTrackRevisions("author", DateTime.Now);
builder.Writeln("Inserted");
doc.StopTrackRevisions();
// Insert non-revised text.
builder.Write("Text");
Regex regex = new Regex("e");
FindReplaceOptions options = new FindReplaceOptions();
// Replace 'e' in document ignoring inserted text.
options.IgnoreInserted = true;
doc.Range.Replace(regex, "*", options);
Console.WriteLine(doc.GetText()); // The output is: Inserted\rT*xt\f
// Replace 'e' in document NOT ignoring inserted text.
options.IgnoreInserted = false;
doc.Range.Replace(regex, "*", options);
Console.WriteLine(doc.GetText()); // The output is: Ins*rt*d\rT*xt\f
用例3:说明如何忽略字段内的文本
// Create document.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Insert field with text inside.
builder.InsertField("INCLUDETEXT", "Text in field");
Regex regex = new Regex("e");
FindReplaceOptions options = new FindReplaceOptions();
// Replace 'e' in document ignoring text inside field.
options.IgnoreFields = true;
doc.Range.Replace(regex, "*", options);
Console.WriteLine(doc.GetText()); // The output is: \u0013INCLUDETEXT\u0014Text in field\u0015\f
// Replace 'e' in document NOT ignoring text inside field.
options.IgnoreFields = false;
doc.Range.Replace(regex, "*", options);
Console.WriteLine(doc.GetText()); // The output is: \u0013INCLUDETEXT\u0014T*xt in fi*ld\u0015\f
Xamarin不再需要单独的DLL
从Aspose.Words 20.3开始,Xamarin支持已更改。在早期版本中,我们为Xamarin.Android,Xamarin.Mac和Xamarin.iOS提供了单独的DLL。现在Xamarin开发人员可以在所有提到的平台中使用Aspose.Words for .NET Standard。根据.NET Standard文档,用于.NET Standard 2.0的Aspose.Words可以与Xamarin.iOS 10.14或更高版本,Xamarin.Mac 3.8或更高版本以及Xamarin.Android 8.0或更高版本一起使用。

Aspose.Words for .NET 20.3版本发布,带来了新功能,包括Xamarin不再需要单独的DLL,FindReplaceOptions类的扩展,ImageFieldMergingArgs增加Shape属性,以及对Letterlike符号的正确呈现。这些更新将提升文档管理和处理的效率和灵活性。
1581

被折叠的 条评论
为什么被折叠?



