Merge HTML in Java
Use Aspose.Slides for Java to merge HTML files in Java applications.
Merge HTML to HTML in Java
Using
Aspose.Slides for Java
, you can merge HTML files and create an HTML result with a few lines of Java code.
Java code for merging HTML to HTML
Presentation presentation = new Presentation();
try {
presentation.getSlides().removeAt(0);
FileInputStream firstHtmlStream = new FileInputStream("file1.html");
try {
presentation.getSlides().addFromHtml(firstHtmlStream);
} finally {
firstHtmlStream.close();
}
FileInputStream secondHtmlStream = new FileInputStream("file2.html");
try {
presentation.getSlides().addFromHtml(secondHtmlStream);
} finally {
secondHtmlStream.close();
}
presentation.save("merged.html", SaveFormat.Html);
} finally {
presentation.dispose();
}Merge HTML to HTML using Aspose.Slides
Aspose.Slides for Java
is a Java API for creating, editing, converting, and merging presentation content. You can place HTML files into a Presentation and save the merged content as an HTML file.
How to merge HTML files in Java
- Install Aspose.Slides for Java.
- Add the library as a reference in your project.
- Create a
Presentationinstance. - Import the source
HTMLfiles withaddFromHtml. - Save the merged content with
SaveFormat.Html.
Built with Aspose.Slides
Merge HTML Files Online
The free Aspose.Slides Merger app is built with Aspose.Slides for Java, 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 to get a single file.