知乐空间

aspose word好用吗

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

主要特点如下:

  • 实现了为图表系列、数据点和标记设置填充和描边格式的功能
  • 引入了用于处理纹理的新 API
  • 实现了 OOXML Ink(InkML 子集)的渲染
  • 引入了 TxtSaveOptions.MaxCharactersPerLine 属性
  • 添加了新的 Document.LayoutOption 以控制连续部分中的页码
  • 提供了始终为 LINQ 报告引擎的 JSON 或 XML 根元素生成对象的选项

具体更新内容

序号概括类别
WORDSNET-21647DOCX 转 PDF:发生内容置换新功能
WORDSNET-12748提供API更改图表类别系列颜色新功能
WORDSNET-13907支持渲染 DrawingML InkML ContentPart新功能
WORDSNET-12275添加功能以更改 ChartSeries 的颜色新功能
WORDSNET-21847未应用高级 OpenType 字体功能新功能
WORDSNET-21871添加功能以创建带线条的散点图新功能
WORDSNET-22070提供始终为 LINQ 报告引擎的 XML 根元素生成对象的选项新功能
WORDSNET-12529添加功能以获取/设置亚洲字符间距属性新功能
WORDSNET-22082storeItemChecksum 获取/设置方法新功能
WORDSNET-22002实现 Fill.PresetTextured() 方法新功能
WORDSNET-20023允许更改饼图颜色新功能
WORDSNET-21972提供始终为 LINQ 报告引擎的 JSON 根元素生成对象的选项新功能
WORDSNET-15201为带有脚注的连续部分实施 MS Word 2013 行为新功能
WORDSNET-17510Aspose.Words 不模仿 MS Word 的文档结构标签增强
WORDSNET-18186从 Word 到 PDF 的转换过程中丢失了墨迹注释增强
WORDSNET-20020转换后的 Word 文档的透明度未显示在 PDF 中增强
WORDSNET-12640添加设置/获取图表系列颜色的功能增强
WORDSNET-20462DOCX转PDF后手写内容丢失增强
WORDSNET-21156LayoutCollector 返回的值不正确增强
WORDSNET-19199带有免费手绘图像的 DOCX 到 PDF增强
WORDSNET-22090TXT 文件中的每一行都应该有一个固定长度的字符 | 行中允许的最大字符数增强
WORDSNET-21795DOCX 到 PDF/A 的转换和验证失败:标题内的单词/空格分隔问题增强

新功能解析

①在LayoutEnumerator类中为Kind属性添加了一个新的LayoutEntityType和新的值

公共枚举 LayoutEntityType 中添加了一个新值Note:

5分钟带你快速浏览Aspose.Words文档开发工具6月最新版本

这将帮助用户迭代脚注/尾注容器内的注释。用例如下:

Document doc = new Document("SomeDocument.docx")
LayoutEnumerator en = new LayoutEnumerator(doc);
 
// We start from the first page.
Debug.Assert(en.Type == LayoutEntityType.Page);
 
// Move to the first column on the page.
en.MoveFirstChild();
Debug.Assert(en.Type == LayoutEntityType.Column);
 
// Move to the first child in the column.
en.MoveFirstChild();
 
do
{
  // Iterate to a footnote container.
  if (en.Type == LayoutEntityType.Footnote)
   break;
}
while(en.MoveNext());
 
// If the footnote container exists in the column, we will process notes.
if (en.Type == LayoutEntityType.Footnote)
{
  // Move to the first note in the footnote container.
  if (en.MoveFirstChild())
  {
    do
    {
     // Move over notes inside the footnote container.
     Debug.Assert(en.Type == LayoutEntityType.Note);
     // Do something.
    }
    while (en.MoveNext());
   }
 }
}

LayoutEnumerator 类的新 Kind 枚举值 LayoutEnumerator 类添加了 8 个新的 Kind 枚举值:

5分钟带你快速浏览Aspose.Words文档开发工具6月最新版本

最有用的值是能够明确地确定你正在使用的分隔符类型的那种。这是真的,因为对于所有类型的分隔符,LayoutEntityType是
LayoutEntityType.NoteSeparator。用例:

Document doc = new Document("SomeDocument.docx")
LayoutEnumerator en = new LayoutEnumerator(doc);
 
// We start from the first page.
Debug.Assert(en.Type == LayoutEntityType.Page);
 
// Move to the first column on the page.
en.MoveFirstChild();
Debug.Assert(en.Type == LayoutEntityType.Column);
 
// Move to the first child in the column.
en.MoveFirstChild();
 
do
{
   if (en.Type == LayoutEntityType.NoteSeparator && en.Kind == "FOOTNOTESEPARATOR")
   {
      // Do something.
   }
 
   if (en.Type == LayoutEntityType.NoteSeparator && en.Kind == "FOOTNOTECONTINUATIONSEPARATOR")
   {
      // Do something.
   }
 
   if (en.Type == LayoutEntityType.NoteSeparator && en.Kind == "FOOTNOTECONTINUATIONNOTICE")
   {
      // Do something.
   }
}
while(en.MoveNext());
}

②添加了新的 Document.LayoutOption 以控制连续部分中的页码

添加了一个新的布局选项来控制 Aspose.Words 在计算重新开始页码的连续部分中的页码时的行为:

5分钟带你快速浏览Aspose.Words文档开发工具6月最新版本

更改后,默认的 Aspose.Words 行为与当前的 MS Word 版本 (2019) 匹配。根据 WORDSNET-17760 实现的旧行为仍然可以通过引入的选项获得:

Document doc = new Document("input.docx");
doc.LayoutOptions.ContinuousSectionPageNumberingRestart = ContinuosSectionRestart.FromNewPageOnly;
doc.Save("out.pdf");

③实现了为图表系列、数据点和标记设置填充和描边格式的能力

新 ChartFormat 类型的属性已添加到 ChartSeries、ChartDataPoint 和 ChartMarker 类:

5分钟带你快速浏览Aspose.Words文档开发工具6月最新版本

此外,一些现有属性的别名已添加到 Stroke 类:ForeColor、BackColor、Visible 和 Transparency。原始的 Color、Color2、On 和 Opacity 属性将在 Aspose.Words 的未来版本中过时。

5分钟带你快速浏览Aspose.Words文档开发工具6月最新版本

用例:解释如何设置系列颜色

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
 
Shape shape = builder.InsertChart(ChartType.Column, 432, 252);
 
Chart chart = shape.Chart;
ChartSeriesCollection seriesColl = chart.Series;
 
// Delete default generated series.
seriesColl.Clear();
 
// Create category names array.
string[] categories = new string[] { "AW Category 1", "AW Category 2" };
 
// Adding new series. Value and category arrays must be the same size.
ChartSeries series1 = seriesColl.Add("AW Series 1", categories, new double[] { 1, 2 });
ChartSeries series2 = seriesColl.Add("AW Series 2", categories, new double[] { 3, 4 });
ChartSeries series3 = seriesColl.Add("AW Series 3", categories, new double[] { 5, 6 });
 
// Set series color.
series1.Format.Fill.ForeColor = Color.Red;
series2.Format.Fill.ForeColor = Color.Yellow;
series3.Format.Fill.ForeColor = Color.Blue;
 
doc.Save("ColumnColor.docx");

④实现 OOXML Ink(InkML 子集)的渲染

OOXML Ink 内容由 Ink 标记语言的语法和语义子集指定。在此版本之前,Aspose.Words 只能为 OOXML Ink 对象渲染后备形状,即实际上并未处理 InkML,而是使用简单的预渲染图像。现在可以直接渲染 OOXML 墨迹内容部分(“冷”渲染)。

为了控制 Ink 渲染的模式,引入了一个新的公共属性
SaveOptions.ImlRenderingMode 并添加了相应的枚举:

5分钟带你快速浏览Aspose.Words文档开发工具6月最新版本

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

主要特点如下:

  • 实现了为图表系列、数据点和标记设置填充和描边格式的功能
  • 引入了用于处理纹理的新 API
  • 实现了 OOXML Ink(InkML 子集)的渲染
  • 引入了 TxtSaveOptions.MaxCharactersPerLine 属性
  • 添加了新的 Document.LayoutOption 以控制连续部分中的页码
  • 提供了始终为 LINQ 报告引擎的 JSON 或 XML 根元素生成对象的选项

>>你可以点击文末“了解更多”下载Aspose.Words for .NET v21.6测试体验。

具体更新内容

序号概括类别
WORDSNET-21647DOCX 转 PDF:发生内容置换新功能
WORDSNET-12748提供API更改图表类别系列颜色新功能
WORDSNET-13907支持渲染 DrawingML InkML ContentPart新功能
WORDSNET-12275添加功能以更改 ChartSeries 的颜色新功能
WORDSNET-21847未应用高级 OpenType 字体功能新功能
WORDSNET-21871添加功能以创建带线条的散点图新功能
WORDSNET-22070提供始终为 LINQ 报告引擎的 XML 根元素生成对象的选项新功能
WORDSNET-12529添加功能以获取/设置亚洲字符间距属性新功能
WORDSNET-22082storeItemChecksum 获取/设置方法新功能
WORDSNET-22002实现 Fill.PresetTextured() 方法新功能
WORDSNET-20023允许更改饼图颜色新功能
WORDSNET-21972提供始终为 LINQ 报告引擎的 JSON 根元素生成对象的选项新功能
WORDSNET-15201为带有脚注的连续部分实施 MS Word 2013 行为新功能
WORDSNET-17510Aspose.Words 不模仿 MS Word 的文档结构标签增强
WORDSNET-18186从 Word 到 PDF 的转换过程中丢失了墨迹注释增强
WORDSNET-20020转换后的 Word 文档的透明度未显示在 PDF 中增强
WORDSNET-12640添加设置/获取图表系列颜色的功能增强
WORDSNET-20462DOCX转PDF后手写内容丢失增强
WORDSNET-21156LayoutCollector 返回的值不正确增强
WORDSNET-19199带有免费手绘图像的 DOCX 到 PDF增强
WORDSNET-22090TXT 文件中的每一行都应该有一个固定长度的字符 | 行中允许的最大字符数增强
WORDSNET-21795DOCX 到 PDF/A 的转换和验证失败:标题内的单词/空格分隔问题增强

新功能解析

①在LayoutEnumerator类中为Kind属性添加了一个新的LayoutEntityType和新的值

公共枚举 LayoutEntityType 中添加了一个新值Note:

5分钟带你快速浏览Aspose.Words文档开发工具6月最新版本

这将帮助用户迭代脚注/尾注容器内的注释。用例如下:

Document doc = new Document("SomeDocument.docx")
LayoutEnumerator en = new LayoutEnumerator(doc);
 
// We start from the first page.
Debug.Assert(en.Type == LayoutEntityType.Page);
 
// Move to the first column on the page.
en.MoveFirstChild();
Debug.Assert(en.Type == LayoutEntityType.Column);
 
// Move to the first child in the column.
en.MoveFirstChild();
 
do
{
  // Iterate to a footnote container.
  if (en.Type == LayoutEntityType.Footnote)
   break;
}
while(en.MoveNext());
 
// If the footnote container exists in the column, we will process notes.
if (en.Type == LayoutEntityType.Footnote)
{
  // Move to the first note in the footnote container.
  if (en.MoveFirstChild())
  {
    do
    {
     // Move over notes inside the footnote container.
     Debug.Assert(en.Type == LayoutEntityType.Note);
     // Do something.
    }
    while (en.MoveNext());
   }
 }
}

LayoutEnumerator 类的新 Kind 枚举值 LayoutEnumerator 类添加了 8 个新的 Kind 枚举值:

5分钟带你快速浏览Aspose.Words文档开发工具6月最新版本

最有用的值是能够明确地确定你正在使用的分隔符类型的那种。这是真的,因为对于所有类型的分隔符,LayoutEntityType是
LayoutEntityType.NoteSeparator。用例:

Document doc = new Document("SomeDocument.docx")
LayoutEnumerator en = new LayoutEnumerator(doc);
 
// We start from the first page.
Debug.Assert(en.Type == LayoutEntityType.Page);
 
// Move to the first column on the page.
en.MoveFirstChild();
Debug.Assert(en.Type == LayoutEntityType.Column);
 
// Move to the first child in the column.
en.MoveFirstChild();
 
do
{
   if (en.Type == LayoutEntityType.NoteSeparator && en.Kind == "FOOTNOTESEPARATOR")
   {
      // Do something.
   }
 
   if (en.Type == LayoutEntityType.NoteSeparator && en.Kind == "FOOTNOTECONTINUATIONSEPARATOR")
   {
      // Do something.
   }
 
   if (en.Type == LayoutEntityType.NoteSeparator && en.Kind == "FOOTNOTECONTINUATIONNOTICE")
   {
      // Do something.
   }
}
while(en.MoveNext());
}

②添加了新的 Document.LayoutOption 以控制连续部分中的页码

添加了一个新的布局选项来控制 Aspose.Words 在计算重新开始页码的连续部分中的页码时的行为:

5分钟带你快速浏览Aspose.Words文档开发工具6月最新版本

更改后,默认的 Aspose.Words 行为与当前的 MS Word 版本 (2019) 匹配。根据 WORDSNET-17760 实现的旧行为仍然可以通过引入的选项获得:

Document doc = new Document("input.docx");
doc.LayoutOptions.ContinuousSectionPageNumberingRestart = ContinuosSectionRestart.FromNewPageOnly;
doc.Save("out.pdf");

③实现了为图表系列、数据点和标记设置填充和描边格式的能力

新 ChartFormat 类型的属性已添加到 ChartSeries、ChartDataPoint 和 ChartMarker 类:

5分钟带你快速浏览Aspose.Words文档开发工具6月最新版本

此外,一些现有属性的别名已添加到 Stroke 类:ForeColor、BackColor、Visible 和 Transparency。原始的 Color、Color2、On 和 Opacity 属性将在 Aspose.Words 的未来版本中过时。

5分钟带你快速浏览Aspose.Words文档开发工具6月最新版本

用例:解释如何设置系列颜色

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
 
Shape shape = builder.InsertChart(ChartType.Column, 432, 252);
 
Chart chart = shape.Chart;
ChartSeriesCollection seriesColl = chart.Series;
 
// Delete default generated series.
seriesColl.Clear();
 
// Create category names array.
string[] categories = new string[] { "AW Category 1", "AW Category 2" };
 
// Adding new series. Value and category arrays must be the same size.
ChartSeries series1 = seriesColl.Add("AW Series 1", categories, new double[] { 1, 2 });
ChartSeries series2 = seriesColl.Add("AW Series 2", categories, new double[] { 3, 4 });
ChartSeries series3 = seriesColl.Add("AW Series 3", categories, new double[] { 5, 6 });
 
// Set series color.
series1.Format.Fill.ForeColor = Color.Red;
series2.Format.Fill.ForeColor = Color.Yellow;
series3.Format.Fill.ForeColor = Color.Blue;
 
doc.Save("ColumnColor.docx");

④实现 OOXML Ink(InkML 子集)的渲染

OOXML Ink 内容由 Ink 标记语言的语法和语义子集指定。在此版本之前,Aspose.Words 只能为 OOXML Ink 对象渲染后备形状,即实际上并未处理 InkML,而是使用简单的预渲染图像。现在可以直接渲染 OOXML 墨迹内容部分(“冷”渲染)。

为了控制 Ink 渲染的模式,引入了一个新的公共属性
SaveOptions.ImlRenderingMode 并添加了相应的枚举:

5分钟带你快速浏览Aspose.Words文档开发工具6月最新版本

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,请发送邮件至 ZLME@ZLME.COM 举报,一经查实,立刻删除。

留言与评论(共有 0 条评论)
验证码: