Excel vers HTML - Utiliser l'option PresentationPreference pour une meilleure mise en page
Contents
[
Hide
]
Aspose.Cells fournit une propriété HtmlSaveOptions.PresentationPreference utile pour les développeurs qui ont besoin d’améliorer la mise en page lors de l’enregistrement d’un fichier Excel Microsoft au format HTML ou MHT. La valeur par défaut de la propriété est false. Nous vous recommandons de définir cette propriété sur true pour obtenir une présentation plus attrayante des rapports Excel.
Veuillez consulter l’exemple de code ci-dessous qui montre comment rendre un fichier HTML à partir d’un rapport Excel avec la préférence de présentation activée.
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); |