إخراج صفحة فارغة عندما لا يوجد شيء للطباعة
Contents
[
Hide
]
سيناريوهات الاستخدام الممكنة
إذا كانت الورقة فارغة ، فلن يطبع Aspose.Cells أي شيء عند تصدير ورقة العمل إلى الصورة. يمكنك تغيير هذا السلوك باستخدامImageOrPrintOptions.OutputBlankPageWhenNothingToPrint خاصية. عندما تقوم بتعيينهحقيقي، سيتم طباعة الصفحة الفارغة.
إخراج صفحة فارغة عندما لا يوجد شيء للطباعة
ينشئ نموذج التعليمات البرمجية التالي مصنفًا فارغًا يحتوي على ورقة عمل فارغة ويعرض ورقة العمل الفارغة إلى صورة بعد تعيينImageOrPrintOptions.OutputBlankPageWhenNothingToPrint الملكية مثلحقيقي. وبالتالي ، فإنه ينشئ صفحة فارغة حيث لا يوجد شيء يمكن طباعته يمكنك رؤيته في الصورة أدناه.
عينة من الرموز
This file contains hidden or 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 | |
//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"); |