Yazdırılacak Hiçbir Şey Olmadığında Boş Sayfa Çıktısı
Olası Kullanım Senaryoları
Sayfa boşsa, çalışma sayfasını görüntüye aktardığınızda Aspose.Cells hiçbir şey yazdırmayacaktır. Bu davranışı kullanarak değiştirebilirsiniz.ImageOrPrintOptions.OutputBlankPageWhenNothingToPrint Emlak. ne zaman ayarlayacaksındoğru, boş sayfayı yazdıracaktır.
Yazdırılacak Hiçbir Şey Olmadığında Boş Sayfa Çıktısı
Aşağıdaki örnek kod, boş bir çalışma sayfası olan boş çalışma kitabını oluşturur ve boş çalışma sayfasını ayarladıktan sonra bir görüntüye dönüştürür.ImageOrPrintOptions.OutputBlankPageWhenNothingToPrintolarak mülkiyetdoğru. Sonuç olarak, aşağıdaki gibi görebileceğiniz yazdırılacak hiçbir şey olmadığı için boş bir sayfa oluşturur.
Basit kod
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java | |
String outDir = Utils.Get_OutputDirectory(); | |
// Create workbook | |
Workbook wb = new Workbook(); | |
// Access first worksheet - it is empty sheet | |
Worksheet ws = wb.getWorksheets().get(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.setImageType(ImageType.PNG); | |
opts.setOutputBlankPageWhenNothingToPrint(true); | |
// Render empty sheet to png image | |
SheetRender sr = new SheetRender(ws, opts); | |
sr.toImage(0, outDir + "OutputBlankPageWhenNothingToPrint.png"); |