Browse our Products
Aspose.Words for Python via .NET 23.10 Release Notes
Major Features
There are 124 improvements and fixes in this regular monthly release. The most notable are:
- Implemented various PDF rendering optimizations to reduce output size when utilizing PdfSaveOptions.OptimizeOutput settings.
- Added the capability to retrieve the foreground color without modifiers in the Fill and Stroke classes.
- Expanded the functionality of ChartDataPointCollection, ChartSeries, and ChartFormat classes with new options.
- Introduced a simplified method for inserting one document inside another document inline at the current cursor position.
- Introduced the ImageData.fit_image_to_shape() method.
- Added the ability to access and modify the Locked property of a Style.
- Implemented a feature to recognize hyperlinks when loading TXT documents.
Full List of Issues Covering all Changes in this Release
Expand to view the full list of issues ᐳᐳ
- Ability to get grid span of cell
- Ability to load images using relative path with support of ResourceLoadingCallback
- Provide way in API to restart numbering of particular list items
- Implement special mode for DocumentBuilder.InsertDocument and DocumentBuilder.InsertHtml methods
- Provide way to remove Color and Underline font attributes
- HTML to DOCX/PDF conversion issue with css property “white-space: nowrap”
- Cell’s text is wrapped to next line in output PDF
- Consider providing InsertDocument overload to insert document content inline
- Support MSO properties during import headers and footers
- Word Table messed up in PDF
- Clickable links in txt-model-html conversion
- Ability to copy data point format/properties to/from another data point or series defaults, and ability to determine whether data point has non default formatting
- Ability to generate consistent IDs of comment nodes when cloning the nodes
- Html to Pdf conversion with table’s layout
- Add feature to set/get color of Chart Title
- Paragraph is rendered on next page in output FixedHtml
- Add feature to change the font of chart title
- Provide API to set Vertical (Value) Axis Title of Chart
- Implement writing signature created field.
- Signing documents in OTT format.
- Ability to get foreground color without modifiers in Fill and Stroke classes
- Ability to inherit from CompositeNode in API
- DOCX to PDF file conversion issue with text rendering
- Add method to shape API to keep image aspect ratio
- Table header’s text render incorrectly in output PDF
- Text is wrapped within table cell after DOCX to PDF conversion
- Table height issue while converting Aspose.Words.Document into PDF
- Table header width in PDF is not the same as word document
- Text of content control is rendered incorrectly in output PDF
- DOCX to MD: Internal reference links
- Table.AutoFit(AutoFitBehavior.AutoFitToContents) does not work when save the document to PDF/XPS
- Text moves to next page in rendered PDF after AcceptAllRevisions
- Text is pushed down to next page after DOCX to PDF conversion
- Incorrect text wrapping when NoWrap=false and PreferredWidth set on cell
- Table Column Cell Widths reduced in rendered PDF
- Table border is lost after conversion from MHT to PDF
- Table cell width is changed when HTML is converted to PDF
- DOCX to PDF conversion issue with text position
- Empty Page is created in output PDF after changing PaperSize under German culture
- Incorrect TableGrid issue
- Table layout is different after rendering
- Table is rendered narrower than it should
- Deprecated UpdateTableLayout() is required for table update
- DOCX to PDF: Table not rendered correctly
- Table width is incorrect after rendering
- DOCX to PDF: Table header text is not retained upon conversion
- Table is rendered improperly
- Table column widths are different after rendering document
- UpdateTableLayout is still required even if it is deprecated
- Table borders are rendered improperly
- Table layout is changed after rendering that leads to content move to the next page
- Incorrect text wrapping in Cells in PDF
- Problem with converation of table in FixedHtml
- Export to PDF ignores cells WrapText
- Table columns width changes in PDF
- A Table column is missing from PDF
- Text wrapping issue with HTML to PDF conversion
- Table width is change after DOCX to PDF conversion
- Table cells with Wrapped text do not auto resize in PDF
- Text is wrapped in table’s cell when document is saved to PDF
- Table column widths are not correct in PDF
- Table’s column width is increased in output PDF
- Table formatting issue in HTM to TIF conversion
- HTML to Tiff conversion issue with text rendering
- Table rendering issue in HTML to PDF conversion
- “Avenir Next LT Pro” fonts are improperly substituted
- Rendering performance depredated in new version of Aspose.Words
- RTL document layout is broken after rendering
- Consider exposing Style.Locked property
- Provide public access to CellPr.HideMark property
- List items are shown in one line if CssStyleSheetType.Embedded is used
- IF field is not updated properly upon execution mail merge
- ArgumentException is thrown upon saving HTML document after loading MHTML with IResourceLoadingCallback
- SVG with page background has white space at the left side when rendered with FitToViewPort option
- Redundant empty pages are added after PDF to DOCX conversion
- A redundant shape is rendered in the document header
- Accessing paragraph border creates None border in the output document
- Numbering is incorrect after using ExtractPages
- Resulting text has no shadow after converting DOCX to PNG
- Document.ExtractPages method produces 2-page document instead of 1-page
- Formula is not rendered correctly when saving to PDF
- Incorrect links for TOC entries in SVG
- Document.ExtractPages method produces 2-page document instead of 1-page
- Provide access to the font properties of ChartTitle
- Watermark is rendered improperly
- Image in header is doubled after rendering
- PAGE field in footer is updated improperly upon rendering
- Header is rendered improperly, image overlaps textbox
- Formatting problem in TOC while merging DOCX
- DOCX to PDF: Save method hangs
- Chart is changed after open/save document using Aspose.Words
- Incorrect font is selected when Nunito Extrabold is used
- HTMLs not compared correctly
- Additional properties (rotation and vertical overflow) appear for the chart title after conversion to PDF
- InvalidCastException is thrown upon comparing document
- Remove support for external images for MOBI/AZW3 file formats
- HtmlSaveOptions.ExportOriginalUrlForLinkedImages doesn’t have any effect on HTML image export
- Document compare accessing Revision.Group performance
- OutOfMemoryException is thrown upon extracting pages
- BarcodeParameters.BarcodeType contains redundant character
- NullReferenceException is thrown upon saving document as RTF
- The characters are garbled in Word 95 binary DOC
- DOCX to PDF: Incorrect spacing
- Footer position is incorrect after merging documents
- NullReferenceException is thrown upon calling UpdateFields
- Page footer is moved to the next page and overlaps content
- Compare throws “NC sync failed” error
- Header Alignment Issue
- Shape’s adjustment workaround
- Radar chart with NaN values is rendered improperly
- Aspose.Words hangs upon rendering document
- FORMULA field does not recognize table cell coordinates references.
- Image is not resized to the container after updating INCLUDEPICTURE field
- Evaluation message added if metered AW for Cloud license applied
- UpdateFields does not calculate the page number in TOC field correctly
- Incorrect fallback font for VML WordArt with Thai locale
- Incorrect size calculation of VML WordArt text when using fallback font
- Performance issue while rendering document to PDF
- Tofu is rendered after ®? Character
- WK: Incorrect Stroke.DashStyle
- Text is improperly distributed while rendering
- Table overlaps the image in HTML to PDF conversion
- Symbol Replacement Issue in MailMerge
- ArgumentOutOfRangeException is thrown upon updating page layout
Public API and Backward Incompatible Changes
This section lists public API changes that were introduced in Aspose.Words for Python via .NET 23.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 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 foreground color without modifiers in Fill and Stroke classes
A new public property base_fore_color has been added to class Fill and Stroke:
@property
def base_fore_color(self) -> aspose.pydrawing.Color:
"""Gets a Color object that represents the base foreground color for the fill without any modifiers."""
...
...
@property
def base_fore_color(self) -> aspose.pydrawing.Color:
"""Gets the base foreground color of the stroke without any modifiers.
The default value for a :class:`Shape` is
System.Drawing.Color.Black."""
...
Use Case
This use case explains how to get foreground color without modifiers in Fill and Stroke classes:
from aspose.words import Document, DocumentBuilder
from aspose.words.drawing import ShapeType
from aspose.pydrawing import Color
doc = aw.Document()
builder = aw.DocumentBuilder(doc)
shape = builder.insert_shape(aw.drawing.ShapeType.RECTANGLE, 100, 40)
shape.fill.fore_color = drawing.Color.red
shape.fill.fore_tint_and_shade = 0.5
shape.stroke.fill.fore_color = drawing.Color.green
shape.stroke.fill.transparency = 0.5
drawing.Color.from_argb(255, 255, 188, 188).to_argb()
self.assertEqual(drawing.Color.from_argb(255, 255, 188, 188).to_argb(), shape.fill.fore_color.to_argb())
self.assertEqual(drawing.Color.red.to_argb(), shape.fill.base_fore_color.to_argb())
self.assertEqual(drawing.Color.from_argb(128, 0, 128, 0).to_argb(), shape.stroke.fore_color.to_argb())
self.assertEqual(drawing.Color.green.to_argb(), shape.stroke.base_fore_color.to_argb())
self.assertEqual(drawing.Color.green.to_argb(), shape.stroke.fill.fore_color.to_argb())
self.assertEqual(drawing.Color.green.to_argb(), shape.stroke.fill.base_fore_color.to_argb())
Added new members to ChartDataPointCollection, ChartSeries and ChartFormat classes
The following new methods and property have been added to the ChartDataPointCollection, ChartSeries and ChartFormat classes:
class ChartDataPointCollection:
def has_default_format(self, data_point_index: int) -> bool:
"""Gets a flag indicating whether the data point at the specified index has default format."""
...
def copy_format(self, source_index: int, destination_index: int) -> None:
"""Copies format from the source data point to the destination data point."""
...
class ChartSeries:
def copy_format_from(self, data_point_index: int) -> None:
"""Copies default data point format from the data point with the specified index."""
...
class ChartFormat:
def set_default_fill(self) -> None:
"""Resets the fill of the chart element to have the default value."""
...
@property
def is_defined(self) -> bool:
"""Gets a flag indicating whether any format is defined."""
...
...
}
Use Case
This use case explains how to copy data point format:
from aspose.words import Document, NodeType
from aspose.words.drawing import Shape
doc = Document("DataPoint format.docx")
# Get the chart and series to update format.
shape = doc.get_child(NodeType.SHAPE, 0, True).as_shape()
series = shape.chart.series[0]
data_points = series.data_points
self.assertEqual(True, data_points.has_default_format(0))
self.assertEqual(False, data_points.has_default_format(1))
# Copy format of the data point with index 1 to the data point with index 2
# so that the data point 2 looks the same as the data point 1.
data_points.copy_format(0, 1)
self.assertEqual(True, data_points.has_default_format(0))
self.assertEqual(True, data_points.has_default_format(1))
# Copy format of the data point with index 0 to the series defaults so that all data points
# in the series that have the default format look the same as the data point 0.
series.copy_format_from(1)
self.assertEqual(True, data_points.has_default_format(0))
self.assertEqual(True, data_points.has_default_format(1))
doc.save("Charts.CopyDataPointFormat.docx")
Use Case
This use case explains how to reset data point fill:
from aspose.words import Document, NodeType
from aspose.words.drawing import Shape
doc = Document("DataPoint format.docx")
shape = doc.get_child(NodeType.SHAPE, 0, True).as_shape()
series = shape.chart.series[0]
data_point = series.data_points[1]
self.assertEqual(True, data_point.format.is_defined)
data_point.format.set_default_fill()
doc.save("Charts.ResetDataPointFill.docx")
Added new public method ImageData.fit_image_to_shape()
A new FitImageToShape public method has been added to ImageData class:
def fit_image_to_shape(self) -> None:
"""Fits the image data to Shape frame so that the aspect ratio of the image data matches the aspect ratio of Shape frame."""
...
Use Case
This use case explains how to work with ImageData.fit_image_to_shape():
from aspose.words import DocumentBuilder
from aspose.words.drawing import ShapeType
doc = Document()
builder = DocumentBuilder(doc)
# Insert an image shape and leave its orientation in its default state.
shape = builder.insert_shape(ShapeType.RECTANGLE, 300, 450)
shape.image_data.set_image("Barcode.png")
shape.image_data.fit_image_to_shape()
doc.save("Shape.FitImageToShape.docx")
Added public method DocumentBuilder.insert_document_inline
A new public method insert_document_inline has been added to class DocumentBuilder:
def insert_document_inline(self, src_doc: aspose.words.Document, import_format_mode: aspose.words.ImportFormatMode, import_format_options: aspose.words.ImportFormatOptions) -> aspose.words.Node:
"""Inserts a document inline at the cursor position.
This method mimics the MS Word behavior, as if CTRL+'A' (select all content) was pressed,
then CTRL+'C' (copy selected into the buffer) inside one document
and then CTRL+'V' (insert content from the buffer) inside another document.
As a difference from :meth:`DocumentBuilder.insert_document`
this method moves the content of the paragraph of the destination document,
before which the source document is inserted, into the last
paragraph of the inserted source document. Actually, this means that
paragraph break of the last inserted paragraph is removed.
Note, if the last node of the source document is not a paragraph, then nothing will be done.
:param src_doc: Source document for inserting.
:param import_format_mode: Specifies how to merge style formatting that clashes.
:param import_format_options: Allows to specify options that affect formatting of a result document.
:returns: First node of the inserted content."""
...
Use Case
This use case explains how to insert one document into another inline:
from aspose.words import DocumentBuilder, BookmarkEnd, BookmarkStart, ImportFormatMode, ImportFormatOptions
src_doc = DocumentBuilder()
src_doc.write("[src content]")
# Create destination document.
dst_doc = DocumentBuilder()
dst_doc.write("Before ")
dst_doc.insert_node(BookmarkStart(dst_doc.document, "src_place"))
dst_doc.insert_node(BookmarkEnd(dst_doc.document, "src_place"))
dst_doc.write(" after")
self.assertEqual("Before after", dst_doc.document.get_text().strip())
# Insert source document into destination inline.
dst_doc.move_to_bookmark("src_place")
dst_doc.insert_document_inline(src_doc.document, ImportFormatMode.USE_DESTINATION_STYLES,
ImportFormatOptions())
self.assertEqual("Before [src content] after", dst_doc.document.get_text().strip())
Added public properties ChartTitle.font and ChartAxisTitle.font
An ability to set font properties for chart and axis titles has been implemented.
The following new public properties have been added:
class ChartTitle
@property
def font(self) -> aspose.words.Font:
"""Provides access to the font formatting of the chart title."""
...
class ChartAxisTitle:
@property
def font(self) -> aspose.words.Font:
"""Provides access to the font formatting of the axis title."""
...
Use Case
This use cases explain how to set font properties for chart and axis titles:
from aspose.words import Document, DocumentBuilder
import aspose.pydrawing as drawing
from aspose.words.drawing.charts import ChartType
doc = Document()
builder = DocumentBuilder(doc)
shape = builder.insert_chart(ChartType.COLUMN, 432, 252)
chart = shape.chart
series_coll = chart.series
# Delete default generated series.
series_coll.clear()
series_coll.add("AW Series 1", ["AW Category 1", "AW Category 2"], [1, 2])
# Set axis title.
chart.axis_x.title.text = "Categories"
chart.axis_x.title.show = True
chart.axis_y.title.text = "Values"
chart.axis_y.title.show = True
chart.axis_y.title.overlay = True
chart.axis_y.title.font.size = 12
chart.axis_y.title.font.color = drawing.Color.blue
doc.save("Charts.ChartAxisTitle.docx")
from aspose.words import Document, DocumentBuilder
import aspose.pydrawing as drawing
from aspose.words.drawing.charts import ChartType
doc = Document()
builder = DocumentBuilder(doc)
# Insert a chart shape with a document builder and get its chart.
chart_shape = builder.insert_chart(ChartType.BAR, 400, 300)
chart = chart_shape.chart
# Use the "title" property to give our chart a title, which appears at the top center of the chart area.
title = chart.title
title.text = "My Chart"
title.font.size = 15
title.font.color = drawing.Color.blue
# Set the "show" property to "True" to make the title visible.
title.show = True
# Set the "overlay" property to "True" Give other chart elements more room by allowing them to overlap the title
title.overlay = True
doc.save("Charts.chart_title.docx")
Added public property Style.locked
A new public property locked has been added to class Style:
@property
def locked(self) -> bool:
"""Specifies whether this style is locked."""
...
Use Case
This use case explains how to get and set locked property of a Style:
from aspose.words import Document, StyleIdentifier
doc = Document()
style_heading_1 = doc.styles[StyleIdentifier.HEADING1]
if not style_heading_1.locked:
style_heading_1.locked = True
doc.save("Styles.LockStyle.docx")
Added public property TxtLoadOptions.DetectHyperlinks
A new public property detect_hyperlinks has been added to class TxtLoadOptions:
@property
def detect_hyperlinks(self) -> bool:
"""Specifies either to detect hyperlinks in text.
The default value is ``False``."""
...
@detect_hyperlinks.setter
def detect_hyperlinks(self, value: bool):
...
...
Use Case
This use case explains how to recognize hyperlinks when loading TXT documents:
from aspose.words import Document, StyleIdentifier
from aspose.words.loading import TxtLoadOptions
import io
input_text = b"Some links in TXT:\nhttps://www.aspose.com/\nhttps://docs.aspose.com/words/python-net/\n"
stream_ = io.BytesIO()
stream_.write(input_text)
stream_.flush()
options = TxtLoadOptions()
options.detect_hyperlinks = True
doc = Document(stream_, options)
stream_.close()
for field in doc.range.fields:
print(field.result)