Aspose.Words for Python via .NET 24.8.0 is now available for Windows AMD64. This release brings significant features, API updates, and bug fixes to enhance your Word document management experience on the Windows platforms.
Chart Customization
You can achieve precise control over chart axis tick labels with new orientation and rotation settings in this release of the Python Word API release, and make chart presentations more flexible and visually appealing.
Code example:
doc = aw.Document()
builder = aw.DocumentBuilder(doc)
# Insert a column chart.
shape = builder.insert_chart(chart_type=aw.drawing.charts.ChartType.COLUMN, width=432, height=252)
x_tick_labels = shape.chart.axis_x.tick_labels
y_tick_labels = shape.chart.axis_y.tick_labels
# Set axis tick label orientation and rotation.
x_tick_labels.orientation = aw.drawing.ShapeTextOrientation.VERTICAL_FAR_EAST
x_tick_labels.rotation = -30
y_tick_labels.orientation = aw.drawing.ShapeTextOrientation.HORIZONTAL
y_tick_labels.rotation = 45
doc.save(file_name=ARTIFACTS_DIR + 'Charts.TickLabelsOrientationRotation.docx')
Source*
Font Management
The new EmbeddingLicensingRights
property in FontInfo
and PhysicalFontInfo
classes in the latest version gives you more control over font embedding permissions so that you can manage fonts with ease.
Code example:
settings = aw.fonts.FontSettings.default_instance
source = settings.get_fonts_sources()[0]
# Get the list of available fonts.
font_infos = source.get_available_fonts()
for font_info in font_infos:
if font_info.embedding_licensing_rights != None:
print(font_info.embedding_licensing_rights.embedding_usage_permissions)
print(font_info.embedding_licensing_rights.bitmap_embedding_only)
print(font_info.embedding_licensing_rights.no_subsetting)
Source*
Document Structure
Easily clear section headers and footers without affecting watermarks, to streamline document structure management on Win64 systems.
Code example:
doc = aw.Document(file_name=MY_DIR + 'Header and footer types.docx')
# Add a plain text watermark.
doc.watermark.set_text(text='Aspose Watermark')
# Make sure the headers and footers have content.
headers_footers = doc.first_section.headers_footers
self.assertEqual('First header', headers_footers.get_by_header_footer_type(aw.HeaderFooterType.HEADER_FIRST).get_text().strip())
self.assertEqual('Second header', headers_footers.get_by_header_footer_type(aw.HeaderFooterType.HEADER_EVEN).get_text().strip())
self.assertEqual('Third header', headers_footers.get_by_header_footer_type(aw.HeaderFooterType.HEADER_PRIMARY).get_text().strip())
self.assertEqual('First footer', headers_footers.get_by_header_footer_type(aw.HeaderFooterType.FOOTER_FIRST).get_text().strip())
self.assertEqual('Second footer', headers_footers.get_by_header_footer_type(aw.HeaderFooterType.FOOTER_EVEN).get_text().strip())
self.assertEqual('Third footer', headers_footers.get_by_header_footer_type(aw.HeaderFooterType.FOOTER_PRIMARY).get_text().strip())
# Removes all header and footer content except watermarks.
doc.first_section.clear_headers_footers(True)
headers_footers = doc.first_section.headers_footers
self.assertEqual('', headers_footers.get_by_header_footer_type(aw.HeaderFooterType.HEADER_FIRST).get_text().strip())
self.assertEqual('', headers_footers.get_by_header_footer_type(aw.HeaderFooterType.HEADER_EVEN).get_text().strip())
self.assertEqual('', headers_footers.get_by_header_footer_type(aw.HeaderFooterType.HEADER_PRIMARY).get_text().strip())
self.assertEqual('', headers_footers.get_by_header_footer_type(aw.HeaderFooterType.FOOTER_FIRST).get_text().strip())
self.assertEqual('', headers_footers.get_by_header_footer_type(aw.HeaderFooterType.FOOTER_EVEN).get_text().strip())
self.assertEqual('', headers_footers.get_by_header_footer_type(aw.HeaderFooterType.FOOTER_PRIMARY).get_text().strip())
self.assertEqual(aw.WatermarkType.TEXT, doc.watermark.type)
# Removes all header and footer content including watermarks.
doc.first_section.clear_headers_footers(False)
self.assertEqual(aw.WatermarkType.NONE, doc.watermark.type)
Source*
We have improved backward compatibility for exporting HTML and XAML documents in Aspose.Words for Python via .NET 24.8.0, which addresses issues with backslashes and yen sign conversions.
Code example:
doc = aw.Document(file_name=MY_DIR + 'Korean backslash symbol.docx')
# By default, Aspose.Words mimics MS Word's behavior and doesn't replace backslash characters with yen signs in
# generated HTML documents. However, previous versions of Aspose.Words performed such replacements in certain
# scenarios. This flag enables backward compatibility with previous versions of Aspose.Words.
save_options = aw.saving.HtmlSaveOptions()
save_options.replace_backslash_with_yen_sign = True
doc.save(file_name=ARTIFACTS_DIR + 'HtmlSaveOptions.ReplaceBackslashWithYenSign.html', save_options=save_options)
Source*
PDF Functionality
The latest release offers enhanced PDF export options, such as using StructuredDocumentTag
(SDT) tags as form field names, for better form handling.
Code example:
doc = aw.Document(file_name=MY_DIR + 'Form fields.docx')
save_options = aw.saving.PdfSaveOptions()
save_options.preserve_form_fields = True
# When set to 'false', SDT control Id property is used as a name of form field in PDF.
# When set to 'true', SDT control Tag property is used as a name of form field in PDF.
save_options.use_sdt_tag_as_form_field_name = True
doc.save(file_name=ARTIFACTS_DIR + 'PdfSaveOptions.SdtTagAsFormFieldName.pdf', save_options=save_options)
Source*
Digital Signatures
Aspose.Words for Python via .NET now supports the digital signing of XPS documents via XpsSaveOptions
on Windows AMD64 and adds an extra layer of document security.
Code example:
doc = aw.Document(file_name=MY_DIR + 'Document.docx')
certificate_holder = aw.digitalsignatures.CertificateHolder.create(file_name=MY_DIR + 'morzal.pfx', password='aw')
options = aw.digitalsignatures.SignOptions()
options.sign_time = datetime.datetime.now()
options.comments = 'Some comments'
digital_signature_details = aw.saving.DigitalSignatureDetails(certificate_holder, options)
save_options = aw.saving.XpsSaveOptions()
save_options.digital_signature_details = digital_signature_details
self.assertEqual(certificate_holder, digital_signature_details.certificate_holder)
self.assertEqual('Some comments', digital_signature_details.sign_options.comments)
doc.save(file_name=ARTIFACTS_DIR + 'XpsSaveOptions.XpsDigitalSignature.docx', save_options=save_options)
Source*
Bug Fixes
- Resolved an issue with inconsistent font embedding rights during document conversion.
- Fixed a bug related to incorrect chart axis labels in exported PDFs.
- Addressed a problem where HTML export failed to replace backslashes with yen signs.
You can view the list of all new features, enhancements, and bug fixes introduced in this release by visiting Aspose.Words for Python via .NET 24.8.0 Release Notes.