Browse our Products

Aspose.Words for .NET 16.7.0 Release Notes

Major Features

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

  • A document page can now be saved in GIF format using SaveFormat.Gif in ImageSaveOptions.
  • Font substitution rules improved. Now embedded font is used for substitution if available.
  • Multilevel strings rendering in DrawingML Chart axis labels improved.
  • OfficeMath objects now can be exported (optional) to HTML,MHTML or EPUB as mathml elements.
  • Implemented rendering of format revisions in balloons.
  • SKIPIF field supported.
  • LINQ Reporting Engine supports more numeric and string formats missing in standard .Net/Java libraries.
  • Replace API v2.0. Advanced replace methods added.
  • ReplaceAction, IReplacingCallback and ReplacingArgs moved to Aspose.Words.Replacing.
  • Old Range.Replace API marked as (Obsolete).
  • Font Embedding API (Implemented API for adding or removing embedded fonts).
  • MsWordVersion enum moved to Aspose.Words.Settings.
  • Added public methods to the DigitalSignatureUtil class that allow to specify a password for decrypting document before it will be signed.

Full List of Issues Covering all Changes in this Release

KeySummaryCategory
WORDSNET-11021Layout issues with Kinosku and AsianHangingPunctuation.Bug
WORDSNET-11563Size of images changed during open/save a HTMLBug
WORDSNET-12205List label is lost when list item is first in comment.Bug
WORDSNET-13012CSS is lost after re-saving HtmlBug
WORDSNET-13149Doc to Pdf conversion issue with contents positionBug
WORDSNET-13279InsertHtml reuses imported styles even if their CSS don’t matchBug
WORDSNET-13339/format revision/ Preserve Revision details in Balloons in PDFBug
WORDSNET-13344Content Control is not rendering in output PdfBug
WORDSNET-13430Table layout is corrupted after saving a DOCX to DOCXBug
WORDSNET-13475ParagraphFormat.StyleName returns incorrect value for custom stylesBug
WORDSNET-13485AppendDocument does not preserve table’s cell widthBug
WORDSNET-13530Text direction of cell’s text is changed in output HtmlBug
WORDSNET-13550Mixed Numbers, English and non-English content is incorectly encodedBug
WORDSNET-13558Cell’s position is changed after re-saving RtfBug
WORDSNET-13559Font size of text is changed after re-saving RtfBug
WORDSNET-13565Numeric formatting does not take effect in Linq Reporting EngineBug
WORDSNET-13595Font size of Hebrew text is changed after conversion from Docx to HtmlBug
WORDSNET-13599Tables do not merge correctly after removing paragraph between themBug
WORDSNET-13605/para rules/ Paragraphs are rendered on next page in output PdfBug
WORDSNET-13611Parts of chart lost when converted to png with aspose wordsBug
WORDSNET-13613Alignment of a list item imported from HTML gets incorrect after Indent+Outdent or Remove+InsertBug
WORDSNET-13631Text font’s color is lost after re-saving RTFBug
WORDSNET-13641Images are inverted after conversion from Doc to PdfBug
WORDSNET-13672/format revision/ Formatting markup changes are not rendered in PDFBug
WORDSNET-13681Two empty pages appear in output document after re-saving RTFBug
WORDSNET-13685Docx to Pdf conversion issue with ListLabelBug
WORDSNET-13706Corrupted document is generated on saving as DOCXBug
WORDSNET-13708Doc to Pdf conversion issue with textbox’s text renderingBug
WORDSNET-13710Chart x-Axis is rendered incorrectly in output Pdf when DataTable is visibleBug
WORDSNET-13715NumPages field value in PDF is not according to the culture/languageBug
WORDSNET-13716NumPages field value in PDF is not according to the culture/languageBug
WORDSNET-13717SECTIONPAGES field value in PDF is not according to the culture/languageBug
WORDSNET-13723Docx to Pdf conversion issue with SmartArt renderingBug
WORDSNET-13733Document.UpdateFields does not update Formula field inside TableBug
WORDSNET-13747/footnote balancing/ Footnote separator is overlapped with body text in output PdfBug
WORDSNET-13753Images in GroupShape become inverted when saving to PDFBug
WORDSNET-13758Document’s footer and some text elements will be rendered with the Error! No text of specified style in documentBug
WORDSNET-13760Table’s merged cells are repeated after re-saving RtfBug
WORDSNET-13777FileFormatInfo.LoadFormat : Text document format detected as UnknownBug
WORDSNET-13781A picture in HtmlFixed repeatsBug
WORDSNET-13786Text font’s color is lost after re-saving RTFBug
WORDSNET-13805Shape’s text color is lost after conversion from Docx to PdfBug
WORDSNET-13806Exception occured while saving MathML to DOC documentBug
WORDSNET-13814DocumentBuilder.InsertHtml renders a blank Math equationBug
WORDSNET-13819Contents render on previous page in output PdfBug
WORDSNET-13820Docx to Pdf conversion issue with table’s rendering in HtmlFixed/PdfBug
WORDSNET-13827Local document link incorrect when inside a shape (PDF)Bug
WORDSNET-13828Office MathML matrix equation in PDF has too much spacingBug
WORDSNET-13833Doc to HtmlFixed conversion issue with OLEBug
WORDSNET-13839MathMLReader ignores accents in some casesBug
WORDSNET-13862MailMerge.Execute does not update IF field when it is inside tableBug
WORDSNET-13897State of checkbox SDT is lost after conversion from Docx to Doc/Fixed file formatBug
WORDSNET-13898Checkbox (SDT ) does not render correctly in PdfBug
WORDSNET-13899Numbers in hebrew text are reversed after conversion from Docx to PdfBug
WORDSNET-13903Problem converting Document with data bindings to PDFBug
WORDSNET-13917InvalidOperationException is thrown upon rendering.Bug
WORDSNET-13947SmartArt text is overlapped in output PdfBug
WORDSNET-3766/hidden/ Hidden content remains when rendered to PDFBug
WORDSNET-3878/table grid/ Table width is incorrect during HTML to PDF conversion, if table contains very long link url.Bug
WORDSNET-4572/table grid/ Width of table is incorrect during rendering.Bug
WORDSNET-4810Nested lists with DIV tags are not properly imported from HTML.Bug
WORDSNET-5642/revision marks/ Deleted bullets/Listitems appear again when converting to PDFBug
WORDSNET-6320Table does not render across pages in PDFBug
WORDSNET-6490Header formatting lost during conversion DOCX to HTMLBug
WORDSNET-7868/nonstandard font/ Incorrect fonts are used during rendering to PDFBug
WORDSNET-7911/nonstandard font/ Docx to PDF conversion issue with Arabic text fontsBug
WORDSNET-8219DOC to HTML conversion issue with border linesBug
WORDSNET-8621Bug: ‘font-weight’ from default CSS style is applied as direct formattingBug
WORDSNET-8651SUM(ABOVE) not correct working with values in bracketsBug
WORDSNET-8932Vertical spacing between some table rows is not preserved in PDFBug
WORDSNET-9258The checkbox position is incorrect after conversion from HTML to PdfBug
WORDSNET-9357Problem with Top Margin when converting DOC to PDFBug
WORDSNET-9444Document.Save does not preserve the FormFieldBug
WORDSNET-1252Improve Range.Replace to support breaksEnhancement
WORDSNET-13676Assertion for unknown shape property when opening a documentEnhancement
WORDSNET-13817Improve font substitution in case when embedded font and substitute availableEnhancement
WORDSNET-12078Range.Replace method throws System.NotSupportedExceptionException
WORDSNET-12954Document.Range.Replace is throwing exception when isForward is set to trueException
WORDSNET-13046Range.Replace throws System.NotSupportedExceptionException
WORDSNET-13105Document.UpdateFields throws System.IndexOutOfRangeExceptionException
WORDSNET-13138Document.Range.Replace throws exception when isForward is set to trueException
WORDSNET-13364Document.PageCount throws “Index was outside the bounds of the array” exceptionException
WORDSNET-13500DocumentBuilder.InsertHtml throws System.NullReferenceExceptionException
WORDSNET-13545NodeCollection.Clear throws System.InvalidOperationExceptionException
WORDSNET-13573Document.PageCount throws “Index was outside the bounds of the array” exceptionException
WORDSNET-13574Aspose.Words.FileCorruptedException occurs upon loading WordML filesException
WORDSNET-13684Document.AcceptAllRevisions throws System.InvalidOperationExceptionException
WORDSNET-13686Aspose.Words.FileCorruptedException is thrown while loading DocxException
WORDSNET-13735Aspose.Words.16.4.0 Exception when signing a password-protected Words file with a digital signatureException
WORDSNET-13767MailMerge.Execute throws System.InvalidCastExceptionException
WORDSNET-13773System.NullReferenceException occurs during converting DOC to PDFException
WORDSNET-13807System.ArgumentException is thrown while saving Docx to pdfException
WORDSNET-13813System.IndexOutOfRangeException is thrown while saving docx to pdfException
WORDSNET-13815System.InvalidOperationException is thrown while conversion of Docx to PdfException
WORDSNET-13830Document.UpdateFields throws System.InvalidOperationExceptionException
WORDSNET-13831Aspose.Words.FileCorruptedException is thrown while loading DocException
WORDSNET-13834System.NullReferenceException during converting to PDF/HTMLException
WORDSNET-13836Out of memory exception occurs during rendering to PDFException
WORDSNET-13838System.NullReferenceException during converting to PDFException
WORDSNET-13841System.OverflowException occurs upon rendering to TIFFException
WORDSNET-13843Length cannot be less than zero exception occurs during Word to PDF/HTML conversionException
WORDSNET-13844Length cannot be less than zero exception occurs during Word to PDF/HTML conversionException
WORDSNET-13845Length cannot be less than zero exception occurs during Word to PDF/HTML conversionException
WORDSNET-13846Aspose.Words.FileCorruptedException occurs upon loading a DOCXException
WORDSNET-13848Attempted to divide by zero exception occurs during renderingException
WORDSNET-13858LayoutEnumerator constructor throws System.NullReferenceExceptionException
WORDSNET-13904NullReferenceException occurs when converting from Word to PDFException
WORDSNET-13911Document.AppendChild throws System.NullReferenceExceptionException
WORDSNET-13932Document.PageCount throws System.IndexOutOfRangeExceptionException
WORDSNET-13936Document.AcceptAllRevisions throws System.InvalidOperationExceptionException
WORDSNET-2847NullReferenceException occurs during ReplaceException
WORDSNET-7456NullReferenceException occurs when performing a find and replace operationException
WORDSNET-8404Document.UpdateFields throws System.NullReferenceException exceptionException
WORDSNET-8558System.NullReferenceException is thrown while conversion from Docx to fixed file format.Exception
WORDSNET-10085/Show revisions in balloons/ Support rendering of revisions inside of balloons rather than inlineFeature
WORDSNET-10086/Show revisions in balloons/ Images from Markup Area are rendered in the middle of main content area in PDFFeature
WORDSNET-10988/format revision/ Add feature to show format revision in pdfFeature
WORDSNET-12753/format revision/ Add feature to show format revision in pdfFeature
WORDSNET-12891Convert OfficeMath nodes into MathMLFeature
WORDSNET-13537Provide ability to create mathematical equation from MathML stringFeature
WORDSNET-13566Add feature to format string values in Linq Reporting EngineFeature
WORDSNET-13603Import html image tag with height only (or width only) proportionallyFeature
WORDSNET-13734Add new save format in ImageSaveOptions as SaveFormat.GIFFeature
WORDSNET-13768Non ECMA-367 documents with CustomXML issue with Microsoft Word OnlineFeature
WORDSNET-3827Allow embedding fonts into DOCX documents.Feature
WORDSNET-4285Support the SKIPIF mailmerge fieldFeature
WORDSNET-6205Export W3C MathML formulas to HTMLFeature
WORDSNET-8752Ruby (Equation) field does not import in Aspose.Words DOMFeature
WORDSNET-13575Cells widths are changed after joining the tablesRegression
WORDSNET-13585Aspose.Words.FileCorruptedException is thrown while loading DocxRegression
WORDSNET-13920Japanese ruby text does not render correctly in output pdfRegression

Public API and Backward Incompatible Changes

This section lists public API changes that were introduced in Aspose.Words 16.7.0. 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.

Added Public Methods to the DigitalSignatureUtil Class that Allow to Specify a Password for Decrypting Document before it will be Signed.

WORDSNET-13735 is resolved and we have added following static methods for signing encrypted documents:

public static void Sign(string srcFileName, string dstFileName, CertificateHolder certHolder, string comments, DateTime signTime, string srcPassword);
public static void Sign(Stream srcStream, Stream dstStream, CertificateHolder certHolder, string comments, DateTime signTime, string srcPassword);

Methods sign source file or stream using given certificate holder and writes signed document to destination file/stream. In the last parameter you can specify a password for decrypting source document. If document is not encrypted this parameter will be ignored. Also, this is meaningful only if source document has DOCX format.

UC1 (working with file)

// Create certificate holder from a file.
CertificateHolder cert = CertificateHolder.Create("certFileName", "certPassword");

// Digitally sign encrypted with "docPassword" document in the specified path.
DigitalSignatureUtil.Sign("srcDocFileName", "signedDocFileName", cert, "Comment", DateTime.Now, "docPassword");

// Open encrypted document from a file.
Document signedDoc = new Document("signedDocFileName", new LoadOptions("docPassword"));

// Check that encrypted document was successfully signed.
DigitalSignatureCollection signatures = doc.DigitalSignatures;
if (signatures.IsValid && (signatures.Count > 0))
  Console.WriteLine("The document was signed successfully.")

UC2 (working with stream)

// Create certificate holder from a file.
CertificateHolder cert = CertificateHolder.Create("certFileName", "certPassword");

// Digitally sign encrypted with "docPassword" document in the specified stream.
DigitalSignatureUtil.Sign(srcDocStream, signedDocStream, cert, "Comment", DateTime.Now, "docPassword");

// Open encrypted document from a stream.
Document signedDoc = new Document("signedDocStream", new LoadOptions("docPassword"));

// Check that encrypted document was successfully signed.
DigitalSignatureCollection signatures = doc.DigitalSignatures;
if (signatures.IsValid && (signatures.Count > 0))
  Console.WriteLine("The document was signed successfully.")

A Document Page can now be Saved in GIF Format

The document page can now be saved into GIF format just like any other image formats. A new ‘Gif’ member is added into ‘SaveFormat’ enum.

Aspose.Words for .NET uses standard GIF codec provided by GDI+. Aspose.Words for Java uses standard GIF codec provided by ImageIO.

Sample code:

// Open some document.
Document doc = new Document("mydocument.docx");

// Save the second page as GIF image.
ImageSaveOptions saveOptions = new ImageSaveOptions(SaveFormat.Gif);
saveOptions.PageIndex = 1;
doc.Save("mydocument.gif", saveOptions);

Exposed more String and Number Formats for Expression Results in LINQ Reporting Engine

The “Outputting Expression Results” section of the engine’s documentation was updated to describe the change.

MsWordVersion Enum Moved to Aspose.Words.Settings

Customers will now have to use 

using Aspose.Words.Settings;

to work with MsWordVersion.

This however should not be a breaking change as presently CompatibilityOptions.OptimizeFor is the only method that uses MsWordVersion enum and is already a member of Aspose.Words.Settings namespace.

ReplaceAction, IReplacingCallback and ReplacingArgs Moved to Aspose.Words.Replacing

During WORDSNET-1252 implementation we decided to create new namespace Aspose.Words.Replacing and move classes related to find/replace operations to this new namespace.

WORDSNET-1252. Advanced replace methods

Two methods were added to class Range to support advanced find/replace operations.

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

These methods support breaks in both search pattern and replacement string. Customer needs to use special meta-characters to specify breaks: &p for paragraph break, &b for section break, &m for page break and &l for manual line break.Also new FindReplaceOptions class was introduced to hold all find/replace options. Most notable member of this class is ApplyFont/ApplyParagraphFormat. It allow to specify text/paragraph formatting to be applied to replacement text.

Below are couple examples.

UC1

Demonstrate how breaks support works. In this example we replace certain paragraph breaks with new paragraph breaks + some underline while make it centered. Additionally we replace custom text tag with section break.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.Font.Name = "Arial";
builder.Writeln("First section");
builder.Writeln("  1st paragraph");
builder.Writeln("  2nd paragraph");
builder.Writeln("{insert-section}");
builder.Writeln("Second section");
builder.Writeln("  1st paragraph");
FindReplaceOptions options = new FindReplaceOptions();
options.ApplyParagraphFormat.Alignment = ParagraphAlignment.Center;

// Double each paragraph break after word "section", add kind of underline and make it centered.
int count = doc.Range.Replace("section&p", "section&p----------------------&p", options);

// Insert section break instead of custom text tag.
count = doc.Range.Replace("{insert-section}", "&b", options);

UC2

Demonstrates usage of apply formatting and customer callback. In this example we replace numbers with their hexadecimal representations while make them highlighted with color.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.Font.Name = "Arial";
builder.Write("There are few numbers that should be converted to HEX and highlighted: 123, 456, 789 and 17379.");
FindReplaceOptions options = new FindReplaceOptions();

// Highlight newly inserted content.
options.ApplyFont.HighlightColor = Color.DarkOrange;
options.ReplacingCallback = new NumberHexer();
int count = doc.Range.Replace(new Regex("[0-9]+"), "", options);

// Customer defined callback.
private class NumberHexer : IReplacingCallback
{
    public ReplaceAction Replacing(ReplacingArgs args)
    {
        // Parse numbers.
        int number = Convert.ToInt32(args.Match.Value);

        // And write it as HEX.
        args.Replacement = string.Format("0x{0:X}", number);
        return ReplaceAction.Replace;
    }
}

Some improvements were made to make replace method to be isolated from changes made by customer in callback.

Deprecated methods

Old Replace methods are left for backward compatibility but marked as obsolete.

We going to remove following methods in this year:

public int Replace(string oldValue, string newValue, bool isMatchCase, bool isMatchWholeWord)
public int Replace(Regex pattern, IReplacingCallback handler, bool isForward)

One old method

public int Replace(Regex pattern, string replacement)

continues to work with old code and will be switched to new code eventually.

WORDSNET-4285 - SKIPIF field supported

This feature has been requested by a few customers and we have it implemented now. SKIPIF field is now updated during mail merge.

WORDSNET-6205 Added Support for MathML in HTML Export

WORDSNET-6205 is implemented.

Added support for MathML in HTML export.

The following property is added to HtmlSaveOptions class:

/// <summary>
/// Controls how OfficeMath objects are exported to HTML, MHTML or EPUB.
/// Default value is <c>HtmlOfficeMathOutputMode.Image</c>.
/// </summary>
public HtmlOfficeMathOutputMode OfficeMathOutputMode
{
    get { return mOfficeMathOutputMode; }
    set { mOfficeMathOutputMode = value; }
}

The following enum is publicly available:

/// <summary>
/// Specifies how Aspose.Words exports OfficeMath to HTML, MHTML and EPUB.
/// </summary>
public enum HtmlOfficeMathOutputMode
{
    /// <summary>
    /// OfficeMath is converted to HTML as image specified by <img> tag.
    /// </summary>
    Image,
    /// <summary>
    /// OfficeMath is converted to HTML using MathML.
    /// </summary>
    MathML,
    /// <summary>
    /// OfficeMath is converted to HTML as sequence of runs specified by <span> tags.
    /// </summary>
    Text
}

Sample output for simple OfficeMath equation exported using HtmlOfficeMathOutputMode.Image value:

<img src="Test Out.001.png" width="49" height="21" alt="" />

Sample output for simple OfficeMath equation exported using HtmlOfficeMathOutputMode.MathML value:

<math xmlns="https://www.w3.org/1998/Math/MathML">
	<mi>A</mi>
	<mo>=</mo>
	<mi>π</mi>
	<msup>
		<mrow>
			<mi>r</mi>
		</mrow>
		<mrow>
			<mn>2</mn>
		</mrow>
	</msup>
</math>

Sample output for simple OfficeMath equation exported using HtmlOfficeMathOutputMode.Text value:

<span style="font-family:'Cambria Math'">A=π</span><span style="font-family:'Cambria Math'">r</span><span style="font-family:'Cambria Math'">2</span>

WORDSNET-12901 Implemented API for Adding or Removing Embedded Fonts

WORDSNET-12901 is implemented.

Added following properties to FontInfoCollection class:

/// <summary>
/// Specifies whether or not to embed TrueType fonts in a document when it is saved.
/// Default value for this property is <b>false</b>.
/// </summary>
/// <remarks>
/// <para>Embedding TrueType fonts allows others to view the document with the same fonts that were used to create it,
/// but may substantially increase the document size.</para>
/// <para>This option works for DOC, DOCX and RTF formats only.</para>
/// </remarks>
public bool EmbedTrueTypeFonts
/// <summary>
/// <para>Specifies whether or not to embed System fonts into the document.
/// Default value for this property is <b>false</b>.</para>
/// <para>This option works only when <see cref="EmbedTrueTypeFonts"/> option is set to <b>true</b>.</para>
/// </summary>
/// <remarks>
/// <para>
/// Setting this property to <c>True</c> is useful if the user is on an East Asian system
/// and wants to create a document that is readable by others who do not have fonts for that
/// language on their system. For example, a user on a Japanese system could choose to embed the
/// fonts in a document so that the Japanese document would be readable on all systems.
/// </para>
/// <para>This option works for DOC, DOCX and RTF formats only.</para>
/// </remarks>
public bool EmbedSystemFonts
/// <summary>
/// <para>Specifies whether or not to save a subset of the embedded TrueType fonts with the document.
/// Default value for this property is <b>false</b>.</para>
/// <para>This option works only when <see cref="EmbedTrueTypeFonts"/> property is set to <b>true</b>.</para>
/// </summary>
/// <remarks>
/// This option works for DOC, DOCX and RTF formats only.
/// </remarks>
public bool SaveSubsetFonts
// UC1 - Save document with embedded TrueType fonts. System fonts are not included. Saves full versions of embedding fonts.
Document doc = new Document("fileName");
FontInfoCollection fontInfos = doc.FontInfos;
fontInfos.EmbedTrueTypeFonts = true;
fontInfos.EmbedSystemFonts = false;
fontInfos.SaveSubsetFonts = false;
doc.Save("DocWithEmbeddedFonts");
// UC2 - Save document with embedded TrueType fonts. System fonts are included. Saves full versions of embedding fonts.
Document doc = new Document("fileName");
FontInfoCollection fontInfos = doc.FontInfos;
fontInfos.EmbedTrueTypeFonts = true;
fontInfos.EmbedSystemFonts = true;
fontInfos.SaveSubsetFonts = false;
doc.Save("DocWithEmbeddedFonts");
// UC3 - Save document with embedded TrueType fonts. System fonts are included. Saves subset of embedding fonts.
Document doc = new Document("fileName");
FontInfoCollection fontInfos = doc.FontInfos;
fontInfos.EmbedTrueTypeFonts = true;
fontInfos.EmbedSystemFonts = true;
fontInfos.SaveSubsetFonts = true;
doc.Save("DocWithEmbeddedFonts");
// UC4 -  Save document with embedded TrueType fonts. System fonts are not included. Saves subset of embedding fonts.
Document doc = new Document("fileName");
FontInfoCollection fontInfos = doc.FontInfos;
fontInfos.EmbedTrueTypeFonts = true;
fontInfos.EmbedSystemFonts = false;
fontInfos.SaveSubsetFonts = true;
doc.Save("DocWithEmbeddedFonts");
// UC5 -  Remove embedded fonts from the saved document.
Document doc = new Document("fileName");
FontInfoCollection fontInfos = doc.FontInfos;
fontInfos.EmbedTrueTypeFonts = false;
doc.Save("DocWithoutEmbeddedFonts");

WORDSNET-13817 Font Substitution Rules Improved

Improvement is made in case when specific font is not installed but is embedded into the document and a substitute for this font is assigned.

Previously font substitute was used in this case. Now embedded font is used.