Browse our Products

Aspose.Words for Java 19.5 Release Notes

Major Features

  • Jdk1.6 build option is added for customers that request it.
  • Docx-to-Pdf Performance optimization: cold start time decreased from 20% to 3 times depending on the application.
  • Docx-to-Pdf Performance optimization: warm tests time improved from 2 to 10 times depending on the application.
  • Mailmerge performance is raised up to 50% for tasks of particular types.
  • Removed obsolete properties and methods related to font substitution settings in FontSettings class.
  • Implemented StreamFontSource class which allows loading fonts from a stream.
  • Implemented TOC to logical structure export when rendering PDF.
  • Implemented proper rendering of embedded fonts in PDF when different font subsets have the same internal name.
  • Text in the format “x….” in the string values of the series category of DrawingML chart is now rendered as a string corresponding to the specified character code.
  • Improved rendering of metafiles to XPS.
  • Fixed a bug that caused an exception when rendering complex gradient fills to PDF.
  • Fixed a bug causing the loss of shapes if 3D effects and the Soft Edge effect were applied at the same time when rendering.
  • Fixed a bug with exception when rendering DrawingML chart with grid lines.

Full List of Issues Covering all Changes in this Release

KeySummaryCategory
WORDSNET-14297Provide a method to check if particular Dml text effect is appliedNew Feature
WORDSNET-16739Provide StreamFontSource similar to the FileFontSourceNew Feature
WORDSNET-16734Add feature to get font leading/metrics of Run nodeNew Feature
WORDSNET-18436Provide API to identify Style Separator ParagraphNew Feature
WORDSNET-17843Generate <TOC> tags for Table of contents in PDFNew Feature
WORDSNET-18440Add new 3D parameters to ExtrusionParameters and their processingNew Feature
WORDSJAVA-1866Run out of Java Heap Space while saving an image with a mismatched number of color components to Pdf.Bug
WORDSJAVA-2010The time consumption in conversion DOCX to PDFBug
WORDSJAVA-2012The time consumption for mail mergeBug
WORDSJAVA-2039Missed ImageBytes in WML document with corrupted base64 String.Bug
WORDSJAVA-2059Aspose.Words for Java 19.3 and JDK 1.6 throws an exceptionBug
WORDSJAVA-2063Table/Image in header disappears and Textbox partially visible in converted DOCXBug
WORDSJAVA-2079Aspose.Words 19.4  OutputStream object is empty after signing .doc file.Bug
WORDSJAVA-2080Fail to load Word 6 or Word 95 format when DOC_PRE_WORD_60 is used as an argument.Bug
WORDSNET-11952Performance issue while converting Html to PdfBug
WORDSNET-18097A picture in XML occasionally renders as Red Cross in PDFBug
WORDSNET-13463Start number of list level is changed after joining RTF filesBug
WORDSNET-18332Chart x-scale has font problem in PDFBug
WORDSNET-18444An exception raises while loading MHTML fileBug
WORDSNET-17401Saving to pdfA1a does not support TOC and TOC Item (TOCI) tagsBug
WORDSNET-18355System.NotSupportedException is thrown while importing MHTMLBug
WORDSNET-18512Foreign language converts a document with tables out of order of original documentBug
WORDSNET-18446DOCX to PDF - hyphenation not sameBug
WORDSNET-18380Document.UpdateFields throws System.InvalidOperationExceptionBug
WORDSNET-7452Aspose.Words hangs during rendering Text file to PdfBug
WORDSNET-7588AW hangs upon loading MHTML file produced with Aspose.EmailBug
WORDSNET-18395Tables get joined in PDF outputBug
WORDSNET-18386IndexOutOfRangeException while converting RTF to PDFBug
WORDSNET-17383FontSettings.SetFontSubstitutes does not substitute the fontBug
WORDSNET-10368Performance issue while converting Docx to PdfBug
WORDSNET-10867Document.Save method takes time to convert Docx to PdfBug
WORDSNET-3738Rendering takes a long time if the document consists of only one paragraph with lots of line breaksBug
WORDSNET-18171System.NotSupportedException is thrown while loading MHTMLBug
WORDSNET-18237Mathematical formula label mi will become italicBug
WORDSNET-18357Introduce Field.DisplayResult property to obtain the fake resultBug
WORDSNET-17407The right edge of the table not rendered in HTML correctlyBug
WORDSNET-18307“Not a legal OleAut date” Exception Occurs upon DOCX to DOC or PDF ConversionsBug
WORDSNET-12431Wrong spacing for a header in saving Word as PdfBug
WORDSNET-18448List of Tables adds continuation entries in PDF after calling UpdateFieldsBug
WORDSNET-12539Table of contents is misplaced in the output PDFBug
WORDSNET-13691A paragraph with a right tab wraps to the next line because of right indentBug
WORDSNET-13788Conversion from Word to PDF has some problems with header/footerBug
WORDSNET-17971Tab space is increased after comparing documentBug
WORDSNET-18302Document.Save throws System.IndexOutOfRangeExceptionBug
WORDSNET-15086Document.Save method takes time to save Word document to PdfBug
WORDSNET-18519Document.AcceptAllRevisions() throws NullReferenceExceptionBug
WORDSNET-18175Columns widths and heights are not maintained in the table during HTML to DOCXBug
WORDSNET-16818Squares appear between Korean characters in PDFBug
WORDSNET-18426DOCX to PDF conversion issue with chart renderingBug
WORDSNET-18329Aspose.Words.FileCorruptedException is thrown while loading MHTMLBug
WORDSNET-17336The text content in PDF output is mixed and the font is changedBug
WORDSNET-18525After opening and saving DOCX, the file fails to openBug
WORDSNET-17980HTML Ordered List incorrectly numbered when DOCX saved as PDFBug
WORDSNET-18278Tabs are incorrectly interpreted in PDF output.Bug
WORDSNET-18430Low performance in some text wrapping testsBug
WORDSNET-6208Aspose.Words hangs during renderingBug
WORDSNET-18470Aspose.Words.Document.UpdateFields() causes a System.ArgumentException()Bug
WORDSNET-9277Performance is slow when converting to PDFBug
WORDSNET-18467DoNotVertAlignInTxbx is incorrectly read from WordML document.Bug
WORDSNET-18228Append Document Destroys ListsBug
WORDSNET-18534FileFormatUtil.LoadFormatToExtension() throws on LoadFormat.DocPreWord60Bug
WORDSNET-18475DOCX to PDF conversion issue with list labelsBug
WORDSNET-18396The PDF output is different than MS Word outputBug
WORDSNET-18270Text position of SVG is changed when the document is exported to DOCX/PDFBug
WORDSNET-18196Arrow shapes are lost after conversion from DOCX to PDFBug
WORDSNET-17475Incorrect Page break import export during Word-HTML-Word roundtripsBug
WORDSNET-18399Incorrect rendering of Decimal number in PDFBug
WORDSNET-3512Aspose.Words hangs during rendering.Bug
WORDSNET-18479Calling of UpdateFields method corrupts some TOC entries in PDF outputBug
WORDSNET-18268Aspose.Words.FileCorruptedException is thrown while loading width of an HTML cellBug
WORDSNET-18486Incorrect emf rendering in XPSBug
WORDSNET-18030Remove obsolete font substitution APIBug
WORDSNET-13891Converting Word to PDF results in indent problemBug
WORDSNET-18309Document.UpdatePageLayout changes the list numbers in output PDFBug
WORDSNET-17471DOCX to PDF conversion issue with OpenType font.Bug
WORDSNET-17651Content pushed down in rendered PDFBug
WORDSNET-17729Author and Subject are incorrectly imported when converting from MOBI to DOCXBug
WORDSNET-17750Fail to save a specific word document to pdfBug
WORDSNET-17877PageSetup.PaperSize returns Letter for TXT documentBug
WORDSNET-17978The colored border is not rendered properly during DOCX to PDF conversionBug
WORDSNET-18184Ink annotations disappearBug
WORDSNET-18267System.NotSupportedException is thrown while loading MHTML with a “text/plain” partBug
WORDSNET-18289Horizontal lines width increases in PDFBug
WORDSNET-18327Incorrect shape positions in AW pdf outputBug
WORDSNET-18356System.NotSupportedException is thrown while importing MHTMLBug
WORDSNET-18336System.ArgumentException is thrown while saving DOCX to PDFBug
WORDSNET-18361Check Boxes are not rendered in output PDFBug

Public API and Backward Incompatible Changes

This section lists public API changes that were introduced in Aspose.Words 19.4. It includes not only new and obsoleted public methods, but also a description of any changes in the behavior behind the scenes in Aspose.Words which may affect existing code. Any behavior introduced that could be seen as regression and modifies existing behavior is especially important and is documented here.

Added a new overloaded AppendDocument() method with additional ImportFormatOptions parameter

Related issue: WORDSNET-18228.

Added a new overloaded AppendDocument() method into a Document class:

/// <summary>
/// Appends the specified document to the end of this document.
/// </summary>
/// <param name="srcDoc">The document to append.</param>
/// <param name="importFormatMode">Specifies how to merge style formatting that clashes.</param>
/// <param name="importFormatOptions">Allows to specify options that affect formatting of a result document.</param>
public void AppendDocument(Document srcDoc, ImportFormatMode importFormatMode, ImportFormatOptions importFormatOptions)

It allows to specify an additional options that affect the formatting of a result document.

See additional information under added a new ImportFormatOptions class for more flexible control over importing tasks at Aspose.Words for Java 19.4 Release Notes.

UseCase:

Document srcDoc = new Document("source.docx");
Document dstDoc = new Document("destination.docx");
ImportFormatOptions options = new ImportFormatOptions();

// Specify that if numbering clashes in source and destination documents, then a numbering from the source document will be used.
options.KeepSourceNumbering = true;
dstDoc.AppendDocument(srcDoc, ImportFormatMode.UseDestinationStyles, importFormatOptions)

Added a new public property Paragraph.BreakIsStyleSeparator

Related issue: WORDSNET-18436.

Added a new public property BreakIsStyleSeparator into a Paragraph class.

/// <summary>
/// True if this paragraph break is a Style Separator. A style separator allows one
/// paragraph to consist of parts that have different paragraph styles.
/// </summary>
public bool BreakIsStyleSeparator

It allows to identify Style Separator Paragraph.

UseCase:

Paragraph paragraph;
if (paragraph.BreakIsStyleSeparator)
{
  // Do smth..
}

Added feature to get font leading (line spacing)

Related to WORDSNET-16734.

The line spacing of a font is the vertical distance between the baselines of two consecutive lines of text. Thus, the line spacing includes the blank space between lines along with the height of the character itself.

The following property was introduced in the Font class to obtain this value:

/// <summary>
/// Returns line spacing of this font (in points).
/// </summary>
public double LineSpacing { get; }

UseCase:

DocumentBuilder builder = new DocumentBuilder(new Document());
builder.Font.Name = "Calibri";
builder.Writeln("qText");

// Obtain line spacing.
Font font = builder.Document.FirstSection.Body.FirstParagraph.Runs[0].Font;
Console.WriteLine($"lineSpacing = {font.LineSpacing}");

Added Field.DisplayResult property to obtain the fake result

Related issue: WORDSNET-18357

Inspired by WORDSNET-18165, we have decided to add a property that would allow customers to obtain the field’s result for fields that do not have a field separator node. We call this “fake result” or display result; MS Word displays it in the document by calculating the field’s value on the fly, but there is no such value in the document model

/// <summary>
/// Gets the text that represents the displayed field result.
/// </summary>
/// <remarks>
/// The <see cref="Words.Document.UpdateListLabels"/> method must be called to obtain correct value for the
/// <see cref="FieldListNum"/>, <see cref="FieldAutoNum"/>, <see cref="FieldAutoNumOut"/> and <see cref="FieldAutoNumLgl"/> fields.
/// </remarks>
public string DisplayResult

Usage:

List<Field> fields = FieldExtractor.ExtractToCollection(document, false);
Assert.AreEqual("111", fields[0].DisplayResult);
Assert.AreEqual("222", fields[1].DisplayResult);
Assert.AreEqual("Multi\rLine\rText", fields[2].DisplayResult);
Assert.AreEqual("%", fields[3].DisplayResult);
Assert.AreEqual("Macro Button Text", fields[4].DisplayResult);
Assert.AreEqual(string.Empty, fields[5].DisplayResult);
document.UpdateListLabels();
Assert.AreEqual("1)", fields[5].DisplayResult);

Added new StreamFontSource class

Related issue: WORDSNET-16739

Added new StreamFontSource class which allows loading fonts from the stream:

    /// <summary>
    /// Base class for user-defined stream font source.
    /// </summary>
    /// <remarks>
    /// <para>In order to use the stream font source you should create a derived class from the <see cref="StreamFontSource"/>
    /// and provide implementation of the <see cref="OpenFontDataStream"/> method.</para>
    /// 
    /// <para><see cref="OpenFontDataStream"/> method could be called several times. For the first time it will be called 
    /// when Aspose.Words scans the provided font sources to get the list of available fonts. Later it may be called if the
    /// font is used in the document to parse the font data and to embed the font data to some output formats.</para>
    /// 
    /// <para><see cref="StreamFontSource"/> may be useful because it allows to load the font data only when it is required
    /// and not to store it in the memory for the <see cref="FontSettings"/> lifetime.</para>
    /// </remarks>
    public abstract class StreamFontSource : FontSourceBase, IFontData
    {
        /// <summary>
        /// Ctor.
        /// </summary>
        protected StreamFontSource()
        {
        }
		
        /// <summary>
        /// Ctor.
        /// </summary>
        /// <param name="priority">Font source priority. See the <see cref="FontSourceBase.Priority"/> property description for more information.</param>
        protected StreamFontSource(int priority)
            : base(priority)
        {
        }
		
        /// <summary>
        /// Returns the type of the font source.
        /// </summary>
        public sealed override FontSourceType Type
        {
            get { return FontSourceType.FontStream; }
        }
		
        /// <summary>
        /// This method should open the stream with font data on demand.
        /// </summary>
        /// <returns>Font data stream.</returns>
        /// <remarks>
        /// Aspose.Words will close the stream after reading. There is no need to close it explicitly.
        /// </remarks>
        public abstract Stream OpenFontDataStream();       
    }

UseCase:

class ResourceSteamFontSourceExample : StreamFontSource
{
    public override Stream OpenFontDataStream()
    {
        return Assembly.GetExecutingAssembly().GetManifestResourceStream("resourceName");
    }
}
FontSettings.DefaultInstance.SetFontsSources(new FontSourceBase[] {new SystemFontSource(), new ResourceSteamFontSourceExample()});

Obsolete property DefaultFontName was removed from FontSettings class. Please use SubstitutionSettings.DefaultFontSubstitution instead. Obsolete property EnableFontSubstitution was removed from FontSettings class. Please use SubstitutionSettings.FontInfoSubstitution instead. Obsolete methods GetFontSubstitutes, SetFontSubstitutes, AddFontSubstitutes was removed from FontSettings class. Please use SubstitutionSettings.TableSubstitution instead.

WORDSNET-14297 - Provide a method to check if particular Dml text effect is applied

Font.HasDmlEffect() method have been added to check if particular Dml text effect is applied to the Run.

/// <summary>
/// Checks if particular Dml text effect is applied.
/// </summary>
/// <param name="dmlEffectType">Dml text effect type.</param>
/// <returns>True if particular Dml text effect is applied.</returns>
public bool HasDmlEffect(TextDmlEffect dmlEffectType)

UseCase:

RunCollection runs = doc.FirstSection.Body.FirstParagraph.Runs;
Font runFont = runs[1].Font;

// One run might have several Dml text effects applied.
Debug.WriteLine(runFont.HasDmlEffect(TextDmlEffect.Shadow));
Debug.WriteLine(runFont.HasDmlEffect(TextDmlEffect.Effect3D));
Debug.WriteLine(runFont.HasDmlEffect(TextDmlEffect.Reflection));
Debug.WriteLine(runFont.HasDmlEffect(TextDmlEffect.Outline));
Debug.WriteLine(runFont.HasDmlEffect(TextDmlEffect.Fill));