Streamlined Markdown Import
- The new public property
preserve_empty_lines
is added to the MarkdownLoadOptions
class in this release of the Python API.
Seamlessly preserve empty lines within Markdown files during the import process with the newly introduced MarkdownLoadOptions.preserve_empty_lines
property, enhancing document fidelity. The following Python code sample showcases how to use this property to maintain the intended structure and layout of your Markdown documents by retaining empty lines during Markdown file import:
from aspose.words import Document
import os
import io
from aspose.words.loading import MarkdownLoadOptions
md_text = f"{os.linesep}Line1{os.linesep}{os.linesep}Line2{os.linesep}{os.linesep}"
stream = io.BytesIO(str.encode(md_text))
stream.seek(0)
load_options = MarkdownLoadOptions()
load_options.preserve_empty_lines = True
doc = Document(stream, load_options)
Source*
Style Management
- New public properties
priority
, unhide_when_used
, and semi_hidden
are added to the Style
class.
Using these newly added properties, developers can enjoy better control over style visibility and priority within documents and manage styles programmatically for consistent formatting and easier customization. Please check the below-given code snippet, which demonstrates the usage of the new additions:
from aspose.words import Document, StyleIdentifier
doc = Document()
style_title = doc.styles.get_by_style_identifier(StyleIdentifier.SUBTITLE)
if style_title.priority == 9:
style_title.priority = 10
if not style_title.unhide_when_used:
style_title.unhide_when_used = True
if style_title.semi_hidden:
style_title.semi_hidden = True
doc.save("Styles.StylePriority.docx")
Source*
SVG Rendering Options
- In this release of Aspose.Words for Python via .NET, a new public method
Save
has been added to the NodeRendererBase
class.
This allows you to render shapes as SVG images and handle their output quality and appearance. The coding example shared below highlights the use of the ShapeRenderer.save()
and OfficeMathRenderer.save()
methods while applying SvgSaveOptions
and rendering to SVG:
from aspose.words import Document, NodeType
from aspose.words.saving import SvgSaveOptions, SvgTextOutputMode
doc = Document("Office math.docx")
math = doc.get_child(NodeType.OFFICE_MATH, 0, True).as_office_math()
options = SvgSaveOptions()
options.text_output_mode = SvgTextOutputMode.USE_PLACED_GLYPHS
math.get_math_renderer().save("SvgSaveOptions.Output.svg", options)
Source*
- A new
actual_reference_mark
public property is added to the Footnote
class, and the update_actual_reference_marks
public method is added to the Document
class in this release.
Developers can utilize these new additions to programmatically retrieve the actual text displayed for footnote and endnote reference marks within their Python document processing apps and ensure data accuracy. Please review this code snippet to learn how to extract the actual reference mark text:
from aspose.words import Document, NodeType
doc = Document("Footnotes and endnotes.docx")
footnote = doc.get_child(NodeType.FOOTNOTE, 1, True).as_footnote()
doc.update_fields()
doc.update_actual_reference_marks()
self.assertEqual("1", footnote.actual_reference_mark)
Source*
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.2 Release Notes.