将Excel转换为HTML 使用PresentationPreference选项以获得更好的布局
Contents
[
Hide
]
Aspose.Cells for Python via .NET 提供了 HtmlSaveOptions.PresentationPreference 属性,方便开发者在将Microsoft Excel文件保存为HTML或MHT格式时获得更好的布局。默认值为 false。建议将该属性设置为 true,以获得更美观的Excel报告。
请参阅下面的示例代码,演示了如何使用幻灯片首选项渲染来自Excel报告的HTML文件。
This file contains hidden or 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
from aspose.cells import HtmlSaveOptions, Workbook | |
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET | |
# The path to the documents directory. | |
dataDir = RunExamples.GetDataDir(".") | |
# Instantiate the Workbook | |
# Load an Excel file | |
workbook = Workbook(dataDir + "sample.xlsx") | |
# Create HtmlSaveOptions object | |
options = HtmlSaveOptions() | |
# Set the Presenation preference option | |
options.presentation_preference = True | |
# Save the Excel file to HTML with specified option | |
workbook.save(dataDir + "outPresentationlayout1.out.html", options) |