Excel till HTML Använd PresentationPreference alternativet för bättre layout
Contents
[
Hide
]
Aspose.Cells tillhandahåller en användbar HtmlSaveOptions.PresentationPreference egenskap för utvecklare som behöver rendera bättre layout vid sparande av en Microsoft Excel-fil till HTML- eller MHT-formatet. Standardvärdet för egenskapen är false. Vi rekommenderar att du ställer in denna egenskap till true för att få en mer attraktiv presentation av Excel-rapporter.
Se det följande kodexemplet 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); |