Browse our Products

Aspose.Words for Python via .NET 23.2 Release Notes

Major Features

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

  • MOBI (also called PRC, AZW - Amazon Kindle’s proprietary e-book file format) is now supported for import and export.
  • Added an ability to specify the character spacing adjustment of a document.
  • Provided the way to instruct Aspose.Words whether to include textboxes, footnotes and endnotes in word count statistics.
  • Introduced the new option for the document style, which allows specifying whether this style is automatically redefined based on the appropriate value.
  • Significantly improved chart rendering.
  • Implemented support for “Lay out footnotes the way Word 6.x/95/97 does” compatibility option.

Full List of Issues Covering all Changes in this Release

Public API and Backward Incompatible Changes

This section lists public API changes that were introduced in Aspose.Words for Python via .NET 23.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 regression and modifies the existing behavior is especially important and is documented here.

Added public property Document.include_textboxes_footnotes_endnotes_in_stat

Related issue: WORDSNET-24819

The following public property was added to aspose.words.Document class:

@property
def include_textboxes_footnotes_endnotes_in_stat(self) -> bool:
    '''Specifies whether to include textboxes, footnotes and endnotes in word count statistics.'''
    ...

@include_textboxes_footnotes_endnotes_in_stat.setter
def include_textboxes_footnotes_endnotes_in_stat(self, value: bool):
    ...
doc = aw.Document()
builder = aw.DocumentBuilder(doc)

builder.writeln("Lorem ipsum")
builder.insert_footnote(aw.notes.FootnoteType.FOOTNOTE, "sit amet")

# Check the option is set to 'false' by default when a new document is created.
print(f"By default for new document this option is set to '{doc.include_textboxes_footnotes_endnotes_in_stat}'")

doc.update_word_count()
print(f"Words count without textboxes, footnotes and endnotes: {doc.built_in_document_properties.words}")

# Change option.
doc.include_textboxes_footnotes_endnotes_in_stat = True
doc.update_word_count()
print(f"Words count with textboxes, footnotes and endnotes: {doc.built_in_document_properties.words}")

'''
This code produces the following output:
By default for new document this option is set to 'False'
Words count without textboxes, footnotes and endnotes: 2
Words count with textboxes, footnotes and endnotes: 4
'''

Added public property Document.justification_mode

Related issue: WORDSNET-24455

A new public property justification_mode has been added to the Document class:

@property
def justification_mode(self) -> aspose.words.settings.JustificationMode:
    '''Gets or sets the character spacing adjustment of a document.'''
    ...

@justification_mode.setter
def justification_mode(self, value: aspose.words.settings.JustificationMode):
    ...
doc = aw.Document("in.docx")
# Getting justification_mode.
justification_mode = doc.justification_mode
if justification_mode == aw.settings.JustificationMode.EXPAND:
    # Setting justification_mode.
    doc.justification_mode = aw.settings.JustificationMode.COMPRESS

Added public property Style.automatically_update

Related issue: WORDSNET-24686

A new public property automatically_update has been added to the Style class:

@property
def automatically_update(self) -> bool:
    '''Specifies whether this style is automatically redefined based on the appropriate value.
       If the property value is set to true, MS Word automatically redefines the current style when
       the appropriate paragraph formatting has been changed.
       AutomaticallyUpdate property is applicable to paragraph styles only.
       The default value is ``False``.
    '''
    ...

@automatically_update.setter
def automatically_update(self, value: bool):
    ...
doc = Document("in.docx")
# Getting automatically_update.
if not doc.styles[aw.StyleIdentifier.NORMAL].automatically_update:
    style = doc.styles.add(aw.StyleType.PARAGRAPH, "Redefined")
    style.base_style_name = "Normal"
    # Setting automatically_update.
    style.automatically_update = True

Added support for MOBI export

Related issue: WORDSNET-24162

aspose.words now can export documents to MOBI file format.

MOBI (also called PRC, AZW) is Amazon Kindle’s proprietary e-book file format.

The following publicly visible enum values were added:

aw.SaveFormat.MOBI
doc = aw.Document("in.docx")
doc.save("out.mobi")

or

doc = aw.Document("in.docx")
options = aw.saving.HtmlSaveOptions(aw.SaveFormat.MOBI)
doc.save("out.mobi", options)

HtmlSaveOptions properties that are not applicable for MOBI export:

  • images_folder
  • images_folder_alias
  • fonts_folder
  • fonts_folder_alias
  • resource_folder
  • resource_folder_alias
  • export_images_as_base64 (always False)
  • export_fonts_as_base64 (always False)
  • export_drop_down_form_field_as_text (always True)
  • export_text_input_form_field_as_text (always True)
  • export_roundtrip_information (always False)
  • css_style_sheet_type (always aw.saving.CssStyleSheetType.INLINE)
  • css_style_sheet_file_name
  • document_split_criteria (always aw.saving.DocumentSplitCriteria.NONE)
  • export_list_labels (always aw.saving.ExportListLabels.BY_HTML_TAGS)
  • export_relative_font_size (always False)