Aspose.Words for .NET 18.2 Release Notes

Major Features

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

  • FontSettings.EnableFontSubstitution option added
  • Support to insert Style Separator to put different Paragraph styles
  • HtmlSaveOptions.MetafileFormat property added 
  • KeepSourceFormatting logic improved
  • Rendering of SVG graphics elements embedded into DrawingML objects (svgBlip) implemented
  • Added option to disable the internal font substitution mechanism and use the default font instead while rendering to PDF. (FontSettings.EnableFontSubstitution)
  • Fixed “Compound lines are not supported” warning generation
  • Rendering of “DFKai-SB" TrueType font fixed
  • Fixed problem with path gradient brush scaling while rendering metafiles
  • Spacing  between legend items in DrawingML Charts rendering fixed
  • The data series line with “Round” cap type is rendered properly when exporting DrawingML Charts into PDF now
  • Rotated VML text boxes with non-default alignment rendering fixed
  • Auto-size calculation of rotated VML text boxes with vertical layout fixed
  • Implemented none wrapping for text frames
  • Improved paragraph spacing computation with hidden paragraphs
  • Improved custom tab stops handling around hidden paragraphs
  • Improved line wrapping around dashes
  • Improved character spacing control for complex code point sequences
  • Improved processing of out-of-order footnotes
  • Implemented mirror margins and gutter position handling when page orientation changes
  • Improved performance of reflow when document is large and has fields in headers/footers
  • Fixed text box width issue with left-aligned RTL text

Full List of Issues Covering all Changes in this Release

WORDSNET-10413Text of WordArt is rotated after conversion from RTF to PdfBug
WORDSNET-10616Docx to Pdf conversion issue wiht chart’s legendBug
WORDSNET-10624Docx to RTF conversion issue with French charactersBug
WORDSNET-10863Text position is changed after convert Docx to PdfBug
WORDSNET-11628The layout of WordML is corrupted after re-saving WordMLBug
WORDSNET-12364Text color of shape is changed in output Doc/Docx/PdfBug
WORDSNET-12532Some Words in Paragraph moved to second line during rendering to HtmlFixedBug
WORDSNET-12728VML textboxes with layoutflow are rendered improperly.Bug
WORDSNET-13292More space between some words added in pdfBug
WORDSNET-13502Non-English Paragraph text is stretched in rendered documentBug
WORDSNET-13802Aspose.Words.FileCorruptedException is thrown while loading OdtBug
WORDSNET-14315SVG does not render correctly in output Html/PdfBug
WORDSNET-14316Font of SVG is lost in output Html/PdfBug
WORDSNET-14391Chinese text moves to next line after conversion from Docx to Pdf/PngBug
WORDSNET-14587Font size of text is changed when InsertDocument is used with KeepSourceFormatting modeBug
WORDSNET-14755Layout problems in rendered PDFBug
WORDSNET-14842Doc to Pdf conversion issue with Hebrew text positionBug
WORDSNET-15153AppendDocument method is not preserving numberingBug
WORDSNET-15474ODT does not open in MS Word 2016 after conversion from DOCXBug
WORDSNET-15536The document formatting lost after appending to another document.Bug
WORDSNET-15549The document formatting lost after appending to another document.Bug
WORDSNET-15561List numbers missing in subsequent sectionBug
WORDSNET-15661DocumentBuilder.InsertDocument ignores list formatting while inserting documentBug
WORDSNET-15842An exception occurs while loading HTML contain SVG imageBug
WORDSNET-15992Gif image is change to PNG after re-saving DOCXBug
WORDSNET-16021MHTML to PDF conversion issue with image renderingBug
WORDSNET-16064Incorrect line wrapping due to character compressingBug
WORDSNET-16112Chart series line in SVG image is jaggedBug
WORDSNET-16113Font information of SVG image is ignored in image renderingBug
WORDSNET-16154Symbols are changed after re-saving DOCXBug
WORDSNET-16177Comments with replies are saved to docx with errorsBug
WORDSNET-16181Japanese text with numbers wraps incorrectlyBug
WORDSNET-16185Incorrect TOC page numbers in RTF to DOCX conversionBug
WORDSNET-16204ParagraphBreakFont.Size is incorrect after performing mail mergeBug
WORDSNET-16207List Label is not rendered correctly in output PNGBug
WORDSNET-16213SVG image loses colors after import from HTMLBug
WORDSNET-16216Issue with vertical merging in table while saving as DOCX when AllowAutoFit is falseBug
WORDSNET-16218DOC to PDF Issue with table formattingBug
WORDSNET-16230Images are misaligned in PDF outputBug
WORDSNET-16242Issue in AcceptAllRevisionsBug
WORDSNET-16249Contents are rendered on previous page in output PDFBug
WORDSNET-16261Line with “Round” cap type is rendered incorrectly when exporting to PDFBug
WORDSNET-16263Symbol characters improperly rendered in PDF outputBug
WORDSNET-16277TestHebrewShaping test fails on the default.Bug
WORDSNET-16299Incorrect text box size while renderingBug
WORDSNET-16328Height of MathElement is calculated improperlyBug
WORDSNET-16329Unnecessary cells revisions occurs into comparison resultBug
WORDSNET-16354Textbox has incorrect size upon rendering.Bug
WORDSNET-16361Blank PDF Created during Converting DOCX to PDFBug
WORDSNET-16366Yellow background not same after converting docx to PDFBug
WORDSNET-16380Handle “Compound lines are not supported” warning correctlyBug
WORDSNET-16394Document.Save throws System.NullReferenceException after joining RTF filesBug
WORDSNET-2719HTML looks differently, when use Embedded and Inline CssStyleSheetType.Bug
WORDSNET-6359Font language settings are lost when converting RTF to DOCBug
WORDSNET-6463Image is clippedBug
WORDSNET-7083Aspose.Words takes a lot of time for rendering documents with one big paragraphBug
WORDSNET-8193Chinese text lose orientation after conversion from doc to pdf.Bug
WORDSNET-8513One more page is rendered to the PDFBug
WORDSNET-8569Extra empty lines are rendered while conversion from Docx to PdfBug
WORDSNETSTD-22InvalidCastException is thrown when create CertificateHolder.Bug
WORDSNET-10378WordArt objects are rendered incorrectlyEnhancement
WORDSNET-11080List numbers are changed after re-saving DocxEnhancement
WORDSNET-11883Top/Bottom margins are not correct in a 2 pages per sheet layoutEnhancement
WORDSNET-11902Content is misplaced after DOCX to HtmlFixedEnhancement
WORDSNET-12355Tables touch left page edge in generated PDFEnhancement
WORDSNET-12538Table is not rendered correctly in the output PDFEnhancement
WORDSNET-14982Consider removing script suffix from font name on RTF importEnhancement
WORDSNET-15099Docx to Pdf conversion issue with SVG renderingEnhancement
WORDSNET-15839Too many styles in resultant merged documentEnhancement
WORDSNET-16284DOC to PDF Number of Pages IncreasedEnhancement
WORDSNET-16295DOC to PDF Issue with Art Fonts and Image ShadingEnhancement
WORDSNET-16315FontSettings.DefaultFontName priority over FontInfoEnhancement
WORDSNET-16355The paragraph format has been lost in PDF outputEnhancement
WORDSNET-16362Shape is not resized properlyEnhancement
WORDSNET-16367SonarQube issuesEnhancement
WORDSNET-9709More improvements need in WORDSNET-8414Enhancement
WORDSNET-16083System.InvalidOperationException is thrown while saving DOCX to PDFException
WORDSNET-16193Document.UpdateFields throws System.NullReferenceExceptionException
WORDSNET-16210Exception when loading an SVG imageException
WORDSNET-16211On fields update, infinite loop detected.Exception
WORDSNET-16280MailMerge.GetFieldNames throws System.ArgumentNullExceptionException
WORDSNET-16300System.InvalidOperationException is thrown when OfficeMathOutputMode is used as MathMLException
WORDSNET-16302System.InvalidOperationException is thrown when OfficeMathOutputMode is used as MathMLException
WORDSNET-16319When DOC is converted to PDF, an InvalidCastException occurs.Exception
WORDSNET-16326Aspose.Words.FileCorruptedException is thrown while loading RTFException
WORDSNET-15943Support to insert Style Separator to put different Paragraph stylesFeature
WORDSNET-15995Support to save SVG images in resultant HTMLFeature
WORDSNET-15023Page count performance issuePerformance
WORDSNET-16255Update fields is taking too much time.Performance
WORDSNET-16296Performance issue with UpdatePageLayout, updating fields, and Saving DOCX to PdfPerformance
WORDSNET-16297Performance issue with updating fieldsPerformance
WORDSNET-5903UpdateFields is taking more time when having long Paragraphs in DocumentPerformance
WORDSNET-15347Bookmark.Text throws System.InvalidOperationExceptionRegression
WORDSNET-16306System.InvalidOperationException is thrown when MailMerge.FieldMergingCallback is usedRegression
WORDSNET-16324Empty Image Url Results in Broken Image Bullet PointRegression

Public API and Backward Incompatible Changes

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

Changed Importing Logic with KeepSourceFormatting Mode

Related issue: WORDSNET-14587

The importing logic with KeepSourceFormatting mode is changed to be closer to MS Word behavior.

Before fix we cloned styles with same names to destination document, but now we are expanding source formatting into the direct attributes of imported nodes.

Support to Insert Style Separator to Put different Paragraph Styles

Related issue: WORDSNET-15943

The following public method has been added into the DocumentBuilder class:

/// <summary>
/// Inserts style separator into the document.
/// </summary>
/// <remarks>
/// This method allows to apply different paragraph styles to two different parts of a text line.
/// </remarks>
public void InsertStyleSeparator()

Style Separator can be added to the end of a paragraph using the* *Ctrl+Alt+Enter Keyboard Shortcut into MS Word. This feature allows for two different paragraph styles used in one logical printed paragraph.

Use case:

DocumentBuilder builder = new DocumentBuilder(new Document());
Style paraStyle = builder.Document.Styles.Add(StyleType.Paragraph, "MyParaStyle");
paraStyle.Font.Bold = false;
paraStyle.Font.Size =8;
paraStyle.Font.Name ="Arial";

// Append text with "Heading 1" style.
builder.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading1;
builder.Write("Heading 1");

// Append text with another style.
builder.ParagraphFormat.StyleName = paraStyle.Name;
builder.Write("This is text with some other formatting ");

HtmlSaveOptions.MetafileFormat Property Added

Related issue: WORDSNET-15995

The following property has been added to the HtmlSaveOptions class:

public class HtmlSaveOptions
    /// <summary>
    /// Specifies in what format metafiles are saved when exporting to HTML, MHTML, or EPUB.
    /// Default value is <see cref="HtmlMetafileFormat.Png" />, meaning that metafiles are rendered to raster PNG images.
    /// </summary>
    /// <remarks>
    /// <p>Metafiles are not natively displayed by HTML browsers. By default, Aspose.Words converts WMF and EMF
    /// images into PNG files when exporting to HTML. Other options are to convert metafiles to SVG images or to export
    /// them as is without conversion.</p>
    /// <p>Some image transforms, in particular image cropping, will not be applied to metafile images if they are exported
    /// to HTML without conversion.</p>
    /// </remarks>
    /// <seealso cref="ImageResolution"/>
    /// <seealso cref="ScaleImageToShapeSize"/>
    public HtmlMetafileFormat MetafileFormat
        get { return mSaveImageOptions.MetafileFormat; }
        set { mSaveImageOptions.MetafileFormat = value; }
/// <summary>
/// Indicates the format in which metafiles are saved to HTML documents.
/// </summary>
public enum HtmlMetafileFormat
    /// <summary>
    /// Metafiles are rendered to raster PNG images.
    /// </summary>
    /// <summary>
    /// Metafiles are converted to vector SVG images.
    /// </summary>
    /// <summary>
    /// Metafiles are saved as is, without conversion.
    /// </summary>

The new property replaces HtmlSaveOptions.ExportMetafileAsRaster, which is now marked obsolete. New code should use MetafileFormat instead of ExportMetafileAsRaster, as shown below:

MetafileFormat = HtmlMetafileFormat.Png;

// Instead of
ExportMetafileAsRaster = true;
MetafileFormat = HtmlMetafileFormat.EmfOrWmf;

// Instead of
ExportMetafileAsRaster = false;

The new option value - HtmlMetafileFormat.Svg - is useful in scenarios where a customer imports SVG images to a document and want to save these images back to SVG format, as in the following code sample:

DocumentBuilder builder = new DocumentBuilder();
builder.Write("Here is an SVG image: ");
builder.InsertHtml("<svg height='210' width='500'> <polygon points='100,10 40,198 190,78 10,78 160,198' style='fill:lime;stroke:purple;stroke-width:5;fill-rule:evenodd;' /></svg> ");
HtmlSaveOptions opts = new HtmlSaveOptions();
opts.MetafileFormat = HtmlMetafileFormat.Svg;
builder.Document.Save("D:\\temp\\out.html", opts);

FontSettings.EnableFontSubstitution Option Added

Related issue: WORDSNET-16315

The following public property has been added into the FontSettings class:

/// <summary>
/// Specifies whether to enable or disable font substitution.
/// </summary>
/// <remarks>
/// <para>If font substitution is enabled, Aspose.Words evaluates all the related fields in <see cref="FontInfo"/>
/// (Panose, Sig etc) for the missing font and finds the closest match among the available font sources. Note that
/// font substitution mechanism will override the <see cref="DefaultFontName"/> in cases when <see cref="FontInfo"/>
/// for the missing font is available in the document.</para>
/// <para>If font substitution is disabled, Aspose.Words uses the <see cref="DefaultFontName"/> for the substitution
/// of missing fonts.</para>
/// <para>The default value is <c>true</c>.</para>
/// </remarks>
public bool EnableFontSubstitution
    get; set;

Shape was not Resized Properly

Related issue: WORDSNET-16362

Behavior of the model while setting of shape height/width was changed. Relative height/width of the shape resets to zero, while changing absolute size. It is the same as MS Word automation does.

For example, the following code, for shape with relative height 20% from “margin”, updates relative height to 0 and set absolute value to 150 points:

Shape shape = (Shape)doc.FirstSection.Body.GetChild(NodeType.Shape, 0, true);
shape.Height = 150;

Obsolete Properties were Removed from HtmlSaveOptions

Then following obsolete properties were removed from the HtmlSaveOptions class:

Removed propertyProperty to use instead

Obsolete Property HtmlFixedSaveOptions.MetafileRenderingMode was Removed

Obsolete property MetafileRenderingMode was removed from the HtmlFixedSaveOptions class. Please use the HtmlFixedSaveOptions.MetafileRenderingOptions.RenderingMode property instead.

Obsolete Property SvgSaveOptions.MetafileRenderingMode was Removed

Obsolete property MetafileRenderingMode was removed from the SvgSaveOptions class. Please use the SvgSaveOptions.MetafileRenderingOptions.RenderingMode property instead.

Obsolete SWF File Format was Removed from Aspose.Words API

As you may know, Adobe is going to drop support of Flash that is why we decided to remove SaveFormat.Swf from Aspose.Words API.

SaveFormat.Swf was removed.

Several Obsolete Properties were Removed from XpsSaveOptions Class

Obsolete property XpsSaveOptions.HeadingsOutlineLevels was removed. Please use OutlineOptions.HeadingsOutlineLevels property instead.

Obsolete property XpsSaveOptions.BookmarksOutlineLevel was removed. Please use OutlineOptions.DefaultBookmarksOutlineLevel property instead.

Obsolete property XpsSaveOptions.MetafileRenderingMode was removed. Please use Use MetafileRenderingOptions.RenderingMode property instead.