Browse our Products

Aspose.Words for Python via .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.metafile_format now affects OLE objects and controls.

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

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-11419Issue with table border when saving as PDFBug
WORDSNET-12476Shape’s hyperlink is removed after saving to HTMLBug
WORDSNET-18387Incorrect conversion to PDF page numbersBug
WORDSNET-19584Page numbering is off when converting to PDFBug
WORDSNET-19698Page numbering in footer gets corrupted in PDFBug
WORDSNET-20416Use DML shapes instead VML for DOCX to HTML conversionBug
WORDSNET-20600DOCX to PDF conversion issue with chart’s Y-AxisBug
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-21887Node is internally removed from the DOM tree after table serializationBug
WORDSNET-21964Nested content control not deleted from documentBug
WORDSNET-22706Issue when converting a Word Cell to textBug
WORDSNET-23435Revisions changed after adding CustomXmlPartBug
WORDSNET-23629PAGE field is updated improperly upon renderingBug
WORDSNET-23638HtmlSaveOptionsMetafileFormat does not work as expectedBug
WORDSNET-23647Alpha list is reset to numbered list after conversion from HTML to DOCXBug
WORDSNET-23679Table layout is broken after rendering documentBug
WORDSNET-23850Incorrect cell margins on html to docx conversionBug
WORDSNET-23923Incorrect table indent on rtf to docx conversionBug
WORDSNET-24004Gradient fill is rendered improperlyBug
WORDSNET-24012Built in styles are written as custom styles after open/save DOCXBug
WORDSNET-24138Text is truncated when rendering metafile to PDFBug
WORDSNET-24148Encoding of a HTML document is incorrectly detected as UTF-7Bug
WORDSNET-24149Garbage text is loaded from a EPUB documentBug
WORDSNET-24150Document title is incorrectly imported from EPUBBug
WORDSNET-24172Set correct values for UseFELayout and DefaultFontLocalIdFarEast when Chinese is specified in LoadOptionsBug
WORDSNET-24238Strikethrough text format is changed to underline on PDF importBug
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-24286Shape flip is not taken into account when rendering a gradient fillBug
WORDSNET-24291Resaving the document changes checkbox stateBug
WORDSNET-24298DOCX to PDF: Border around objects does not retain after conversionBug
WORDSNET-24299InvalidOperationException: Operator should take n operands: Incorrect stream contentBug
WORDSNET-24300InvalidOperationException: Operator should take n operands: too big integer valueBug
WORDSNET-24301ExtractPages throws NullReferenceExceptionBug
WORDSNET-24308Invalid DOCX documentBug
WORDSNET-24319NullReferenceException on saving to PDFBug
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-24358Redundant whitespaces appears after importing table from PDF with RTL contentBug
WORDSNET-24369InvalidOperationException is thrown upon comparing documentBug
WORDSNET-24398Ideographic text in text box incorrectly rotatedBug
WORDSNET-24401Saving document throws “InvalidOperationException” errorBug
WORDSNET-24403Incorrect rendering of text box content reflection when shape has a pattern fillBug
WORDSNET-24420CenteredParagraphCorrector throws NullReferenceExceptionBug

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

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

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.ignore_structured_document_tags property

Related issue: WORDSNET-24241

The following public property is added to FindReplaceOptions class:

class FindReplaceOptions:
    def ignore_structured_document_tags(self) -> bool:
        """Gets or sets a boolean value indicating either to ignore content of StructuredDocumentTag.
        The default value is False.
        When this option is set to True, the content of StructuredDocumentTag
        will be treated as a simple text.
        Otherwise, StructuredDocumentTag will be processed as standalone Story
        and replacing pattern will be searched separately for each StructuredDocumentTag,
        so that if pattern crosses a StructuredDocumentTag, then replacement will not
        be performed for such pattern."""

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

doc = aw.Document("input.docx")

# Set options to ignore StructuredDocumentTags.
options = aw.replacing.FindReplaceOptions()
options.ignore_structured_document_tags = True
doc.range.replace("searchText", "replacement", options)

HtmlSaveOptions.metafile_format now affects OLE objects and controls

Related issue: WORDSNET-23562.

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

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:

class DocumentBuilder:
    def move_to_structured_document_tag(self, structured_document_tag_index: int, character_index: int):
        """Moves the cursor to a structured document tag in the current section.
        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 structured_document_tag_index
        specified the index of the structured document tag inside that header of that section.
        When structured_document_tag_index 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
        structured_document_tag_index is less than 0, it specified an index from the end of the
        section with -1 being the last structured document tag.

        :param structured_document_tag_index: The index of the structured document tag to move to.
        :param character_index: 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.

    def move_to_structured_document_tag(self, structured_document_tag: StructuredDocumentTag, character_index: int):
        """Moves the cursor to the structured document tag.
        :param structured_document_tag: The structured document tag to move to.
        :param character_index: 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.

    def is_at_end_of_structured_document_tag(self) -> bool:
        """Returns True if the cursor is at the end of a structured document tag."""

    def current_structured_document_tag(self) -> StructuredDocumentTag:
        """Gets the structured document tag that is currently selected in this DocumentBuilder."""

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

doc = aw.Document("input.docx")
builder = aw.DocumentBuilder(doc)

# Move to the end of the second structured document tag.
builder.move_to_structured_document_tag(1, -1)

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

# Get currently selected structured document tag.
builder.current_structured_document_tag.color ="output.docx")

Added new public method List.has_same_template

Related issue: WORDSNET-24142

A new List.has_same_template public method has been added:

class List:
    def has_same_template(self, other: List) -> bool:
        """Returns True if the current list and the given list are created from the same template."""

Use Case: Explains how to work with List.has_same_template.

list1 = document.lists[0]
list2 = document.lists[1]
list3 = document.lists[2]

if list1.has_same_template(list2):
    print("These lists have the same list template.")

if not list2.has_same_template(list3):
    print("These lists have different list templates.")

Obsolete LoadOptions.flat_opc_xml_mapping_only and SaveOptions.flat_opc_xml_mapping_only 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.update_sdt_content default value changed and marked as obsolete.

Related issue: WORDSNET-24030

Default value of SaveOptions.update_sdt_content 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 flat_opc_xml_mapping_only load/save option.

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