Genera una pagina vuota quando non c è nulla da stampare

Possibili Scenari di Utilizzo

Se il foglio è vuoto, allora Aspose.Cells non stamperà nulla quando si esporta il foglio di lavoro in un’immagine. È possibile modificare questo comportamento utilizzando la proprietà ImageOrPrintOptions.OutputBlankPageWhenNothingToPrint. Quando la imposti su true, stamperà la pagina vuota.

Output Pagina Bianca quando non c’è Nulla da Stampare

Il seguente codice di esempio crea il workbook vuoto che ha un foglio di lavoro vuoto e rende il foglio di lavoro vuoto in un’immagine dopo aver impostato la proprietà ImageOrPrintOptions.OutputBlankPageWhenNothingToPrint come true. Di conseguenza, genera la pagina vuota poiché non c’è nulla da stampare, come puoi vedere nell’immagine sotto.

todo:image_alt_text

Codice di Esempio

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
//Output directory
string outputDir = RunExamples.Get_OutputDirectory();
//Create workbook
Workbook wb = new Workbook();
//Access first worksheet - it is empty sheet
Worksheet ws = wb.Worksheets[0];
//Specify image or print options
//Since the sheet is blank, we will set OutputBlankPageWhenNothingToPrint to true
//So that empty page gets printed
ImageOrPrintOptions opts = new ImageOrPrintOptions();
opts.ImageType = Drawing.ImageType.Png;
opts.OutputBlankPageWhenNothingToPrint = true;
//Render empty sheet to png image
SheetRender sr = new SheetRender(ws, opts);
sr.ToImage(0, outputDir + "OutputBlankPageWhenNothingToPrint.png");