Excel till HTML - Använd PresentationPreference Option för bättre layout
Contents
[
Hide
]
Aspose.Cells tillhandahåller en användbar HtmlSaveOptions.PresentationPreference-egenskap för utvecklare som behöver göra en bättre layout när de sparar en Microsoft Excel-fil till HTML- eller MHT-format. Standardvärdet för egenskapen är falskt. Vi rekommenderar att du ställer in den här egenskapen till sann för att få en mer attraktiv presentation av Excel-rapporter.
Se exempelkoden nedan som visar hur man renderar en HTML-fil från Excel-rapport med presentationspreferens på.
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); |