Excel an HTML – Verwenden Sie die PresentationPreference-Option für ein besseres Layout
Contents
[
Hide
]
Aspose.Cells bietet eine nützliche HtmlSaveOptions.PresentationPreference-Eigenschaft für Entwickler, die beim Speichern einer Microsoft-Excel-Datei im HTML- oder MHT-Format ein besseres Layout rendern müssen. Der Standardwert der Eigenschaft ist false. Wir empfehlen, diese Eigenschaft auf true zu setzen, um eine ansprechendere Darstellung von Excel-Berichten zu erhalten.
Bitte sehen Sie sich den Beispielcode unten an, der zeigt, wie eine HTML-Datei aus einem Excel-Bericht mit aktivierter Präsentationseinstellung gerendert wird.
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); |