Export Presentations to XAML in Python via Java

Overview

This article explains how to export PowerPoint and OpenDocument presentations to XAML using Aspose.Slides for Python via Java. It introduces XAML, shows how to export with default settings, and demonstrates how to include hidden slides with XamlOptions.

The examples require Aspose.Slides for Python via Java and a compatible Java runtime. Place pres.pptx in the current working directory. Each example starts the JVM only if it is not already running.

About XAML

XAML (Extensible Application Markup Language) is an XML-based language for describing user interfaces. It is used by frameworks such as Windows Presentation Foundation (WPF). You can create and edit XAML with a visual designer or a text editor.

Export Presentations to XAML with Default Options

Create a Presentation from the input file, then pass XamlOptions to Presentation.save to export with default settings:

import jpype
import asposeslides

if not jpype.isJVMStarted():
    jpype.startJVM()

from asposeslides.api import Presentation, XamlOptions

presentation = Presentation("pres.pptx")
try:
    xaml_options = XamlOptions()
    presentation.save(xaml_options)
finally:
    presentation.dispose()

Export Presentations to XAML with Custom Options

Use XamlOptions to configure the export. To include hidden slides, call setExportHiddenSlides with True before saving:

import jpype
import asposeslides

if not jpype.isJVMStarted():
    jpype.startJVM()

from asposeslides.api import Presentation, XamlOptions

presentation = Presentation("pres.pptx")
try:
    xaml_options = XamlOptions()
    xaml_options.setExportHiddenSlides(True)
    presentation.save(xaml_options)
finally:
    presentation.dispose()

FAQ

How can I choose a fallback font when the original font is unavailable?

Use setDefaultRegularFont on your XamlOptions object to specify a fallback font. Make sure the selected font is available in the export environment.

Can I use the exported markup in any XAML framework?

XAML frameworks differ in their supported elements and features. Test the exported markup in your target framework before integrating it into an application.

Are hidden slides exported by default?

No. To include them, call setExportHiddenSlides with True. Keep it set to False to exclude them.