Browse our Products

Aspose.Words for .NET 22.7 Release Notes

Major Features

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

  • Implemented support of WCAG 2.0 PDF.
  • Implemented our own glyph outlines parsing for OpenType(CFF) fonts.
  • Introduced new HTML import mode for block-level elements.
  • Added support of the DATABASE fields.
  • Provided an ability to set shadow formatting of the shape object.

Full List of Issues Covering all Changes in this Release (Reported by .NET Users)

KeySummaryCategory
WORDSNET-23654Add a new mode for import HTML block-level elements during inserting HTML via DocumentBuilder.InsertHtml methodNew Feature
WORDSNET-15752Support DATABASE fieldNew Feature
WORDSNET-19220Add feature to support WCAG 2.0 PDFNew Feature
WORDSNET-13702Support parsing of glyph data for OpenType(CFF)New Feature
WORDSNET-23295Add a flag to take EXIF orientation in account while inserting a JPEG image by LINQ Reporting EngineNew Feature
WORDSNET-18125Make sure saving to tagged PDF follows Section 508 GuidelinesEnhancement
WORDSNET-23851Data label values are rendered improperlyBug
WORDSNET-23963List label is added to the paragraph on the next page when ExtractPages is usedBug
WORDSNET-23709Shape stroke is not rendered to JPEGBug
WORDSNET-23706Numbering is broken after converting document to HTMLBug
WORDSNET-23936Reverse order of replies on the comment in the airBug
WORDSNET-23976Korean text is not wrapped properly when WordWrap option is disabledBug
WORDSNET-20981Word document converted to PDF results in different font for last pageBug
WORDSNET-22323DOCX to PDF conversion issue with formula/equation renderingBug
WORDSNET-24010ImportStyle() returns null for KeepDifferentStylesBug
WORDSNET-23950Reply naming differences within export to PDFBug
WORDSNET-23981DOCX to MD conversion exceptionBug
WORDSNET-21368Unexpected Bold Formatting to custom style during Word to HTML to Word conversionBug
WORDSNET-23701Font size is not exported to HTMLBug
WORDSNET-23913FileNotFoundException is thrown upon loading DOCX documentBug
WORDSNET-24034InvalidOperationException is thrown upon comparing documentBug
WORDSNET-23828Content is removed after saving the documentBug
WORDSNET-23544Document missing sections after savingBug
WORDSNET-23889Wrong list numbering in SDT bound to custom XML partBug
WORDSNET-23952Chart axis are not visible when render as SVGBug
WORDSNET-23954List labels in Swedish are rendered in EnglishBug
WORDSNET-23888Aspose.Words hangs for a while upon loading MHTML fileBug
WORDSNET-23646Date X-Axis shows values with incorrect stepBug
WORDSNET-23865KeepSourceFormatting does not honor source document styleBug
WORDSNET-23313Invalidate document layout after calling Document.Compare with two PDF documentsBug
WORDSNET-23974Style separator produces line break after renderingBug
WORDSNET-23890Evaluation watermark in ODT document overlaps content of the documentBug
WORDSNET-23810Incorrect background image after Pdf2Word conversionBug
WORDSNET-23925Word document not saving PNGBug
WORDSNET-23829DOCX to PDF: Characters rendered as boxesBug
WORDSNET-23902Redundant space between letter is added upon rendering SVG imageBug
WORDSNET-23783Consider disabling support for external resources when loading EPUB documentsBug
WORDSNET-23867Wrong outlines are returned for the space characterBug
WORDSNET-23965InvalidOperationException is thrown upon rendering documentBug
WORDSNET-23955Spacing between numbers and Chinese hieroglyphs is too big in chart axis labelsBug
WORDSNET-23841Text orientation is turned to vertical after converting to HTMLBug
WORDSNET-23684Incorrect calculation of indents for border box  around the formulaBug
WORDSNET-23958Exception when comparing documentsBug
WORDSNET-23948InvalidOperationException: MediaBox is nullBug
WORDSNET-23929Text is wrapped differently after renderingBug
WORDSNET-23878Text is wrapped improperlyBug
WORDSNET-14009Text Font and Gradient fill not saved in PDF outputBug
WORDSNET-23942Images are rendered in PDF as red crossBug
WORDSNET-23947System.OverflowException: Value was either too large or too small for an Int32Bug
WORDSNET-23924InvalidCastException is thrown upon updating fieldsBug
WORDSNET-23951Formating issue on the lastest Pdf2Word releaseBug
WORDSNET-23922Incorrect font detection for East Asian characters when rendering a formulaBug
WORDSNET-23886Style applied to text is changed after open/save DOCX documentBug
WORDSNET-23941ZlibException: Bad state (invalid distance code)Bug
WORDSNET-23855CryptographicException: The input data is not a complete blockBug
WORDSNET-23919Aspose.Words hangs upon updating fields or layoutBug
WORDSNET-23866Field updating hangs if document is optimized for Word2016Bug
WORDSNET-23875Header row is not repeated upon rendering for a floating tableBug
WORDSNET-23869Incorrect font detection when rendering a formulaBug
WORDSNET-23918ArgumentException because of duplicates in CustomDocumentPropertiesBug
WORDSNET-22948Import of SVG image differs from what is in browserBug
WORDSNET-23874Thickness of hairline is different when render with .NET and .NET Standard versionsBug
WORDSNET-23817Header height is changed that leads to layout issuesBug
WORDSNET-6892TextBox is not preserved on HTML importBug

Full List of Issues Covering all Changes in this Release (Reported by Java Users)

KeySummaryCategory
WORDSNET-23877Provide API to remove the shape shadowsBug
WORDSNET-24007FileCorruptedException on loading RTF fileBug
WORDSNET-23980IF field with wildcard is updated improperlyBug
WORDSNET-23598Part of content is moved to previous pageBug
WORDSNET-23937Layout is different after DOCX to PDF conversionBug
WORDSNET-22648Incorrect Rendering of Math Equations in PDFBug
WORDSNET-23970Header and footer are lost after renderingBug
WORDSNET-23979Word to PDF -  conversion issue with floating table header rowsBug
WORDSNET-23862Chinese text in SVG is rendered as tofu when convert to PDFBug
WORDSNET-22896Font Fallback does not work properly for text within SVG imagesBug
WORDSNET-21279Arabic text rendered LTR (garbled) when converting from document to PDFBug
WORDSNET-23938FileCorruptedException is thrown upon loading DOCX documentBug
WORDSNET-23968Hanging during export to PDFBug
WORDSNET-23599Whitespaces font is reset to Arial upon importing HTMLBug
WORDSNET-23910Font is changed after inserting document when KeepDifferentStyles is usedBug
WORDSNET-23909Numbering is changed after inserting documentBug
WORDSNET-23781UpdatePageLayout hangsBug
WORDSNET-23893InvalidOperationException is thrown upon executing mail mergeBug
WORDSNET-23927NullReferenceException is thrown upon rendering documentBug
WORDSNET-23623API fails to load EML files as MHTMLBug
WORDSNET-21764Math equations are blurred during exporting Word to HTML on LinuxBug

Public API and Backward Incompatible Changes

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

Added a new mode for import HTML block-level elements during inserting HTML via DocumentBuilder.InsertHtml() method

Related issue: WORDSNET-23654

New HTML insertion option was added to HtmlInsertOptions enum.

public enum HtmlInsertOptions
{
    /// <summary>
    /// Preserve properties of block-level elements.
    /// </summary>
    /// <remarks>
    /// <para>
    /// By default, properties of parent blocks are merged and stored on their child elements (i.e. paragraphs or tables).
    /// If this option is specified, properties of each block are stored separately in a special logical structure.
    /// As a result, this option allows to better preserve individual borders and margins seen in the HTML document
    /// and get better conversion results. The downside is that the resulting document gets harder to modify, since borders
    /// and margins stored in the logical structure are not available for editing.
    /// </para>
    /// <para>
    /// Only margins and borders of 'body', 'div', and 'blockquote' HTML elements are preserved. Properties of each HTML
    /// element are stored separately.
    /// </para>
    /// <para>
    /// If this option is specified, Aspose.Words mimics MS Word's behavior regarding import of block properties.
    /// </para>
    /// </remarks>
    PreserveBlocks = 4
}

The new mode of import HTML block-level elements during inserting HTML via DocumentBuilder.InsertHtml() method allows to better preserve borders and margins seen in the HTML document and get better conversion results.

const string html = @"
<html>
    <div style='border:dotted'>
        <div style='border:solid'>
            <p>paragraph 1</p>
            <p>paragraph 2</p>
        </div>
    </div>
</html>";
// Set the new mode of import HTML block-level elements.
HtmlInsertOptions insertOptions = HtmlInsertOptions.PreserveBlocks;
DocumentBuilder builder = new DocumentBuilder();
builder.InsertHtml(html, insertOptions);
builder.Document.Save(MyDir + "sample.docx");

Added new public property ShadowFormat

Related issue: WORDSNET-23877

A new public ShadowFormat property has been added to ShapeBase class

/// <summary>
/// Gets shadow formatting for the shape.
/// </summary>
public ShadowFormat ShadowFormat { get; }

With this property customers can set or get one of the preset shadow types.

/// <summary>
/// Gets or sets the specified <see cref="ShadowType"/> for ShadowFormat.
/// </summary>
public ShadowType Type { get; set; }

Users can also get information about a shadow’s visibility.

/// <summary>
/// Returns <c>true</c> if the formatting applied to this instance is visible.
/// </summary>
/// <remarks>
/// Unlike <see cref="Clear()"/>, assigning <c>false</c> to Visible does not clear the formatting,
/// it only hides the shape effect.
/// </remarks>
public bool Visible { get; }

And it is also possible to clear ShadowFormat.

/// <summary>
/// Clears shadow format.
/// </summary>
public void Clear()

Use Case:

Document doc = new Document ("DocumentWithShape.docx");
Shape shape = (Shape)doc.FirstSection.Body.GetChild(NodeType.Shape, 0, true);
// Checking whether the shadow effect is visible and whether the preset type is Shadow2.
if (shape.ShadowFormat.Visible && shape.ShadowFormat.Type == ShadowType.Shadow2)
    // Setting the preset shadow type to Shadow7.
    shape.ShadowFormat.Type = ShadowType.Shadow7;
// Checking whether the shadow is customized, i.e. the preset type is ShadowMixed.
if (shape.ShadowFormat.Type == ShadowType.ShadowMixed)
    // Clearing ShadowFormat.
    shape.ShadowFormat.Clear();

ReportBuildOptions.RespectJpegExifOrientation enum member

Related issue: WORDSNET-23295

The following member has been added to the ReportBuildOptions enum:

/// <summary>
/// Specifies that the engine should use EXIF ​​image orientation values to appropriately rotate inserted
/// JPEG images.
/// </summary>
RespectJpegExifOrientation

The option can be applied while building a report in the following way:

ReportingEngine engine = new ReportingEngine();
engine.Options |= ReportBuildOptions.RespectJpegExifOrientation;
engine.BuildReport(...);

Supported the DATABASE field

Related issue: WORDSNET-15752

The following types and members have been added:

public class FieldOptions
{
    /// <summary>
    /// Gets or sets a provider that returns a query result for the <see cref="FieldDatabase"/> field.
    /// </summary>
    public IFieldDatabaseProvider FieldDatabaseProvider { get; set; }
 
}
 
/// <summary>
/// Implement this interface to provide data for the <see cref="FieldDatabase"/> field when it's updated.
/// </summary>
public interface IFieldDatabaseProvider
{
    /// <summary>
    /// Returns query result.
    /// </summary>
    /// <param name="fileName">The complete path and file name of the database specified in the \d field switch.</param>
    /// <param name="connection">The connection to the data specified in the \c field switch.</param>
    /// <param name="query">The set of SQL instructions that query the database specified in the \s field switch.</param>
    /// <param name="field">The field being updated.</param>
    /// <returns>The <see cref="FieldDatabaseDataTable"/> instance that should be used for the field's update.</returns>
    FieldDatabaseDataTable GetQueryResult(string fileName, string connection, string query, FieldDatabase field);
}
 
/// <summary>
/// Provides data for the <see cref="FieldDatabase"/> field result.
/// </summary>
public class FieldDatabaseDataTable
{
    /// <summary>
    /// Initializes a new instance of the <see cref="FieldDatabaseDataTable"/> class.
    /// </summary>
    public FieldDatabaseDataTable(params string[] columnNames);
 
    /// <summary>
    /// Gets columns that belong to this table.
    /// </summary>
    public string[] ColumnNames { get; }
 
    /// <summary>
    /// Gets rows that belong to this table.
    /// </summary>
    public IList<FieldDatabaseDataRow> Rows { get; }
 
    /// <summary>
    /// Initializes a new instance of the <see cref="FieldDatabaseDataTable"/> class
    /// from the <see cref="System.Data.DataTable"/> instance.
    /// </summary>
    public static FieldDatabaseDataTable CreateFrom(System.Data.DataTable dataTable);
}
 
/// <summary>
/// Provides data for the <see cref="FieldDatabase"/> field result.
/// </summary>
public class FieldDatabaseDataRow
{
    /// <summary>
    /// Initializes a new instance of the <see cref="FieldDatabaseDataRow"/> class.
    /// </summary>
    public FieldDatabaseDataRow(params string[] values);
 
    /// <summary>
    /// Gets values that belong to this row.
    /// </summary>
    public string[] Values { get; }
 
    /// <summary>
    /// Initializes a new instance of the <see cref="FieldDatabaseDataRow"/> class
    /// from the <see cref="System.Data.DataRow"/> instance.
    /// </summary>
    public static FieldDatabaseDataRow CreateFrom(System.Data.DataRow dataRow);
}

Use Case:

document.FieldOptions.FieldDatabaseProvider = new OleDbFieldDatabaseProvider();
document.UpdateFields();
 
public class OleDbFieldDatabaseProvider : IFieldDatabaseProvider
{
    FieldDatabaseDataTable IFieldDatabaseProvider.GetQueryResult(string fileName, string connection, string query, FieldDatabase field)
    {
        OleDbConnectionStringBuilder connectionStringBuilder = new OleDbConnectionStringBuilder(connection);
        connectionStringBuilder.DataSource = fileName;
 
        using (OleDbConnection oleDbConnection = new OleDbConnection(connectionStringBuilder.ToString()))
        {
            OleDbDataAdapter oleDbDataAdapter = new OleDbDataAdapter(query, oleDbConnection);
            DataTable dataTable = new DataTable();
            oleDbDataAdapter.Fill(dataTable);
 
            return FieldDatabaseDataTable.CreateFrom(dataTable);
        }
    }
}