Browse our Products

Aspose.Words for Python via .NET 23.7 Release Notes

Major Features

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

  • The possibility to save the document page or shape into EPS format has been implemented.
  • The ability to retrieve the digital signature value from a digitally signed document as a byte array has been added.
  • The Row and Cell classes have been extended with new public members.
  • Mustache tags are now supported in the MailMerge.GetRegionsHierarchy and MailMerge.GetFieldNamesForRegion methods. .

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.7. 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 for Python via .NET 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 ability to get digital signature value from digitally signed document as byte array

Added ability to get a digital signature value from a digitally signed document into Aspose.Words.DigitalSignatures.DigitalSignature class:

@property
def signature_value(self) -> bytes:
    '''Gets an array of bytes representing a signature value.'''
    ...
import base64
from aspose.words import Document

doc = Document("docWithSign.docx")
for digitalSignature in doc.digital_signatures:
    signatureValue = base64.b64encode(digitalSignature.signature_value)
    print(digitalSignature)

Added new EPS image format

The document page or shape could be saved into EPS format now. A new EPS value is added into SaveFormat class.

from aspose.words import Document, SaveFormat
from aspose.words.saving import ImageSaveOptions, PageSet

# Open some document.
doc = Document("document.docx")

# Save the second page as EPS image.
saveOptions = ImageSaveOptions(SaveFormat.EPS)
saveOptions.page_set = PageSet(1)
doc.save("image.eps", saveOptions)
from aspose.words import Document, NodeType, SaveFormat
from aspose.words.saving import ImageSaveOptions
# Open some document.
doc = Document("document.docx")

# Save the shape as EPS image.
saveOptions = ImageSaveOptions(SaveFormat.EPS)

shape = doc.get_child(NodeType.SHAPE, 0, True).as_shape()
renderer = shape.get_shape_renderer()
renderer.save("image.eps", saveOptions)

Added new public properties Row.next_row, Row.previous_row, Cell.next_cell and Cell.previous_cell

The following public properties have been added to the Row class:

@property
def next_row(self) -> aspose.words.tables.Row:
    '''Gets the next :class:`Row` node.
    
    The method can be used when you need to have typed access to table rows. If a
    :class:`aspose.words.markup.StructuredDocumentTag` node is found in a table instead of a row,
    it is automatically traversed to get a row contained within.'''
    ...

@property
def previous_row(self) -> aspose.words.tables.Row:
    '''Gets the previous :class:`Row` node.
    
    The method can be used when you need to have typed access to table rows. If a
    :class:`aspose.words.markup.StructuredDocumentTag` node is found in a table instead of a row,
    it is automatically traversed to get a row contained within.'''
    ...

The following public properties have been added to the Cell class:

@property
def next_cell(self) -> aspose.words.tables.Cell:
    '''Gets the next :class:`Cell` node.
    
    The method can be used when you need to have typed access to cells of a :class:`Row`. If a
    :class:`aspose.words.markup.StructuredDocumentTag` node is found in a row instead of a cell, it is automatically
    traversed to get a cell contained within.'''
    ...

@property
def previous_cell(self) -> aspose.words.tables.Cell:
    '''Gets the previous :class:`Cell` node.
    
    The method can be used when you need to have typed access to cells of a :class:`Row`. If a
    :class:`aspose.words.markup.StructuredDocumentTag` node is found in a row instead of a cell, it is automatically
    traversed to get a cell contained within.'''
    ...
from aspose.words import Document

doc = Document(fileName)
table = doc.first_section.body.tables[0]

# Enumerate through all cells of the table.
row = table.first_row
while row is not None:
    cell = row.first_cell
    
    while cell is not None:
        print(cell.get_text())
        cell = cell.next_cell
    
    row = row.next_row

A warning is issued if loaded HTML document has fixed-page structure

Aspose.Words doesn’t support loading of fixed-page HTML document (for example, documents that are produced when saving in SaveFormat.HtmlFixed). If Aspose.Words detects that the loaded HTML document has fixed-page structure, it will issue the following warning:

WarningSource.HTML
WarningType.MINOR_FORMATTING_LOSS
"The document is fixed-page HTML. Its structure may not be loaded correctly."

Supported mustache tags in the MailMerge.GetRegionsHierarchy and MailMerge.GetFieldNamesForRegion methods

Now the MailMerge.get_regions_hierarchy method returns mustache regions and mustache fields when the MailMerge.use_non_merge_fields option is True.

Now the MailMerge.get_field_names_for_region method accepts mustache region names and returns mustache field names when the MailMerge.use_non_merge_fields option is True.

The MustacheTag class has been introduced:

class MustacheTag:
    '''Represents "mustache" tag.'''
    
    @property
    def reference_run(self) -> aspose.words.Run:
        '''Gets the run that contains the beginning of the tag.'''
        ...
    
    @property
    def reference_offset(self) -> int:
        '''Gets the zero-based starting position of the tag from the start of the :attr:`MustacheTag.reference_run`.'''
        ...
    
    @property
    def text(self) -> str:
        '''Gets the text of the tag.'''
        ...
    
    ...

The start_mustache_tag, end_mustache_tag and mustache_tags properties have been added to the MailMergeRegionInfo class:

class MailMergeRegionInfo:

    @property
    def mustache_tags(self) -> list[aspose.words.mailmerging.MustacheTag]:
        '''Returns a list of child "mustache" tags.'''
        ...
     
    @property
    def start_mustache_tag(self) -> aspose.words.mailmerging.MustacheTag:
        '''Returns a start "mustache" tag for the region.'''
        ...
    
    @property
    def end_mustache_tag(self) -> aspose.words.mailmerging.MustacheTag:
        '''Returns an end "mustache" tag for the region.'''
        ...
from aspose.words import Document
document = Document("Template.docx")
document.mail_merge.use_non_merge_fields = True

hierarchy = document.mail_merge.get_regions_hierarchy()
for mustacheTag in hierarchy.mustache_tags:
    print(mustacheTag.text)

for region in hierarchy.regions:
    print(region.start_mustache_tag.text)
    print(region.end_mustache_tag.text)