Affettatrice di rendering
Contents
[
Hide
]
Possibili scenari di utilizzo
Aspose.Cells supporta il rendering della forma affettatrice. Se converti il tuo foglio di lavoro in un’immagine o salvi la tua cartella di lavoro nei formati PDF o HTML, vedrai che gli slicer vengono visualizzati correttamente.
Affettatrice di rendering
Il codice di esempio seguente carica il fileesempio di file Excelche contiene un’affettatrice esistente. Converte il foglio di lavoro in un’immagine impostando l’area di stampa che copre solo l’affettatrice. L’immagine che scorre è ilimmagine in uscita che mostra l’affettatrice renderizzata. Come puoi vedere, l’affettatrice è stata renderizzata correttamente e ha lo stesso aspetto del file Excel di esempio.
Codice d’esempio
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 | |
// Load sample Excel file containing slicer. | |
Workbook wb = new Workbook("sampleRenderingSlicer.xlsx"); | |
// Access first worksheet. | |
Worksheet ws = wb.Worksheets[0]; | |
// Set the print area because we want to render slicer only. | |
ws.PageSetup.PrintArea = "B15:E25"; | |
// Specify image or print options, set one page per sheet and only area to true. | |
Aspose.Cells.Rendering.ImageOrPrintOptions imgOpts = new Aspose.Cells.Rendering.ImageOrPrintOptions(); | |
imgOpts.HorizontalResolution = 200; | |
imgOpts.VerticalResolution = 200; | |
imgOpts.ImageType = Aspose.Cells.Drawing.ImageType.Png; | |
imgOpts.OnePagePerSheet = true; | |
imgOpts.OnlyArea = true; | |
// Create sheet render object and render worksheet to image. | |
Aspose.Cells.Rendering.SheetRender sr = new Aspose.Cells.Rendering.SheetRender(ws, imgOpts); | |
sr.ToImage(0, "outputRenderingSlicer.png"); |