不知不觉已是春暖花开的4月,国内疫情也逐渐趋于平缓,各大企业已然复工。与此同时,Aspose.Words也迎来了4月的最新版更新!Aspose.Words for .Net是一种高级Word文档处理API,用于执行各种文档管理和操作任务。API支持生成,修改,转换,呈现和打印文档,而无需在跨平台应用程序中直接使用Microsoft Word。
主要特点如下:
- Aspose.Words为.NET 4.6.1提供DLL。与.NET Standard 2.0一样,它支持阅读PDF文档。
- 提供了更改亚洲段落间距和缩进的功能。
- 为PDF渲染添加了图像插值选项。
- 添加了新的模式3D形状渲染。
- 图表数据标签和系列的扩展API。
>>你可以点击这里下载Aspose.Words for .NET v20.4测试体验
具体更新内容
key | 概述 | 类别 |
---|---|---|
WORDSNET-15697 | 提供更改受密码保护的VBA代码(更改字符串)的功能 | 新功能 |
WORDSNET-20043 | 公布公开的CompareLevel(粒度)选项 | 新功能 |
WORDSNET-20001 | 提供API以获取针对中文特定段落格式的设置Word | 新功能 |
WORDSNET-19913 | Range.Replace替换 | 新功能 |
WORDSNET-19996 | 添加用于PDF渲染的图像插值选项 | 新功能 |
WORDSNET-19873 | 添加功能以设置/获取浮动表的位置(HorizontalAnchor和VerticalAnchor) | 新功能 |
WORDSNET-20080 | 支持带有复合重音符号的OTF(CFF)字体子集 | 新功能 |
WORDSNET-20146 | 实施ISO 29500特定BorderArt样式的渲染 | 新功能 |
WORDSNET-19747 | 添加功能以设置/获取段落属性“定义文档网格时对齐网格” | 新功能 |
WORDSNET-10548 | 锚固件靠近紧紧包裹的浮子时,浮子位置不正确 | 增强功能 |
WORDSNET-20042 | 检查RTF格式是否支持在块/单元/行级别放置注释 | 增强功能 |
公共API更改
①增加了更改亚洲段落间距和缩进的功能,添加了以下ParagraphFormat属性:
///
/// Gets or sets the left indent value (in characters) for the specified paragraphs.
///
publicintParagraphFormat.CharacterUnitLeftIndent {get;set; }
///
/// Gets or sets the right indent value (in characters) for the specified paragraphs.
///
publicintParagraphFormat.CharacterUnitRightIndent {get;set; }
///
/// Gets or sets the value (in characters) for the first-line or hanging indent.
///
Use positive values to set the first-line indent, and negative values to set the hanging indent.
///
publicintParagraphFormat.CharacterUnitFirstLineIndent {get;set; }
///
/// Gets or sets the amount of spacing (in gridlines) before the paragraphs.
///
publicintParagraphFormat.LineUnitBefore {get;set; }
///
/// Gets or sets the amount of spacing (in gridlines) after the paragraphs.
///
publicintParagraphFormat.LineUnitAfter {get;set; }
用例
请注意,设置单位的缩进和间距将更新适当的公共缩进或间距属性。例如,设置ParagraphFormat.CharacterUnitLeftIndent将更新ParagraphFormat.LeftIndent。
Document doc = new Document() ParagraphFormat format = doc.FirstSection.Body.FirsdtParagraph.ParagraphFormat; format.CharacterUnitLeftIndent = 10; // ParagraphFormat.LeftIndent will be updated format.CharacterUnitRightIndent = 10; // ParagraphFormat.RightIndent will be updated format.CharacterUnitFirstLineIndent = 20; // ParagraphFormat.FirstLineIndent will be updated format.LineUnitBefore = 5; // ParagraphFormat.SpaceBefore will be updated format.LineUnitAfter= 10; // ParagraphFormat.SpaceAfter will be updated
②添加了新模式的3D形状渲染,添加了新的公共属性SaveOptions.Dml3DEffectsRenderingMode :
///
/// Gets or sets a value determining how 3D effects are rendered.
///
///
/// The default value is.
///
publicDml3DEffectsRenderingMode Dml3DEffectsRenderingMode
{
get{returnmDml3DEffectsRenderingMode; }
set{ mDml3DEffectsRenderingMode = value; }
}
///
/// Specifies how 3D shape effects are rendered.
///
publicenumDml3DEffectsRenderingMode
{
///
/// A lightweight and stable rendering, based on the internal engine,
/// but advanced effects such as lighting, materials and other additional effects
/// are not displayed when using this mode.
/// Please see documentation for details.
///
Basic,
///
/// Rendering of an extended list of special effects including advanced 3D effects
/// such as bevels, lighting and materials.
///
///
/// The current implementation uses OpenGL.
/// Please make sure that OpenGL library version 1.1 or higher is installed on your system before use.
/// This mode is still under development, and some things may not be supported, so it's recommended to use
/// themode if the rendering result is not acceptable.
/// Please see documentation for details.
///
Advanced
}
用例
Document doc = new Document(docPath); SaveOptions saveOptions = new PdfSaveOptions(); saveOptions.Dml3DEffectsRenderingMode = Dml3DEffectsRenderingMode.Advanced; doc.Save(pdfPath, saveOptions);
③Font和ParagraphFormat添加了新的公共属性SnapToGrid
///
/// Specifies whether the current paragraph should use the document grid lines per page settings
/// when laying out the contents in the paragraph.
///
publicboolSnapToGrid
和Font.SnapToGrid:
///
/// Specifies whether the current run should use the document grid characters per line settings
/// when laying out the contents in this run.
///
publicboolSnapToGrid
用例
Document doc = new Document(docPath); Paragraph par = doc.FirstSection.Body.FirstParagraph; par.ParagraphFormat.SnapToGrid = true; par.FirstRun.Font.SnapToGrid = true;
来源:oschina
链接:https://my.oschina.net/u/4087915/blog/3223239