Aspose.Words for .NET 17.11 Release Notes

Major Features

There are 102 improvements and fixes in this regular monthly release. The most notable are:

  • LINQ Reporting Engine supports dynamic shape background coloring.
  • Improved optional hyphen handling and fixed related infinite loop issue.
  • Improved floating table re-breaking in specific scenarios where content of a table used to be lost outside of a page.
  • Improved table grid computation when cells contain tab characters.
  • Further improved character spacing control handling.
  • PCL documents rendering improved. UCS-2 symbol sets can now be mapped to the printer built-in fonts – it allows to print non-ascii symbols with built-in fonts if supported by printer.
  • A ‘cosmetic’ pen (i.e. pen with fixed 1-pixel width) rendering improved in metafile output documents.
  • Font metrics calculation affecting the vertical positioning of text for GDI+ output rendering improved.
  • Added fallback for strokes with unsupported binary raster operations in metafile rendering.
  • Gamma-correction flag is now taken into account while rendering metafiles brushes.
  • Metafile warnings improved: Added warnings for unsupported binary raster operations. Removed warnings about unsupported metafile records which do not affect the output.

Full List of Issues Covering all Changes in this Release

KeySummaryCategory
WORDSNET-10454Contents move down to the page after conversion from Docx to PdfBug
WORDSNET-10455Position of table’s rows is changed after conversion from Docx to PdfBug
WORDSNET-12453Table truncates in PDF - only one page in renderedBug
WORDSNET-12489Font changed in saved .rtf documentBug
WORDSNET-12908Table on edge of page is mangled in PDFBug
WORDSNET-13313Multipage table content cutting off on transforming Word to PDFBug
WORDSNET-13594Blank pages appear in generated ODTBug
WORDSNET-13744/character spacing control/ Chinese text moves to next line after conversion from Doc to HtmlFixedBug
WORDSNET-13930Row’s contents are truncated after conversion from Docx to PdfBug
WORDSNET-13931Row’s contents are truncated after conversion from Docx to PdfBug
WORDSNET-14119Docx to Pdf conversion issue with table’s renderingBug
WORDSNET-14120Cell’s contents are truncated at the bottom of page in output PdfBug
WORDSNET-14252Table’s cells are completely lost after re-saving OdtBug
WORDSNET-14340Html save as Odt - tables display incorrectlyBug
WORDSNET-14885Distance between list item marker and text increases after saving to HTMLBug
WORDSNET-14927“DOCX to WML” conversion result has wrong output.Bug
WORDSNET-15108DOCX to PDF conversion losing pagesBug
WORDSNET-15137Incorrect table/page layout // DOCX to PDFA: some text is missing in resultant PDFA documentBug
WORDSNET-15147TOC paragraph spacing difference in Aspose.Words and MS WordBug
WORDSNET-15205MS Word 2016 shows page number incorrectly in status bar after saving RTF To DOCXBug
WORDSNET-15414Formatting issue in PDF printingBug
WORDSNET-15551Process hangs during rendering DOCX to PDFBug
WORDSNET-15660/character spacing control/ Position of line break changes in rendered documentBug
WORDSNET-15720DOCX to PDF conversion issue with Khmer textBug
WORDSNET-15721Text is wrapped to next line in table after conversion from DOCX to PDFBug
WORDSNET-15748Images are overlapped after conversion from DOCX to HtmlFixedBug
WORDSNET-15788List label values are incorrect after joining documentsBug
WORDSNET-15806DOCX to PDF conversion issue with SmartArt renderingBug
WORDSNET-15827DOCX to PNG conversion issue with text formattingBug
WORDSNET-15853DOCX to Image conversion issue with text formattingBug
WORDSNET-15859Greek letter µ converted to M when DOCX saved as PDFBug
WORDSNET-15862Text overlaps on header row border in resultant ImageBug
WORDSNET-15863DOCX to Image conversion issue with content positionBug
WORDSNET-15864DOCX to PNG conversion issue with text position inside text-boxBug
WORDSNET-15876Font color issue in PDF renderingBug
WORDSNET-15877Highlighted text issue in Rendered PDFBug
WORDSNET-15887/character spacing control/ Incorrect line wrapping in a callout text boxBug
WORDSNET-15888Aspose.Words generated PCL document is not printingBug
WORDSNET-15889Blank Output Produced when Trying to Skip Images or CssStyleSheet during HTML LoadBug
WORDSNET-15894UTF8 encoding Text to PDF rendering issueBug
WORDSNET-15901DOCX to PDF conversion issue with font of chart’s titleBug
WORDSNET-15913/infinite loop/ DOCX with formatting symbol can’t convert to PDFBug
WORDSNET-15914When DOCX is saved as PDF, gradient becomes different.Bug
WORDSNET-15917Image quality not preserved when saving DOCX to HTMLBug
WORDSNET-15927DOCX to PDF conversion issue with chart’s renderingBug
WORDSNET-15930Adjacent faces of the bevel have different normals in the shared verticesBug
WORDSNET-15950Incorrect TOC numbers and indexBug
WORDSNET-15957Rendering issue of Chinese number listBug
WORDSNET-15960Do not read LineSpacing when its Value part is not specified.Bug
WORDSNET-15964Incorrect exception on password protected documentBug
WORDSNET-15973MailMergeCleanupOptions.RemoveStaticFields updates the FileName field codes incorrectlyBug
WORDSNET-15976Document.UpdateFields does not update the TOC fieldBug
WORDSNET-15977Docx to Pdf conversion issue with chart legend itemsBug
WORDSNET-15978Empty PieChart rendering issueBug
WORDSNET-15983VML shape fill is lost upon saving to DOCXBug
WORDSNET-16031Strange behavior of the text parts in table cells after Mail MergeBug
WORDSNET-16036Shape changed during DOC to DOCX conversionBug
WORDSNET-16056Support text kerning for ODTBug
WORDSNET-6624Extra amount of spacing is added between characters in a wordBug
WORDSNET-7040Font changes from Arial to Times new Roman during importing nodesBug
WORDSNET-13098Applying simple textures (such as Color, Gradient, Picture, etc.) for 3D shapes (hardware rendering)Enhancement
WORDSNET-14901Issue when loading HTML with incorrect namespace declarationsEnhancement
WORDSNET-14948Incorrect table position in DOM API and resultant HTMLEnhancement
WORDSNET-15616To set file name and extension when inserting ole object using MemoryStreamEnhancement
WORDSNET-15903Support to evaluate IF conditionEnhancement
WORDSNET-15915Shading.BackgroundPatternColor returns incorrect value after updating Theme colorEnhancement
WORDSNET-15967Demo code of Page Splitter has to be simplified and reviewed.Enhancement
WORDSNET-15750Temporary license implementation issueException
WORDSNET-15824AcceptAllRevisions method thorws InvalidOperationExceptionException
WORDSNET-15916Loading Mhtml file into API is throwing ExceptionException
WORDSNET-15949Metadata embedding into a document fails when savingException
WORDSNET-15953System.InvalidOperationException throws StructuredDocumentTag.PlaceholderNameException
WORDSNET-15966DocumentBuilder.InsertHtml throws System.NullReferenceException when HTML is inserted in table’s cellException
WORDSNET-15975DOCX to DOC conversion throws InvalidOperationExceptionException
WORDSNET-15980Appending document is throwing NullReferenceExceptionException
WORDSNET-16014Calling UpdatePageLayout method throwing exceptionException
WORDSNET-16016System.InvalidOperationException is thrown while saving DOC to RTFException
WORDSNET-16029Appending RTF documents is throwing NullReferenceExceptionException
WORDSNET-16039Shading formatting of cloned Cell throws NullReferenceExceptionException
WORDSNET-13709Table width is changed after conversion from Docx to Pdf.Feature
WORDSNET-14360Add feature to include all styles in Resources\AllStyles2007.docx from StyleIdentifier EnumFeature
WORDSNET-14653Shifted text in a document after conversion from MS Word to PDFFeature
WORDSNET-14722When DOCX is saved as PDF, table columns have incorrect widthFeature
WORDSNET-14970Add feature to fill shape (text-box) color in Linq Reporting EngineFeature
WORDSNET-15358Built-in styles in MSW 2013 are different than in MSW 2007.Feature
WORDSNET-15624Provide method that returns Text in the same order as we see in MS Word, Google Docs, LibreOffice etcFeature
WORDSNET-15739Applying a radial gradient fill (hardware rendering).Feature
WORDSNET-15740Applying a rectangular gradient fill (hardware rendering).Feature
WORDSNET-15885Implement support of transform for radial gradient fill (hardware rendering).Feature
WORDSNET-15893TOC line spacing is changed in PDF output.Feature
WORDSNET-15900Empty table appears in ouput PDFFeature
WORDSNET-15981Get position of floating table in public APIFeature
WORDSNET-7575/revision marks/ Support revision marks upon renderingFeature
WORDSNET-9453Shape gets overlapped due to its incorrect positionFeature
WORDSNET-15746/performance/ Support to load document partially in DOMPerformance
WORDSNET-15910/infinite loop/ Performance issue with Document.PageCountPerformance
WORDSNET-14087Incorrect table width on page 144Regression
WORDSNET-14088Document.UpdateFields does not update page fieldRegression
WORDSNET-15971Hebrew text conversion issue in DOCX to MHTMLRegression
WORDSNET-16024IFieldMergingCallback.FieldMerging is not called when mail merge field is inside DISPLAYBARCODE fieldRegression
WORDSNET-8531Field.Update method return incorrect value for Page fieldRegression
WORDSNET-9149MailMerge.Execute takes very long time to completeRegression

Public API and Backward Incompatible Changes

This section lists public API changes that were introduced in Aspose.Words 17.11. 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 a regression and modifies existing behavior is especially important and is documented here.

Supported Dynamic Shape Fill Color Setting for LINQ Reporting Engine

The “Setting Text Background Color Dynamically” section of the engine’s documentation was renamed to “Setting Background Color Dynamically” and updated to describe the change.

Added Word2016 Constant into MsWordVersion Enumeration Type

Related issue WORDSNET-14771.

The following constant is added into the MsWordVersion enumeration type.

/// <summary>
/// Optimize Aspose.Words behavior to match MS Word 2016 version.
/// </summary>
Word2016

It can be passed into the CompatibilityOptions.OptimizeFor method to optimize the document contents as well as Aspose.Words behavior to match MS Word 2016 version.

doc.CompatibilityOptions.OptimizeFor(MsWordVersion.Word2016);

To Set File Name and Extension when Inserting Ole Object using MemoryStream

Related Issue: WORDSNET-15616

The public property OlePackage was added to the OleFormat class to provide ability to set file name, extension and display name for OLE Package. The OlePackage class has 2 public properties:

public class OlePackage
{
    /// <summary>
    /// Gets or sets OLE Package file name.
    /// </summary>
    public string FileName { get; set;}
    /// <summary>
    /// Gets or sets OLE Package display name.
    /// </summary>
    public string DisplayName { get; set;}
}

The example:

//use case
Document document = new Document();
DocumentBuilder builder = new DocumentBuilder(document);
byte[] bs = File.ReadAllBytes(@"D:\downloads\aaa.zip");
using (Stream stream = new MemoryStream(bs))
{
    Shape shape = builder.InsertOleObject(stream, "Package", true, null);
    OlePackage olePackage = shape.OleFormat.OlePackage;
    olePackage.FileName = "bbb.zip";
    olePackage.DisplayName = "bbb.zip";
    document.Save(@"D:\downloads\testInsertZip.docx");
}

Changed Behavior of Range.Replace Methods

Related issue WORDSNET-15624

Behaviour of the following methods of the Range class is changed.

public int Replace(string pattern, string replacement, FindReplaceOptions options);
public int Replace(Regex pattern, string replacement, FindReplaceOptions options)

Now headers/footers of a section are processed in this order:

  • If Section.PageSetup.DifferentFirstPageHeaderFooter is ‘True’:
    • First header
    • First footer
    • Even header
    • Even footer
    • Primary header
    • Primary footer
  • If Section.PageSetup.DifferentFirstPageHeaderFooter is ‘False’:
    • Primary header
    • Primary footer
    • Even header
    • Even footer

Remove Obsolete Methods in DigitalSignatureUtil

Related issue: WORDSNET-15712

Removed obsolete public methods from DigitalSignatureUtil class:

public static void Sign(string srcFileName, string dstFileName, System.Security.Cryptography.X509Certificates.X509Certificate2 certificate, string comments, DateTime signTime);
public static void Sign(string srcFileName, string dstFileName, CertificateHolder certHolder, string comments,DateTime signTime);
public static void Sign(string srcFileName, string dstFileName, CertificateHolder certHolder, string comments, DateTime signTime, string srcPassword);
public static void Sign(Stream srcStream, Stream dstStream, System.Security.Cryptography.X509Certificates.X509Certificate2 certificate, string comments, DateTime signTime);
public static void Sign(Stream srcStream, Stream dstStream, CertificateHolder certHolder, string comments, DateTime signTime);
public static void Sign(Stream srcStream, Stream dstStream, CertificateHolder certHolder, string comments, DateTime signTime, string srcPassword);

Instead, the methods with SignOptions class should be used. See following headings:

Metafile Warnings Improved

Related issue: WORDSNET-15969

  • Added warnings for unsupported binary raster operations. Also added fallback to bitmap rendering in this case on .NET platform.
  • Removed warnings about unsupported metafile records which do not affect the output.
  • Changed type of warnings about unsupported metafile records from DataLoss/UnexpectedContent to more appropriate MinorFormattingLoss.

Get Position of Floating Table in Public API

Related issue: WORDSNET-15981 

Added new public property for floating tables in Table class:

/// <summary>
/// Gets the base object from which the horizontal positioning in the <see cref="AbsoluteHorizontalDistance"/>
/// and/or <see cref="RelativeHorizontalAlignment"/> attribute should be calculated.
/// Default value is <see cref="RelativeHorizontalPosition.Column"/>.
/// </summary>
public RelativeHorizontalPosition HorizontalAnchor
/// <summary>
/// Gets the base object from which the vertical positioning in the <see cref="AbsoluteVerticalDistance"/>
/// attribute should be calculated.
/// Default value is <see cref="RelativeVerticalPosition.Margin"/>.
/// </summary>
public RelativeVerticalPosition VerticalAnchor
/// <summary>
/// Gets table absolute horizontal position relative to the horizontal anchor
/// specified by the <see cref="HorizontalAnchor"/>, in points.
/// Default value is 0.
/// </summary>
public double AbsoluteHorizontalDistance
/// <summary>
/// Gets table absolute vertical position relative to the vertical anchor
/// specified by the <see cref="VerticalAnchor"/>, in points.
/// Default value is 0.
/// </summary>
public double AbsoluteVerticalDistance
/// <summary>
/// Gets whether a floating table shall allow other floating tables in the document
/// to overlap its extents when displayed.
/// Default value is <c>true</c>.
/// </summary>
public bool AllowOverlap

UC:

Document doc = new Document(@"Path\to\document.xml");
foreach (Table table in doc.FirstSection.Body.Tables)
{
    // If table is floating type then print its positioning properties.
    if (table.TextWrapping == TextWrapping.Around)
    {
        Console.WriteLine(table.HorizontalAnchor);
        Console.WriteLine(table.VerticalAnchor);
        Console.WriteLine(table.AbsoluteHorizontalDistance);
        Console.WriteLine(table.AbsoluteVerticalDistance);
        Console.WriteLine(table.AllowOverlap);
    }
}

Added the FieldIf.EvaluateCondition() Method

Related issue: WORDSNET-15903

Customer wanted to evaluate IF condition after mail merge and was requesting some API for it. Since the ComparisonOperator, LeftExpression and RightExpression properties of FieldIf did not fulfill customer requirements, we have introduced the FieldIf.EvaluateCondition() method that immediately returns the result of expression’s evaluation.

/// <summary>
/// Evaluates the condition.
/// </summary>
/// <returns>
/// A <see cref="FieldIfComparisonResult"/> value that represents the result of the condition evaluation.
/// </returns>
public FieldIfComparisonResult EvaluateCondition()

FieldIfComparisonResult enumeration:

/// <summary>
/// Specifies result of the IF field condition evaluation.
/// </summary>
public enum FieldIfComparisonResult
{
    /// <summary>
    /// There is an error in condition.
    /// </summary>
    Error,
    /// <summary>
    /// The condition is <c>true</c>.
    /// </summary>
    True,
    /// <summary>
    /// The condition is <c>false</c>.
    /// </summary>
    False
}

Usage:

DocumentBuilder builder = new DocumentBuilder();
FieldIf field = (FieldIf)builder.InsertField("IF 1 = 1", null);
FieldIfComparisonResult actualResult = field.EvaluateCondition();
Assert.AreEqual(FieldIfComparisonResult.True, actualResult);