# Edit HTML in Java

> Edit HTML files in Java. Use Aspose.Slides for Java to modify HTML content and save the edited file.

Source: https://products.aspose.com/slides/java/editor/html/
Updated: 2026-07-09



## Edit HTML using Aspose.Slides

[Aspose.Slides for Java](/slides/java/) is a Java API for working with presentation content. You can import an `HTML` file into a `Presentation`, add a text shape, and save the edited content as `HTML`.

## Edit HTML in Java

Using [Aspose.Slides for Java](/slides/java/), you can edit an `HTML` file by adding a text shape and saving the result with `SaveFormat.Html`.

### Java code for editing HTML

```java
Presentation presentation = new Presentation();
try {
    presentation.getSlides().removeAt(0);
    FileInputStream htmlInputStream = new FileInputStream("page.html");
    try {
        presentation.getSlides().addFromHtml(htmlInputStream);
    } finally {
        htmlInputStream.close();
    }

    ISlide slide = presentation.getSlides().get_Item(0);
    IAutoShape textBox = slide.getShapes().addAutoShape(ShapeType.Rectangle, 10, 10, 100, 50);
    textBox.getTextFrame().setText("New text");

    presentation.save("page.html", SaveFormat.Html);
} finally {
    presentation.dispose();
}
```

## How to edit HTML in Java

Install [Aspose.Slides for Java](https://docs.aspose.com/slides/java/installation/).

Add the library as a reference in your project.

Create a `Presentation` instance and import the source `HTML` content.

Access the slide you want to edit.

Add a text shape with `addAutoShape` and `setText`.

Save the edited `HTML` file with `SaveFormat.Html`.

## Edit other files
