# Edit HTML in Python

> Import HTML content, add text or shapes, and export the edited result as HTML5 with Aspose.Slides for Python via .NET.

Source: https://products.aspose.com/slides/python-net/editor/html/
Updated: 2026-07-27



## Edit HTML using Aspose.Slides

[*Aspose.Slides for Python via .NET*](/slides/python-net/) lets you import HTML content into slides, add presentation elements such as text and shapes, and export the edited presentation as HTML5. This workflow changes the imported slide content rather than the original HTML document.

## Edit HTML in Python

The following example imports an HTML file into a `Presentation`, adds a text-bearing shape to the first imported slide, and exports the result as HTML5.

### Python code for editing HTML

```python
with slides.Presentation() as presentation:
    presentation.slides.remove_at(0)

    with open("page.html", "rb") as html_stream:
        presentation.slides.add_from_html(html_stream)

    slide = presentation.slides[0]
    text_shape = slide.shapes.add_auto_shape(
        slides.ShapeType.RECTANGLE, 10, 10, 300, 50)
    text_shape.text_frame.text = "New text"

    presentation.save("edited-page.html", slides.export.SaveFormat.HTML5)
```

## How to edit HTML in Python

Install Aspose.Slides for Python via .NET by following the [installation guide](https://docs.aspose.com/slides/python-net/installation/).

Create an empty `Presentation`.

Remove the default blank slide from the presentation.

Open the HTML file as a binary stream and pass it to `SlideCollection.add_from_html`.

Access the imported slide through a `slide` variable, add an `AutoShape`, and set its text.

Call `Presentation.save` with `SaveFormat.HTML5` to export the edited content.

## Edit other files
