Excel to HTML - Use PresentationPreference Option for Better Layout
Contents
[
Hide
]
Aspose.Cells provides a useful property, HtmlSaveOptions.PresentationPreference, that developers can use to get better layout when saving a Microsoft Excel file to HTML or MHT format. The default value of the property is false. We recommend setting this property to true to get better-looking presentations from an Excel report.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java | |
// The path to the documents directory. | |
String dataDir = Utils.getDataDir(ExceltoHTMLPresentationPreferenceOption.class); | |
// Instantiate the Workbook | |
// Load an Excel file | |
Workbook workbook = new Workbook(dataDir + "HiddenCol.xlsx"); | |
// Create HtmlSaveOptions object | |
HtmlSaveOptions options = new HtmlSaveOptions(); | |
// Set the Presenation preference option | |
options.setPresentationPreference(true); | |
// Save the Excel file to HTML with specified option | |
workbook.save(dataDir + "outPresentationlayout1.html"); |
You may the find the following articles regarding Excel to HTML conversion helpful