Aspose.Words for .NET 20.12 Release Notes

Major Features

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

  • Verified Aspose.Words for .NET Standard works with .NET 5.0.
  • Added an ability to embed PostScript Fonts upon saving documents.
  • Implemented condition evaluation extension point.
  • Provided an option to import styles from a dynamically inserted document for LINQ Reporting Engine.

Full List of Issues Covering all Changes in this Release

KeySummaryCategory
WORDSNET-16895Add feature to insert style separator using DOMNew Feature
WORDSNET-20552LINQ Reporting Engine - Provide a way to import styles from a dynamically inserted documentNew Feature
WORDSNET-18827Add option to perform memory optimization while loading documentNew Feature
WORDSNET-21432Check Aspose.Words for .NET Standard works with .NET 5.0New Feature
WORDSNET-21102Add feature to export inserted SVG as SVG in media folderNew Feature
WORDSNET-21441Provide access to common StructuredDocumentRangeStart propertiesNew Feature
WORDSNET-11665Macros better support including read/add/delete/import/editNew Feature
WORDSNET-18804ManualLayout settings in dataLabel extLst should be taken into accountEnhancement
WORDSNET-3863Consider exposing FontAttr.SpecialHidden propertyEnhancement
WORDSNET-12430Word spell checker not activated in converted DOCXEnhancement
WORDSNET-14063ODT to PDF conversion issue with table’s renderingEnhancement
WORDSNET-21251Contents of document are lost after DOCX to PDFBug
WORDSNET-17941Text in table’s cell is rendered on next line in output PDFBug
WORDSNET-21467“Unrecognized operand value in the formula.” exception when open document DOCX fileBug
WORDSNET-20722Aspose.Words.FileCorruptedException occurs upon loading a DOCXBug
WORDSNET-21485List numbering updates when KeepSourceNumbering is trueBug
WORDSNET-21331Incomplete rendering of barcode in TIFFBug
WORDSNET-21337Loading as RTF format: System.NotSupportedException: ‘Memory stream is not expandable.’Bug
WORDSNET-21346Hidden text in Word is shown on Aspose rendered PDFBug
WORDSNET-21349The w14:docId has been removed after re-savingBug
WORDSNET-21017Comments structure is not correct after generating document by LINQ ReportingBug
WORDSNET-21371Fixed layout HTML from Word does not print correctlyBug
WORDSNET-20711Reporting engine does not populate all data when JSON data source is usedBug
WORDSNET-21373Root resource is not found in a multipart structure exception when opening MHT fileBug
WORDSNET-21347Document Comparison-Redlining is not accurateBug
WORDSNET-20816Text language is changed from Hebrew to Arabic after DOCX>HTML>DOCXBug
WORDSNET-21378System.NullReferenceException is thrown while saving RTF to PDFBug
WORDSNET-21380UpdateFields causes Process to hang after optimizing for Word 2016Bug
WORDSNET-17565Saving a word document as PDF cuts off some footer textBug
WORDSNET-18375Property PageCount returns more pages than exist in documentBug
WORDSNET-21385System.ArgumentOutOfRangeException is thrown while saving DOCX to TXTBug
WORDSNET-20997Document.Compare produces revisions for unchanged imagesBug
WORDSNET-21402Process hangs during DOCX to PDF conversionBug
WORDSNET-19255Debug.Assert failure in the layout code when a DOCX document is converted to PDFBug
WORDSNET-20364Table aligment and font issue after DOCX - HTML - DOCX conversionBug
WORDSNET-19042Different Non Visual Properties for images (nvPicPr) in the same documentBug
WORDSNET-20704Tab Stops of style are incorrect after copying styleBug
WORDSNET-18646Small ellipses are deformed on renderingBug
WORDSNET-20404Chart Title should Render in Three Lines when Converting to ImageBug
WORDSNET-16702Provide RenderToSize and RenderToScale methods through SkiaSharp.SKCanvasBug
WORDSNET-20007Parent node of Run node returns null after replacing text of Run nodeBug
WORDSNET-20267insertHTML - Big image containing math equations not visible in WordBug
WORDSNET-21218Left Indent lost after Appending DocumentBug
WORDSNET-21411Incorrect rendering of charts that contains series without Y-values (only X-valyes)Bug
WORDSNET-21413Character spacing problem for Wingdings, Symbol upon RTF to PDF ConversionBug
WORDSNET-19312System.InvalidOperationException - too many styles in the documentBug
WORDSNET-19787Document.Save does not save MHTML to PDFBug
WORDSNET-21230Table border size is increased after joining documentsBug
WORDSNET-20709Unable to Extract Content from BookmarksBug
WORDSNET-21232Long hand format lost if value over a billionBug
WORDSNET-20752MHTML to PDF fails to completeBug
WORDSNET-21236Calling UpdateFields before Rendering causes many Error! Reference source not foundBug
WORDSNET-20767Table row is pushed in MW and not pushed in AWBug
WORDSNET-20773Incorrect comparison of WordsBug
WORDSNET-20776Document can’t be loadedBug
WORDSNET-20160Document comparison result is different comparing to MS Word resultBug
WORDSNET-20173MHTML to PDF conversion lasts for too longBug
WORDSNET-20553BookmarkEnd is created in another node DOCX is saved to HTMLBug
WORDSNET-21428Extra missing line text cut off in PDF converted from the latest Aspose.WordsBug
WORDSNET-21242System.ArgumentException is thrown while saving DOCX to HTMLBug
WORDSNET-21430JsonDataSource throws System.Data.DuplicateNameExceptionBug
WORDSNET-21100DOCX to HTML conversion issue with text shifting in tables cell using C#Bug
WORDSNET-21302System.Text.DecoderFallbackException and System.Xml.XmlExceptionBug
WORDSNET-21248Duplicate message content in converted PDF for SMIME Outlook Message conversion to PDFBug
WORDSNET-20874DOCX to PDF conversion issue with list item renderingBug
WORDSNET-21436w14:paraId and w14:textId removed after re-saving the documentBug
WORDSNET-21254InvalidCastException while load document in .netcoreBug
WORDSNET-21405Image is inserted incorrectly into textbox after mail mergeBug
WORDSNET-21255System.ArgumentOutOfRangeException: ‘Index was out of range.’ is shown during UpdatePageLayout()Bug
WORDSNET-20897HtmlSaveOptions.ScaleImageToShapeSize has no effectBug
WORDSNET-20515Spell Check Disabled after Aspose.Words’ Find and Replace OperationBug
WORDSNET-20910A long paragraph with shape near the bottom occupies many pagesBug
WORDSNET-19275Numbering chapters disappear during appending documentsBug
WORDSNET-21119Incorrect rendering of series data label of PieChart.Bug
WORDSNET-20937System.InvalidCastException is thrown while saving DOCX to HTMLBug
WORDSNET-21132The root element “Document” is missing in document structure of PDFBug
WORDSNET-20947DOCX to PDF conversion issue with rectangle shape renderingBug
WORDSNET-20948DOCX to PDF conversion issue with shapeBug
WORDSNET-20951Fill in Document.CompatibilityOptions according to LoadOptions.MswVersion when loading HTMLBug
WORDSNET-21139HtmlFixedSave mirror hebrew inside shapesBug
WORDSNET-21393Unexpected page break in table issue - RTF to PDFBug
WORDSNET-16606DOCX to PDF conversion error: java.lang.IllegalStateException: Infinite loop detectedBug
WORDSNET-20737DOCX to PDF conversion issue with comment renderingBug
WORDSNET-21146Table rows are rendered on the next page after DOCX to PDF conversionBug
WORDSNET-21463An exception was thrown while activating Kzb -> bec -> ?:_adB upon PDF import on .NET 5.0Bug
WORDSNET-21276Misaligned text and extra wrap in inserted SVGBug
WORDSNET-21278Document.Compare generates the incorrect revisionsBug
WORDSNET-21468FileLoadException while opening PDF document.Bug
WORDSNET-20658Conversion time issue while converting PDF to DOCXBug
WORDSNET-21296Paragraphs are changed to number list after joining documentBug
WORDSNET-21308Empty extracted pageBug
WORDSNET-21303Text from chevron list  (SmartArt Shape) rendered upside down in Html FixedBug
WORDSNET-20760Issue rendering quote characters that appear inside of p, div or blockquote tagsBug
WORDSNET-9499A DrawingML in Cell is pushed a few inches to the right in PDFBug
WORDSNET-9833Document.PageCount returns wrong valueBug
WORDSNET-10251Text renders outside the right page edge in PDFBug
WORDSNET-10180DOCX to PDF conversion issue with content positionBug
WORDSNET-16093Text overlapping in rendered PDFBug
WORDSNET-20822DOCX to PDF conversion issue with image qualityBug
WORDSNET-21287Image is lost after conversion from HTML to DOCXBug
WORDSNET-11193Footnote and text position is changed after conversion from DOCX to PDF/PNGBug
WORDSNET-10046A DrawingML overlaps the content of TableBug
WORDSNET-16693TestDefect3702 image has incorrect dimensionsBug
WORDSNET-20971Page Count issueBug
WORDSNET-12923DOCX to PDF conversion issue with shape’s positionBug
WORDSNET-9834PAGE field value is calculated incorrectlyBug
WORDSNET-16094Incorrect text rendering order in resultant PDFBug

Public API and Backward Incompatible Changes

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

Related issue: WORDSNET-21120

Added a new public property SaveOptions.AllowEmbeddingPostScriptFonts:

/// <summary>
/// Gets or sets a boolean value indicating whether to allow embedding fonts with PostScript outlines
/// when embedding TrueType fonts in a document upon it is saved.
/// The default value is false<.
/// </summary>
/// <remarks>
/// <para>Note, Word does not embed PostScript fonts, but can open documents with embedded fonts of this type.</para>
/// <para>This option only works when <see cref="FontInfoCollection.EmbedTrueTypeFonts"/> of the
/// <see cref="DocumentBase.FontInfos"/> property is set to true.</para>
/// </remarks>
public bool AllowEmbeddingPostScriptFonts { get; set; }

Use Case:

const string testDir = "\\TestDir\\";
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
 
// Create some content that will use PostScript font.
builder.Font.Name = "PostScriptFont";
builder.Writeln("Some text with PostScript font.");
 
// Load the font with PostScript to use in the document.
FontSourceBase otf = new MemoryFontSource(File.ReadAllBytes(testDir + "PostScriptFont.otf"));
FontSourceBase[] sources = new FontSourceBase[] {otf};
doc.FontSettings = new FontSettings();
doc.FontSettings.SetFontsSources(sources);
 
// Embed TrueType fonts.
doc.FontInfos.EmbedTrueTypeFonts = true;
// Allow embedding PostScript fonts while embedding TrueType fonts.
SaveOptions saveOptions = SaveOptions.CreateSaveOptions(SaveFormat.Docx);
saveOptions.AllowEmbeddingPostScriptFonts = true;
 
// Save document with embedded PostScript font.
doc.Save(testDir + "out.docx", saveOptions);

Changed DocumentBuilder.InsertImage behavior when insert SVG images

We changed DocumentBuilder.InsertImage behavior when insert SVG. Earlier Aspose.Words inserted SVG as EMF metafile to keep the inserted image in vector representation. Now AW inserts SVG as PNG with svgBlip extension that contain the original SVG image, just like MS Word does.

Use Case 1:

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.InsertImage("test.svg");
doc.Save("out.docx");

SVG image is inserted into the document as PNG with svgBlip extension that contains the original vector SVG image representation.

Use Case 2 - Document is saved in old MS Word format:

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.InsertImage("test.svg");
doc.Save("out.doc");

SVG image is saved to output document as PNG, just like MS Word does.

Use Case 3 - Document is optimized for old versions of MS Word using OptimizeFor method:

Document doc = new Document();
doc.CompatibilityOptions.OptimizeFor(Settings.MsWordVersion.Word2003);
DocumentBuilder builder = new DocumentBuilder(doc);
builder.InsertImage("test.svg");
doc.Save("out.doc");

SVG is inserted into the document as EMF metafile to keep the image in vector representation (old Aspose.Word behavior).

Changed version of MS Word during import Html

Related issue: WORDSNET-20364

Previously, the LoadOptions.MswVersion property had no effect when loading documents from HTML and HTML-based formats (for example, MHTML). All documents were loaded as if no MswVersion were specified. This has been changed and now the HTML reader may load documents differently depending on the value of MswVersion. Since the default value of MswVersion is MsWordVersion.Word2019, by default HTML documents are loaded as if they are opened by MS Word 2019.

Customer may change this behavior by specifying the required version of MS Word in LoadOptions. For example:

LoadOptions loadOptions = new LoadOptions();
loadOptions.MswVersion = Settings.MsWordVersion.Word2010;
Document doc = new Document("in.html", loadOptions);

Implemented condition evaluation extension point

Related issue: WORDSNET-20913

We have implemented extension point for condition evaluation. This allows users to implement custom evaluation for the IF and COMPARE fields.

/// <summary>
/// The comparison expression.
/// </summary>
public sealed class ComparisonExpression
{
	/// <summary>
	/// Gets left expression.
	/// </summary>
	public string LeftExpression { get; }
 
	/// <summary>
	/// Gets comparison operator.
	/// </summary>
	public string ComparisonOperator { get; }
 
	/// <summary>
	/// Gets right expression.
	/// </summary>
	public string RightExpression { get; }
}

public sealed class ComparisonEvaluationResult
{
	/// <summary>
	/// Creates comparison evaluation result.
	/// </summary>
	public ComparisonEvaluationResult(bool result)
	{
		// ...
	}
 
	/// <summary>
	/// Creates failed comparison evaluation result with corresponding error message.
	/// </summary>
	public ComparisonEvaluationResult(string errorMessage)
	{
		// ...
	}
 
	/// <summary>
	/// Gets comparison evaluation result. 
	/// </summary>
	public bool Result { get; }
 
	/// <summary>
	/// Gets failed comparison evaluation result error message.
	/// </summary>
	public string ErrorMessage { get; }
}

/// <summary>
/// When implemented allows to override default comparison expressions evaluation for the <see cref="FieldIf"/> and <see cref="FieldCompare"/> fields.
/// </summary>
/// <seealso cref="FieldOptions.ComparisonExpressionEvaluator"/>
public interface IComparisonExpressionEvaluator
{
	/// <summary>
	/// Evaluates comparison expression.
	/// </summary>
	/// <remarks>
	/// The implementation should return <b>null</b> to indicate that the default evaluation should be performed.
	/// </remarks>
	ComparisonEvaluationResult Evaluate(Field field, ComparisonExpression expresion);
}

public sealed class FieldOptions
{
	/// <summary>
	/// Gets or sets the field comparison expressions evaluator.
	/// </summary>
	/// <seealso cref="IComparisonExpressionEvaluator"/>
	public IComparisonExpressionEvaluator ComparisonExpressionEvaluator { get; set; }
}

Use Case:

public class ComparisonExpressionEvaluator : IComparisonExpressionEvaluator
{
	public ComparisonExpressionEvaluator(ComparisonEvaluationResult result)
	{
		mResult = result;
	}
 
	public ComparisonEvaluationResult Evaluate(Field field, ComparisonExpression expresion)
	{
		return mResult;
	}
 
	private readonly ComparisonEvaluationResult mResult;
}


ComparisonEvaluationResult result = new ComparisonEvaluationResult(true);
ComparisonExpressionEvaluator evaluator = new ComparisonExpressionEvaluator(result);
 
document.FieldOptions.ComparisonExpressionEvaluator = evaluator;

Provided an option to import styles from a dynamically inserted document for LINQ Reporting Engine

Related issue: WORDSNET-20552

The “Inserting Documents Dynamically” section of the engine’s documentation was updated to describe the change.