Excel en HTML Utiliser l option PresentationPreference pour une meilleure mise en page
Contents
[
Hide
]
Aspose.Cells pour Python via .NET propose une propriété HtmlSaveOptions.PresentationPreference utile pour les développeurs qui souhaitent obtenir une meilleure mise en page lors de l’enregistrement d’un fichier Microsoft Excel en HTML ou MHT. La valeur par défaut de cette propriété est false. Nous recommandons de la régler sur true pour obtenir une présentation plus attractive des rapports Excel.
Veuillez consulter le code d’exemple ci-dessous qui démontre comment rendre un fichier HTML à partir d’un rapport Excel avec une préférence de présentation activée.
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) |