Merge HTML in Java
Use Aspose.Slides for Java to merge HTML files in Java applications.
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.
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();
}
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.
Merge Files Online
Merge presentations and slides online.
Merge other files
You can also combine files in other formats to get a single file.