Browse our Products

Aspose.Words for Python via .NET 23.3 Release Notes

Major Features

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

  • Extended set of public properties for working with fill colors.
  • Implemented rendering of radial gradients with SkiaSharp native shader for .NET Standard.
  • Added support of InvertIfNegative property for bar chart rendering.
  • Implemented saving progress notifications for MOBI and AZW3 formats.
  • Added an ability to specify whether to adjust sentence and word spacing automatically upon document import.

Full list of changes

Public API and Backward Incompatible Changes

This section lists public API changes that were introduced in Aspose.Words for Python via .NET 23.3. 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 public properties for working with fill colors

A new public properties fore_theme_color and back_theme_color has been added to the Fill class.

@property
def fore_theme_color(self) -> aspose.words.themes.ThemeColor:
    '''Gets or sets a ThemeColor object that represents the foreground color for the fill.'''
    ...
    
@fore_theme_color.setter
def fore_theme_color(self, value: aspose.words.themes.ThemeColor):
    ...
    
@property
def back_theme_color(self) -> aspose.words.themes.ThemeColor:
    '''Gets or sets a ThemeColor object that represents the background color for the fill.'''
    ...
    
@back_theme_color.setter
def back_theme_color(self, value: aspose.words.themes.ThemeColor):
    ...

A new public properties fore_tint_and_shade and back_tint_and_shade has been added to thr Fill class.

@property
def fore_tint_and_shade(self) -> float:
    '''Gets or sets a double value that lightens or darkens the foreground color.
        
    The allowed values are within the range from -1 (the darkest) to 1 (the lightest) for this property.
    Zero (0) is neutral. Attempting to set this property to a value less than -1 or more than 1
    results in System.ArgumentOutOfRangeException.'''
    ...

@fore_tint_and_shade.setter
def fore_tint_and_shade(self, value: float):
    ...
    
@property
def back_tint_and_shade(self) -> float:
    '''Gets or sets a double value that lightens or darkens the background color.
        
    The allowed values are within the range from -1 (the darkest) to 1 (the lightest) for this property.
    Zero (0) is neutral. Attempting to set this property to a value less than -1 or more than 1
    results in System.ArgumentOutOfRangeException.'''
    ...

@back_tint_and_shade.setter
def back_tint_and_shade(self, value: float):
    ...
import typing
from aspose.words import Document, DocumentBuilder, NodeType
from aspose.words.drawing import Shape
from aspose.words.themes import ThemeColor

doc = Document("in.docx")

shape = doc.get_child(NodeType.SHAPE, 0, True)
shape_fill = typing.cast(Shape, shape).fill

'''Gets and sets the value of theme colors.'''
if shape_fill.fore_theme_color == ThemeColor.ACCENT1:
    shape_fill.fore_theme_color(ThemeColor.DARK1)

if shape_fill.back_theme_color == ThemeColor.ACCENT2:
    shape_fill.back_theme_color(ThemeColor.DARK2)

text_fill_1 = doc.first_section.body.first_paragraph.runs[0].font.fill

'''Gets and sets the tint value.'''
if text_fill_1.fore_tint_and_shade == 0:
    text_fill_1.fore_tint_and_shade(0.5)

text_fill_2 = doc.first_section.body.first_paragraph.runs[1].font.fill
    
'''Gets and sets the shade value.'''
if text_fill_2.fore_tint_and_shade == 0:
    text_fill_2.fore_tint_and_shade(-0.2)

doc.save("output.docx")

Added public properties has_major_gridlines and has_minor_gridlines to ChartAxis class

The following public properties have been added to the aspose.words.drawing.charts.ChartAxis class:

@property
def has_major_gridlines(self) -> bool:
    '''Gets or sets a flag indicating whether the axis has major gridlines.'''
    ...
    
@has_major_gridlines.setter
def has_major_gridlines(self, value: bool):
    ...
    
@property
def has_minor_gridlines(self) -> bool:
    '''Gets or sets a flag indicating whether the axis has minor gridlines.'''
    ...
    
@has_minor_gridlines.setter
def has_minor_gridlines(self, value: bool):
    ...
from aspose.words import Document, DocumentBuilder
from aspose.words.drawing.charts import ChartType

doc = Document()
builder = DocumentBuilder(doc)

'''Insert a chart.'''
shape = builder.insert_chart(ChartType.COLUMN, 432, 252)

x_axis = shape.chart.axis_x
y_axis = shape.chart.axis_y

'''Show gridlines.'''
x_axis.has_major_gridlines(True)
x_axis.has_minor_gridlines(True)
y_axis.has_major_gridlines(True)
y_axis.has_minor_gridlines(True)

doc.save("Gridlines.docx")

Added public property ImportFormatOptions.adjust_sentence_and_word_spacing

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

@property
def adjust_sentence_and_word_spacing(self) -> bool:
    '''Gets or sets a boolean value that specifies whether to adjust sentence and word spacing automatically.
    The default value is ``False``.'''
    ...
    
@adjust_sentence_and_word_spacing.setter
def adjust_sentence_and_word_spacing(self, value: bool):
    ...
from aspose.words import Document, DocumentBuilder, ImportFormatOptions, ImportFormatMode

src_doc = Document()
dst_doc = Document()

builder = DocumentBuilder(src_doc)
builder.write("Dolor sit amet.")

builder = DocumentBuilder(dst_doc)
builder.Write("Lorem ipsum.")

options = ImportFormatOptions()
options.adjust_sentence_and_word_spacing(True)  
    
builder.InsertDocument(src_doc, ImportFormatMode.USE_DESTINATION_STYLES, options);
print(dst_doc.first_section.body.first_paragraph.get_text())

'''This code produces the following output (please note the additional ' ' space character just before pasted content):
Lorem ipsum. Dolor sit amet.
'''

Added public property TextBox.no_text_rotation

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

@property
def no_text_rotation(self) -> bool:
    '''Gets or sets a boolean value indicating either text of the TextBox should not rotate when the shape is rotated.
        
    The default value is ``False``'''
    ...

@no_text_rotation.setter
def no_text_rotation(self, value: bool):
    ...
from aspose.words import DocumentBuilder
from aspose.words.drawing import ShapeType

builder = DocumentBuilder()
shape = builder.insert_shape(ShapeType.ELLIPSE, 20, 20)
shape.text_box.no_text_rotation(True)

Enabled saving progress notifications for MOBI and AZW3 formats

The SaveOptions.ProgressCallback is now also invoked when saving to Mobi or AZW3.