将Excel转换为HTML 使用PresentationPreference选项以获得更好的布局
Contents
[
Hide
]
Aspose.Cells提供了一个有用的属性,HtmlSaveOptions.PresentationPreference,开发人员可以使用它在将Microsoft Excel文件保存为HTML或MHT格式时获得更好的布局。该属性的默认值为false。我们建议将该属性设置为true,以从Excel报告中获得更美观的演示。
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"); |
您可能会发现以下关于将Excel转换为HTML的文章有用