Aspose.Words for .NET 22.10 Release Notes

Major Features

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

  • Implemented an ability to ignore StructuredDocumentTags upon FindReplace.
  • HtmlSaveOptions.MetafileFormat now affects OLE objects and controls.

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

KeySummaryCategory
WORDSNET-19205Add feature to export Shape into SVG and DIV tag in output HTMLNew Feature
WORDSNET-19780Render correct indentation in Text format against HTML blockquote TagsNew Feature
WORDSNET-23920Consider providing a way to move DocumentBuilder cursor inside SDTNew Feature
WORDSNET-23530Check Boxes (Content Control) are checked after UpdatingFieldsEnhancement
WORDSNET-24237Redundant revisions are rendered in PDFEnhancement
WORDSNET-24393The document appears to be corrupted and cannot be loaded message on loading a doc fileEnhancement
WORDSNET-21887Node is internally removed from the DOM tree after table serializationBug
WORDSNET-24403Incorrect rendering of text box content reflection when shape has a pattern fillBug
WORDSNET-20416Use DML shapes instead VML for DOCX to HTML conversionBug
WORDSNET-24401Saving document throws “InvalidOperationException” errorBug
WORDSNET-24420CenteredParagraphCorrector throws NullReferenceExceptionBug
WORDSNET-23629PAGE field is updated improperly upon renderingBug
WORDSNET-23647Alpha list is reset to numbered list after conversion from HTML to DOCXBug
WORDSNET-11419Issue with table border when saving as PDFBug
WORDSNET-23679Table layout is broken after rendering documentBug
WORDSNET-24250SystemArgumentOutOfRangeException: “Length cannot be less than zero” unhandled exceptionBug
WORDSNET-24267Legend gradient fill is not renderedBug
WORDSNET-24269DOCX to PDF: Chart rendered incorrectlyBug
WORDSNET-24272Reflection effect is not rendered in Html FixedBug
WORDSNET-21964Nested content control not deleted from documentBug
WORDSNET-24004Gradient fill is rendered improperlyBug
WORDSNET-24012Built in styles are written as custom styles after open/save DOCXBug
WORDSNET-24286Shape flip is not taken into account when rendering a gradient fillBug
WORDSNET-22706Issue when converting a Word Cell to textBug
WORDSNET-24291Resaving the document changes checkbox stateBug
WORDSNET-23435Revisions changed after adding CustomXmlPartBug
WORDSNET-24298DOCX to PDF: Border around objects does not retain after conversionBug
WORDSNET-24299InvalidOperationException: Operator should take n operands: Incorrect stream contentBug
WORDSNET-24301ExtractPages throws NullReferenceExceptionBug
WORDSNET-23638HtmlSaveOptionsMetafileFormat does not work as expectedBug
WORDSNET-24300InvalidOperationException: Operator should take n operands: too big integer valueBug
WORDSNET-24308Invalid DOCX documentBug
WORDSNET-23850Incorrect cell margins on html to docx conversionBug
WORDSNET-24319NullReferenceException on saving to PDFBug
WORDSNET-24138Text is truncated when rendering metafile to PDFBug
WORDSNET-24149Garbage text is loaded from a EPUB documentBug
WORDSNET-24150Document title is incorrectly imported from EPUBBug
WORDSNET-24148Encoding of a HTML document is incorrectly detected as UTF-7Bug
WORDSNET-20600DOCX to PDF conversion issue with chart’s Y-AxisBug
WORDSNET-24172Set correct values for UseFELayout and DefaultFontLocalIdFarEast when Chinese is specified in LoadOptionsBug
WORDSNET-24331Incorrect reflection direction when rendering 3D effectsBug
WORDSNET-24344Date format of SDT is ignored when FindReplaceOptions.IgnoreStructuredDocumentTags is usedBug
WORDSNET-24345SDTs are not replaced when FindReplaceOptions.IgnoreStructuredDocumentTags is usedBug
WORDSNET-23923Incorrect table indent on rtf to docx conversionBug
WORDSNET-24358Redundant whitespaces appears after importing table from PDF with RTL contentBug
WORDSNET-24369InvalidOperationException is thrown upon comparing documentBug
WORDSNET-12476Shape’s hyperlink is removed after saving to HTMLBug
WORDSNET-24398Ideographic text in text box incorrectly rotatedBug
WORDSNET-19698Page numbering in footer gets corrupted in PDFBug
WORDSNET-20723Conversion issue with page numbersBug
WORDSNET-20724Conversion issue with page number upon DOCX to PDFBug
WORDSNET-20725Incorrect page numbersBug
WORDSNET-20726Issue with page numbers when DOCX to PDFBug
WORDSNET-18387Incorrect conversion to PDF page numbersBug
WORDSNET-19584Page numbering is off when converting to PDFBug
WORDSNET-24238Strikethrough text format is changed to underline on PDF importBug

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

KeySummaryCategory
WORDSNET-24142Getter for AbstractNumIdNew Feature
WORDSNET-21000Incorrect font formatting applied to Hebrew text in PDFBug
WORDSNET-24404XML to DOCX: Footnotes numbers separated from textBug
WORDSNET-24241Find/Replace does not work if searched text contain SDTBug
WORDSNET-23926Metafile image is converted to PNG after validation with HtmlSaveOptionsBug
WORDSNET-24278InvalidOperationException upon rendering shapeBug
WORDSNET-24216Track revisions works improperly ParagraphAppendField method is usedBug
WORDSNET-23755Footnote reference character is rendered as tofuBug
WORDSNET-24281Comparing documents throws  the “comasposewordsSpecialChar” errorBug
WORDSNET-23758OutOfMemoryException is thrown upon comparing documentsBug
WORDSNET-24030DOCX to PDF: Checkbox state changed after conversionBug
WORDSNET-22838HTML styles are lost after HTML to DOCX conversionBug
WORDSNET-24288Data labels values values are not renderedBug
WORDSNET-22871DOCX to PDF - List numbers disappearingBug
WORDSNET-24090Aspose.Words returns incorrect words countBug
WORDSNET-24159DocumentVariables are not updated on DocumentCompare methodBug
WORDSNET-24346Footnote mark is rendered as toffuBug
WORDSNET-24212HTM to PDF: text-indentation has no effectBug
WORDSNET-24213Floating table is rendered improperlyBug
WORDSNET-24374List item number is incorrect after comparingBug
WORDSNET-19825Value of NUMPAGES in output PDF is incorrect after mail mergeBug
WORDSNET-19361Page and NUMPAGES fields have incorrect values in PDFBug

Public API and Backward Incompatible Changes

This section lists public API changes that were introduced in Aspose.Words 22.10. 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 new FindReplaceOptions.IgnoreStructuredDocumentTags property

Related issue: WORDSNET-24241

The following public property is added to FindReplaceOptions class:

/// <summary>
/// Gets or sets a boolean value indicating either to ignore content of <see cref="StructuredDocumentTag"/>.
/// The default value is <c>false</c>.
/// </summary>
/// <remarks>
/// <para>
/// When this option is set to <c>true</c>, the content of <see cref="StructuredDocumentTag"/>
/// will be treated as a simple text.
/// </para>
/// <para>
/// Otherwise, <see cref="StructuredDocumentTag"/> will be processed as standalone Story
/// and replacing pattern will be searched separately for each <see cref="StructuredDocumentTag"/>,
/// so that if pattern crosses a <see cref="StructuredDocumentTag"/>, then replacement will not
/// be performed for such pattern.
/// </para>
/// </remarks>
public bool IgnoreStructuredDocumentTags { get; set; }

Use Case: Explains how to ignore StructuredDocumentTags while finding and replacing text.

Document doc = new Document("input.docx");

// Set options to ignore StructuredDocumentTags.
FindReplaceOptions options = new FindReplaceOptions() { IgnoreStructuredDocumentTags = true };
doc.Range.Replace("searchText", "replacement", options);

HtmlSaveOptions.MetafileFormat now affects OLE objects and controls

Related issue: WORDSNET-23562.

OLE objects and controls (shapes whose type is ShapeType.OleObject or ShapeType.OleControl) usually contain a metafile as a fallback image. Saving of such shapes to HTML has been changed in the following way:

  • The option HtmlSaveOptions.MetafileFormat can be used to choose the format which images of the shapes are saved to.
  • The option HtmlSaveOptions.ExportShapesAsSvg no longer affects the shapes.

In other words, OLE objects and controls are now treated as metafile images when a document is converted to HTML.

Implemented ability to move DocumentBuilder cursor inside structured document tag

Related issue: WORDSNET-23920

Now it is possible to move cursor of DocumentBuilder inside a structured document tag. To do this, the following new members of the DocumentBuilder class have been added:

/// <summary>
/// Moves the cursor to a structured document tag in the current section.
/// </summary>
/// <remarks>
/// The navigation is performed inside the current story of the current section. That is, if you moved the
/// cursor to the primary header of the first section, then <paramref name="structuredDocumentTagIndex"/>
/// specified the index of the structured document tag inside that header of that section.
/// When <paramref name="structuredDocumentTagIndex"/> is greater than or equal to 0, it specifies an index
/// from the beginning of the section with 0 being the first structured document tag. When
/// <paramref name="structuredDocumentTagIndex"/> is less than 0, it specified an index from the end of the
/// section with -1 being the last structured document tag.
/// </remarks>
/// <param name="structuredDocumentTagIndex">The index of the structured document tag to move to.</param>
/// <param name="characterIndex">The index of the character inside the structured document tag.
/// A negative value allows you to specify a position from the end of the structured document tag. Use -1 to
/// move to the end of the structured document tag. If the structured document tag is at the block level, and
/// you want to move the cursor to the end of its last paragraph, specify -2.</param>
public void MoveToStructuredDocumentTag(int structuredDocumentTagIndex, int characterIndex);

/// <summary>
/// Moves the cursor to the structured document tag.
/// </summary>
/// <param name="structuredDocumentTag">The structured document tag to move to.</param>
/// <param name="characterIndex">The index of the character inside the structured document tag.
/// A negative value allows you to specify a position from the end of the structured document tag. Use -1 to
/// move to the end of the structured document tag. If the structured document tag is at the block level, and
/// you want to move the cursor to the end of its last paragraph, specify -2.</param>
public void MoveToStructuredDocumentTag(StructuredDocumentTag structuredDocumentTag, int characterIndex);

/// <summary>
/// Returns true if the cursor is at the end of a structured document tag.
/// </summary>
public bool IsAtEndOfStructuredDocumentTag { get; }

/// <summary>
/// Gets the structured document tag that is currently selected in this DocumentBuilder.
/// </summary>
public StructuredDocumentTag CurrentStructuredDocumentTag { get; }

Use Case: Moving cursor to end of inline-level structured document tag and getting currently selected structured document tag.

Document doc = new Document("input.docx");
DocumentBuilder builder = new DocumentBuilder(doc);

// Move to the end of the second structured document tag.
builder.MoveToStructuredDocumentTag(1, -1);

builder.Write(" Text at end of structured document tag.");

// Get currently selected structured document tag.
builder.CurrentStructuredDocumentTag.Color = Color.Green;

doc.Save("output.docx");

Added new public method List.HasSameTemplate

Related issue: WORDSNET-24142

A new List.HasSameTemplate() public method has been added:

/// <summary>
/// Returns true if the current list and the given list are created from the same template.
/// </summary>
public bool HasSameTemplate(List other)

Use Case: Explains how to work with List.HasSameTemplate().

List list1 = document.Lists[0];
List list2 = document.Lists[1];
List list3 = document.Lists[2];

if (list1.HasSameTemplate(list2))
{
    Console.WriteLine("These lists have the same list template.");
}

if (!list2.HasSameTemplate(list3))
{
    Console.WriteLine("These lists have different list templates.");
}

Obsolete LoadOptions.FlatOpcXmlMappingOnly and SaveOptions.FlatOpcXmlMappingOnly options were removed

Related issue: WORDSNET-21455

These options caused unexpected side-effects and decided to be removed eventually. Instead, it was suggested to convert the mapped document to FlatOpc file format directly. This approach has no side-effect and provides better output.

SaveOptions.UpdateSdtContent default value changed and marked as obsolete.

Related issue: WORDSNET-24030

Default value of SaveOptions.UpdateSdtContent has been changed to False to follow MS Word behavoir, MS Word does not update content of common (not mapped) SDT from SDT values.

Also we decided to remove this option later as it causes unexpected side-effects similar to FlatOpcXmlMappingOnly load/save option.

Instead we going to provide new method which should be called explicitly to update SDT content according to the values.