Merge HTML

How to merge HTML files in C#

GroupDocs.Merger allows developers to merge HTML files when it’s needed to organize multiple HTML files into single document or send fewer attachments etc. And you can do this without¬†any third-party software or manual work involved. With GroupDocs.Merger it is possible to combine HTML documents of any size and structure - all text, images, tables, graphs, forms and other content will be preserved.

The following example demonstrates how to merge HTML files with several lines of C# code:

  • Create an instance of Merger class and pass source HTML file path as a constructor parameter. You may specify absolute or relative file path as per your requirements.
  • Add another HTML file to merge with Join method. Repeat this step for other HTML documents you want to merge.
  • Call Merger class Save method and specify the filename for the merged HTML file as parameter.
// Load the source HTML file
using (Merger merger = new Merger(@"c:\sample1.html"))
    // Add another HTML file to merge
    // Merge HTML files ans save result

About HTML File Format

HTML (Hyper Text Markup Language) is the extension for web pages created for display in browsers. Known as language of the web, HTML has evolved with requirements of new information requirements to be displayed as part of web pages. The latest variant is known as HTML 5 that gives a lot of flexibility for working with the language. HTML pages are either received from server, where these are hosted, or can be loaded from local system as well.

Code Examples

Please find more use-cases and complete C# sources of our backend and frontend examples and try them for free!

Merge HTML Live Demo

GroupDocs.Merger for .NET provides an online HTML Merger App, which allows you to try it for free and check its quality and accuracy.

“Merge HTML”