Merge HTML Files in C++

Use Aspose.Slides for C++ to combine HTML files in C++ applications.

Merge HTML to HTML in C++

Using Aspose.Slides for C++ , 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

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();

Merge HTML to HTML using Aspose.Slides

Aspose.Slides for C++ 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.

How to merge HTML files in C++

  1. Install Aspose.Slides for C++. See Installation.
  2. Add the library as a reference in your project.
  3. Read the source HTML files with File::ReadAllText.
  4. Create a Presentation instance and import the HTML content with AddFromHtml.
  5. Save the merged file with SaveFormat::Html5.

Built with Aspose.Slides

Merge HTML Files Online

The free Aspose.Slides Merger app is built with Aspose.Slides for C++, the same API as the code above. Open it and see what the API can do with your own HTML files.

  • Runs in your browser, nothing to install.
  • See how Aspose.Slides merges files before you write code.
  • Upload several HTML files and combine them into one.
  • Download the merged result as one file.

Merge other files

You can also combine files in other formats.