Excel 到 HTML - 使用 PresentationPreference 选项以获得更好的布局
Contents
[
Hide
]
Aspose.Cells 为需要在将 Microsoft Excel 文件保存为 HTML 或 MHT 格式时需要呈现更好布局的开发人员提供了一个有用的 HtmlSaveOptions.PresentationPreference 属性。该属性的默认值为 false。我们建议将此属性设置为 true 以获得更具吸引力的 Excel 报告显示。
请参阅下面的示例代码,该代码演示了如何在显示首选项打开的情况下从 Excel 报告中呈现 HTML 文件。
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-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | |
// Instantiate the Workbook | |
// Load an Excel file | |
Workbook workbook = new Workbook(dataDir+ "sample.xlsx"); | |
// Create HtmlSaveOptions object | |
HtmlSaveOptions options = new HtmlSaveOptions(); | |
// Set the Presenation preference option | |
options.PresentationPreference = true; | |
// Save the Excel file to HTML with specified option | |
workbook.Save(dataDir+ "outPresentationlayout1.out.html", options); |