Edit HTML in C#

Edit HTML documents in C# using Aspose.Slides for .NET.

Edit HTML Using Aspose.Slides

Aspose.Slides for .NET can load HTML into a presentation, update slide content, and save the result back to HTML.

Edit HTML in C#

Using Aspose.Slides for .NET , you can update text imported from an HTML document with a few lines of C# code.

C# code for editing HTML

using var presentation = new Presentation();
presentation.Slides.RemoveAt(0);
presentation.Slides.AddFromHtml("page.html");

var slide = presentation.Slides[0];

if (slide.Shapes[0] is IAutoShape shape && shape.TextFrame is not null)
{
    shape.TextFrame.Text = "New text";
}

presentation.Save("page.html", SaveFormat.Html);

How to Edit HTML

  1. Create a Presentation object.

  2. Load HTML content with AddFromHtml.

  3. Access the target slide and shape through variables.

  4. Update the text through TextFrame and save with SaveFormat.Html.

Edit other files

You can also edit files in other formats