随着.NET版Aspose.Words for .Net v20.5的发布,Java版也随之更新,除了一些通用功能外,也独有新改善。
主要特点如下:
-
提供显示/隐藏语法和拼写错误的功能。
-
引入了可在文档内部使用水印的新帮助程序类。
-
添加了为OOXML文档设置压缩级别的功能。
-
增强了将半破碎的MHTML文件转换为PDF的弹性。
>>你可以点击这里下载Aspose.Words for Java v20.5测试体验
具体更新内容
key
|
概述
|
类别
|
WORDSNET-10403
|
向“仅隐藏本文档中的拼写错误”添加功能
|
新功能
|
WORDSNET-4879
|
添加辅助方法以将水印插入标头
|
新功能
|
WORDSNET-10404
|
将功能添加到“仅隐藏本文档中的语法错误”
|
新功能
|
WORDSNET-20094
|
添加和选项以删除重复样式到Document.Cleanup功能
|
新功能
|
WORDSNET-20169
|
Aspose.Words为DOCX写入错误的字节
|
新功能
|
WORDSJAVA-1587
|
Aspose Words 17.5提供不正确的翻译
|
Bug修复
|
WORDSJAVA-1604
|
段落行显示在输出PDF的上一页
|
Bug修复
|
WORDSJAVA-2333
|
Document.getPageCount抛出JDK 1.8(32位)的java.lang.IllegalStateException
|
Bug修复
|
WORDSJAVA-2346
|
在MHTML到PDF的转换中,引发了ArrayIndexOutOfBoundsException
|
Bug修复
|
WORDSJAVA-2348
|
在MHTML到PDF的转换中,抛出IllegalStateException
|
Bug修复
|
WORDSJAVA-2349
|
在MHTML到PDF的转换中,抛出了NegativeArraySizeException
|
Bug修复
|
WORDSJAVA-2350
|
在MHTML到PDF的转换上,已引发NullPointerException
|
Bug修复
|
WORDSJAVA-2352
|
在MHTML到PDF的转换上,引发了“ OutOfMemoryError请求的数组大小超过VM”限制
|
Bug修复
|
WORDSJAVA-2354
|
在MHTML到PDF的转换中,抛出了UnsupportedOperationException
|
Bug修复
|
WORDSJAVA-2371
|
UpdateFields功能创建名称的错误顺序。
|
Bug修复
|
WORDSJAVA-2375
|
RTF到TIFF转换后,黑白黑白图像被反转。
|
Bug修复
|
WORDSJAVA-2376
|
ChartDataLabelCollection中的标签计数错误。
|
Bug修复
|
WORDSJAVA-2378
|
在JDK 1.6中使用Aspose.Words.Shaping.Harfbuzz插件时,代码将引发异常
|
Bug修复
|
WORDSJAVA-2379
|
实现平台无关的StringList,以从生产中删除到org.hsqldb。*的链接。
|
Bug修复
|
WORDSJAVA-2383
|
Java整理器的规则与.NET的规则不匹配
|
Bug修复
|
公共API更改
①添加了新的公共属性OoxmlSaveOptions.CompressionLevel,指定压缩级别“SuperFast”以保存文档
///
/// Specifies the compression level used to save document.
///
publicCompressionLevel CompressionLevel
用例:说明如何指定压缩级别“ SuperFast”(由Microsoft Word使用)以保存文档。
Document doc = new Document("in.docx");
OoxmlSaveOptions so = new OoxmlSaveOptions(SaveFormat.Docx);
so.CompressionLevel = CompressionLevel.SuperFast;
doc.Save("out.docx", so);
②添加了新的公共方法FontInfo.GetEmbeddedFontAsOpenType(),将Embedded OpenType格式的嵌入字体转换为OpenType
///
/// Gets an embedded font file in OpenType format. Fonts in Embedded OpenType format are converted to OpenType.
///
/// Specifies the font style to retrieve.
/// Returns null if the specified font is not embedded.
publicbyte[] GetEmbeddedFontAsOpenType(EmbeddedFontStyle style)
③引入了可在文档内部使用水印的新帮助程序类
新属性“水印”已添加到Document类。
///
/// Provides access to the document watermark.
///
publicWatermark Watermark {get; }
新的Watermark类允许从文档中添加/删除水印。可以从文本或图像创建水印。
///
/// Represents class to work with document watermark.
///
publicsealedclassWatermark
{
///
/// Adds Text watermark into the document.
///
/// Text that displays as a watermark.
///
/// The text length should be in the range from 1 to 200 inclusive.
/// The text cannot be null or consist only of whitespaces.
///
///
/// Throws when the text length is out of range or the text consists only of whitespaces.
///
///
/// Throws when the text is null.
///
publicvoidSetText(stringtext)
///
/// Adds Text watermark into the document.
///
/// Text that displays as a watermark.
/// Defines additional options for the text watermark.
///
/// The text length should be in the range from 1 to 200 inclusive.
/// The text cannot be null or consist only of whitespaces.
///
///
/// Throws when the text length is out of range or the text consists only of whitespaces.
///
///
/// Throws when the text is null.
///
/// If options is null, the watermark will be set with default properties.
publicvoidSetText(stringtext, TextWatermarkOptions options)
///
/// Adds Image watermark into the document.
///
/// Image that displays as a watermark.
///
/// Throws when the image is null.
///
publicvoidSetImage(Image image)
///
/// Adds Image watermark into the document.
///
/// Image that displays as a watermark.
/// Defines additional options for the image watermark.
///
/// Throws when the image is null.
///
/// If options is null, the watermark will be set with default properties.
publicvoidSetImage(Image image, ImageWatermarkOptions options)
///
/// Removes watermark.
///
publicvoidRemove()
///
/// Returns watermark type.
///
publicWatermarkType Type {get; }
}
提供了新的枚举,以确定文档内的水印类型。
///
/// Specifies the watermark type.
///
publicenumWatermarkType
{
///
/// Indicates that the text will be used as a watermark.
///
Such a watermark corresponds to a WordArt object.
///
Text,
///
/// Indicates that the image will be used as a watermark.
///
Such a watermark corresponds to a shape with image.
///
Image,
///
/// Indicates watermark is no set.
///
None
}
提供了新的枚举,可将文本水印设置为对角或水平布局。
///
/// Defines layout of the watermark relative to the watermark center.
///
publicenumWatermarkLayout
{
///
/// Horizontal watermark layout. Corresponds to 0 degrees of rotation.
///
Horizontal = 0,
///
/// Diagonal watermark layout. Corresponds to 315 degrees of rotation.
///
Diagonal = 315
}
对于图像水印:
///
/// Contains options that can be specified when adding a watermark with image.
///
publicclassImageWatermarkOptions
{
///
/// Gets or sets the scale factor expressed as a fraction of the image. The default value is 0 - auto.
///
///
///
Valid values range from 0 to 65.5 inclusive.
///
Auto scale means that the watermark will be scaled to its max width and max height relative to
///
///
/// Throws when argument was out of the range of valid values.
///
publicdoubleScale {get;set; }
///
/// Gets or sets a boolean value which is responsible for washout effect of the watermark.
/// The default value istrue.
///
publicboolIsWashout {get;set; }
}
用例1:添加带有特定选项的文本水印
Document doc = new Document(pathFile);
TextWatermarkOptions options = new TextWatermarkOptions()
{
FontFamily = "Arial",
FontSize = 36,
Color = Color.Black,
Layout = WatermarkLayout.Horizontal,
IsSemitrasparent = false
};
doc.Watermark.SetText("Test", options);
用例2:使用特定选项添加图像水印
Document doc = new Document(pathFile);
ImageWatermarkOptions options = new ImageWatermarkOptions()
{
Scale = 5,
IsWashout = false
};
doc.Watermark.SetImage(Image.FromFile(filePath), options);
用例3:从文档中删除水印
Document doc = new Document(pathFile);
if (doc.Watermark.Type == WatermarkType.Text)
doc.Watermark.Remove();
④添加了新的公共属性Document.ShowGrammaticalErrors,显示语法错误
///
/// Specifies whether to display grammar errors in this document.
///
publicboolShowGrammaticalErrors
用例:说明如何显示语法错误
Document doc = new Document("in.doc");
doc.ShowGrammaticalErrors = true;
doc.Save("out.doc");
⑤添加了新的公共属性Document.ShowSpellingErrors,显示拼写错误
用例:说明如何显示拼写错误
Document doc = new Document("in.doc");
doc.ShowSpellingErrors = true;
doc.Save("out.doc");
Aspose是目前国内外非常火爆且功能强大的文件格式敏捷开发控件,但因为产品众多、技术问题复杂等因素,也常常遭受开发人员吐槽。如果您也正在使用Aspose相关产品,点击下方按钮,来谈谈Aspose的优劣,您的感受对我们相当宝贵哦~
标签:
本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@capbkgr.cn