Browse our Products

Aspose.Slides for Python via .NET 24.6 Release Notes

New Features and Enhancements

KeySummaryCategoryRelated Documentation
SLIDESNET-44473Highlight and list all the highlighted words in presentationEnhancement
SLIDESNET-44568Loading the corrupted PPTX file throws PptxReadExceptionEnhancementhttps://docs.aspose.com/slides/python-net/open-presentation/

Other Improvements and Changes

KeySummaryCategoryRelated Documentation
SLIDESPYNET-170Use Aspose.Slides for Net 24.6 featuresEnhancementhttps://releases.aspose.com/slides/net/release-notes/2024/aspose-slides-for-net-24-6-release-notes/

Public API Changes

ITextSearchOptions interface has been added

The new interface, ITextSearchOptions, represents options that can be used to search for text in a Presentation, Slide or TextFrame.

Example:

import aspose.slides as slides

with slides.Presentation("pres.pptx") as presentation:
    text_search_options = slides.TextSearchOptions()
    text_search_options.whole_words_only = True

    presentation.replace_text("the", "***", text_search_options, None)
    presentation.save("pres-out.pptx", slides.export.SaveFormat.PPTX)

ITextFrame.highlight_text() and ITextFrame.highlight_regex() methods have been added

New methods hightlight_text and highlight_regex have been added to the ITextFrame interface and the TextFrame class.

The following code sample shows how to highlight text in a TextFrame:

import aspose.slides as slides
import aspose.pydrawing as drawing

with slides.Presentation("pres.pptx") as presentation:
    # highlighting all words 'important'
    presentation.slides[0].shapes[0].text_frame.highlight_text("important", drawing.Color.light_blue)

    text_search_options = slides.TextSearchOptions()
    text_search_options.whole_words_only = True

    # highlighting all separate 'the' occurrences
    presentation.slides[0].shapes[0].text_frame.highlight_text("the", drawing.Color.violet, text_search_options, None)

    presentation.save("pres-out2.pptx", slides.export.SaveFormat.PPTX)

The following code sample shows how to highlight text using regular expression in a TextFrame:

import aspose.slides as slides
import aspose.pydrawing as drawing

with slides.Presentation("pres.pptx") as presentation:
    # highlighting all words with 10 or more characters
    presentation.slides[0].shapes[0].text_frame.highlight_regex(r"\b[^\s]{10,}\b", drawing.Color.blue)

    presentation.save("SomePresentation-out.pptx", slides.export.SaveFormat.PPTX)

ITextFrame.replace_text() and ITextFrame.replace_regex() methods have been added

New methods replace_text and replace_regex have been added to the ITextFrame interface and the TextFrame class.

The following code sample shows how to replace a specified string with another specified string:

import aspose.slides as slides

with slides.Presentation("pres.pptx") as presentation:
    text_search_options = slides.TextSearchOptions()
    text_search_options.whole_words_only = True

    presentation.slides[0].shapes[0].text_frame.replace_text("the", "***", text_search_options, None)
    presentation.save("SomePresentation-out2.pptx", slides.export.SaveFormat.PPTX)

The following code sample shows how to replace text using regular expression:

import aspose.slides as slides

with slides.Presentation("pres.pptx") as presentation:
    # Replace all words with 5 or more characters with '***'
    presentation.slides[0].shapes[0].text_frame.replace_regex(r"\b[^\s]{5,}\b", "***")

    presentation.save("SomePresentation-out.pptx", slides.export.SaveFormat.PPTX)

IPresentation.highlight_text() and IPresentation.highlight_regex() methods have been added

New methods highlight_text and highlight_regex have been added to the IPresentation interface and the Presentation class.

The following code sample shows to highlight text in a PowerPoint Presentation:

import aspose.slides as slides
import aspose.pydrawing as drawing

with slides.Presentation("pres.pptx") as presentation:
    text_search_options = slides.TextSearchOptions()
    text_search_options.whole_words_only = True

    # highlighting all separate 'the' occurrences
    presentation.highlight_text("the", drawing.Color.violet, text_search_options, None)

    # highlight all 'abi' character sequences
    presentation.highlight_text("abi", drawing.Color.red)

    presentation.save("pres-out.pptx", slides.export.SaveFormat.PPTX)

The following code sample shows how to highlight text using regular expressions:

import aspose.slides as slides
import aspose.pydrawing as drawing

with slides.Presentation("pres.pptx") as presentation:
    # highlighting all words with 10 or more characters
    presentation.highlight_regex(r"\b[^\s]{10,}\b", drawing.Color.blue)

    presentation.save("pres-out.pptx", slides.export.SaveFormat.PPTX)

IPresentation.replace_text() and IPresentation.replace_regex() method have been added

New methods replace_text and replace_regex have been added to the IPresentation interface and the Presentation class.

The following code sample shows how to replace a specified string with another specified string:

import aspose.slides as slides

with slides.Presentation("SomePresentation.pptx") as presentation:
    text_search_options = slides.TextSearchOptions()
    text_search_options.whole_words_only = True

    presentation.replace_text("the", "***", text_search_options, None)
    presentation.save("SomePresentation-out2.pptx", slides.export.SaveFormat.PPTX)

The following code sample shows how to replace text using regular expressions:

import aspose.slides as slides

with slides.Presentation("SomePresentation.pptx") as presentation:
    # Replace all words with 10 or more characters with '***'
    presentation.replace_regex(r"\b[^\s]{10,}\b", "***")

    presentation.save("SomePresentation-out.pptx", slides.export.SaveFormat.PPTX)

ISaveOptions.gradient_style property has been added

A new property gradient_style has been added to ISaveOptions interface. It allows users to change the visual rendering style of a two-color gradient. Two options are available:

  • GradientStyle.DEFAULT - renders the gradient similarly to how it appears when exporting a presentation to an image using PowerPoint.
  • GradientStyle.POWER_POINT_UI - renders the two-color gradient according to its appearance in the PowerPoint user interface.

Example:

import aspose.slides as slides

with slides.Presentation("pres.pptx") as pres:
    options = slides.export.RenderingOptions()
    options.gradient_style = slides.GradientStyle.POWER_POINT_UI
    img = pres.slides[0].get_image(options, 2, 2)

Methods have been marked as obsolete

The following methods have been marked as obsolete and will be removed in version 24.10.

Intefaces and classes have been marked as obsolete

The following interfaces and classes have been marked as obsolete and will be removed in version 24.10.