隨著.NET版Aspose.Words for .Net v20.5的發(fā)布,Java版也隨之更新,除了一些通用功能外,也獨有新改善。
主要特點如下:
-
提供顯示/隱藏語法和拼寫錯誤的功能。
-
引入了可在文檔內(nèi)部使用水印的新幫助程序類。
-
添加了為OOXML文檔設(shè)置壓縮級別的功能。
-
增強了將半破碎的MHTML文件轉(zhuǎn)換為PDF的彈性。
>>你可以點擊這里下載Aspose.Words for Java v20.5測試體驗
具體更新內(nèi)容
key
|
概述
|
類別
|
WORDSNET-10403
|
向“僅隱藏本文檔中的拼寫錯誤”添加功能
|
新功能
|
WORDSNET-4879
|
添加輔助方法以將水印插入標(biāo)頭
|
新功能
|
WORDSNET-10404
|
將功能添加到“僅隱藏本文檔中的語法錯誤”
|
新功能
|
WORDSNET-20094
|
添加和選項以刪除重復(fù)樣式到Document.Cleanup功能
|
新功能
|
WORDSNET-20169
|
Aspose.Words為DOCX寫入錯誤的字節(jié)
|
新功能
|
WORDSJAVA-1587
|
Aspose Words 17.5提供不正確的翻譯
|
Bug修復(fù)
|
WORDSJAVA-1604
|
段落行顯示在輸出PDF的上一頁
|
Bug修復(fù)
|
WORDSJAVA-2333
|
Document.getPageCount拋出JDK 1.8(32位)的java.lang.IllegalStateException
|
Bug修復(fù)
|
WORDSJAVA-2346
|
在MHTML到PDF的轉(zhuǎn)換中,引發(fā)了ArrayIndexOutOfBoundsException
|
Bug修復(fù)
|
WORDSJAVA-2348
|
在MHTML到PDF的轉(zhuǎn)換中,拋出IllegalStateException
|
Bug修復(fù)
|
WORDSJAVA-2349
|
在MHTML到PDF的轉(zhuǎn)換中,拋出了NegativeArraySizeException
|
Bug修復(fù)
|
WORDSJAVA-2350
|
在MHTML到PDF的轉(zhuǎn)換上,已引發(fā)NullPointerException
|
Bug修復(fù)
|
WORDSJAVA-2352
|
在MHTML到PDF的轉(zhuǎn)換上,引發(fā)了“ OutOfMemoryError請求的數(shù)組大小超過VM”限制
|
Bug修復(fù)
|
WORDSJAVA-2354
|
在MHTML到PDF的轉(zhuǎn)換中,拋出了UnsupportedOperationException
|
Bug修復(fù)
|
WORDSJAVA-2371
|
UpdateFields功能創(chuàng)建名稱的錯誤順序。
|
Bug修復(fù)
|
WORDSJAVA-2375
|
RTF到TIFF轉(zhuǎn)換后,黑白黑白圖像被反轉(zhuǎn)。
|
Bug修復(fù)
|
WORDSJAVA-2376
|
ChartDataLabelCollection中的標(biāo)簽計數(shù)錯誤。
|
Bug修復(fù)
|
WORDSJAVA-2378
|
在JDK 1.6中使用Aspose.Words.Shaping.Harfbuzz插件時,代碼將引發(fā)異常
|
Bug修復(fù)
|
WORDSJAVA-2379
|
實現(xiàn)平臺無關(guān)的StringList,以從生產(chǎn)中刪除到org.hsqldb。*的鏈接。
|
Bug修復(fù)
|
WORDSJAVA-2383
|
Java整理器的規(guī)則與.NET的規(guī)則不匹配
|
Bug修復(fù)
|
公共API更改
①添加了新的公共屬性O(shè)oxmlSaveOptions.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格式的嵌入字體轉(zhuǎn)換為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)
③引入了可在文檔內(nèi)部使用水印的新幫助程序類
新屬性“水印”已添加到Document類。
///
/// Provides access to the document watermark.
///
publicWatermark Watermark {get; }
新的Watermark類允許從文檔中添加/刪除水印。可以從文本或圖像創(chuàng)建水印。
///
/// 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; }
}
提供了新的枚舉,以確定文檔內(nèi)的水印類型。
///
/// 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
}
提供了新的枚舉,可將文本水印設(shè)置為對角或水平布局。
///
/// 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是目前國內(nèi)外非常火爆且功能強大的文件格式敏捷開發(fā)控件,但因為產(chǎn)品眾多、技術(shù)問題復(fù)雜等因素,也常常遭受開發(fā)人員吐槽。如果您也正在使用Aspose相關(guān)產(chǎn)品,點擊下方按鈕,來談?wù)凙spose的優(yōu)劣,您的感受對我們相當(dāng)寶貴哦~
標(biāo)簽:
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請郵件反饋至chenjj@fc6vip.cn