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

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

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

aspose word好用吗(aspose word 教程)

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

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 枚举值:

aspose word好用吗(aspose word 教程)

最有用的值是能够明确地确定你正在使用的分隔符类型的那种。这是真的,因为对于所有类型的分隔符,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 在计算重新开始页码的连续部分中的页码时的行为:

aspose word好用吗(aspose word 教程)

更改后,默认的 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 类:

aspose word好用吗(aspose word 教程)

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

aspose word好用吗(aspose word 教程)

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

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 并添加了相应的枚举:

aspose word好用吗(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 根元素生成对象的选项

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

具体更新内容

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

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

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

aspose word好用吗(aspose word 教程)

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

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 枚举值:

aspose word好用吗(aspose word 教程)

最有用的值是能够明确地确定你正在使用的分隔符类型的那种。这是真的,因为对于所有类型的分隔符,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 在计算重新开始页码的连续部分中的页码时的行为:

aspose word好用吗(aspose word 教程)

更改后,默认的 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 类:

aspose word好用吗(aspose word 教程)

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

aspose word好用吗(aspose word 教程)

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

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 并添加了相应的枚举:

aspose word好用吗(aspose word 教程)


秒鲨号所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈!本站将在三个工作日内改正。
(0)

大家都在看

品牌推广 在线咨询
返回顶部