# Merge HTML Files in C++

> Merge HTML files in C++. Use Aspose.Slides for C++ to combine HTML content and save the result as an HTML file.

Source: https://products.aspose.com/slides/cpp/merger/html-to-html/
Updated: 2026-07-09



## Merge HTML to HTML using Aspose.Slides

[**Aspose.Slides for C++**](/slides/cpp/) is a C++ API for working with presentation content and related formats. You can read multiple `HTML` files, add their content to a `Presentation`, and save the merged output with `SaveFormat::Html5`.

## Merge HTML to HTML in C++

Using [**Aspose.Slides for C++**](/slides/cpp/), you can merge `HTML` files by loading their content with `File::ReadAllText`, importing it with `AddFromHtml`, and saving the result as `HTML`.

### C++ code for merging HTML to HTML

```cpp
auto firstHtmlText = File::ReadAllText(u"first.html");
auto secondHtmlText = File::ReadAllText(u"second.html");
auto presentation = MakeObject<Presentation>();

presentation->get_Slides()->RemoveAt(0);
presentation->get_Slides()->AddFromHtml(firstHtmlText);
presentation->get_Slides()->AddFromHtml(secondHtmlText);

presentation->Save(u"merged.html", SaveFormat::Html5);
presentation->Dispose();
```

## How to merge HTML files in C++

Install **Aspose.Slides for C++**. See [**Installation**](https://docs.aspose.com/slides/cpp/installation/).

Add the library as a reference in your project.

Read the source `HTML` files with `File::ReadAllText`.

Create a `Presentation` instance and import the `HTML` content with `AddFromHtml`.

Save the merged file with `SaveFormat::Html5`.

## Merge other files
