// For complete examples and data files, please go to https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-Java
try {
// Setup GroupDocs.Viewer config
ViewerConfig config = Utilities.getConfiguration();
// File guid
String guid = fileName;
// Create html handler
ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler(config);
// Set html options to show grid lines
HtmlOptions options = new HtmlOptions();
options.getCellsOptions().setShowGridLines(true);
List<PageHtml> pages = htmlHandler.getPages(guid, options);
for (PageHtml page : pages) {
System.out.println("Page number: " + page.getPageNumber());
System.out.println("Html content: " + page.getHtmlContent());
Utilities.saveAsHtml(page.getPageNumber() + "_" + fileName, page.getHtmlContent());
}
} catch (Exception exp) {
System.out.println("Exception: " + exp.getMessage());
exp.printStackTrace();
}