احصل على عرض الورق وارتفاعه في إعداد الصفحة لورقة العمل
Contents
[
Hide
]
سيناريوهات الاستخدام الممكنة
في بعض الأحيان ، تحتاج إلى معرفة عرض وارتفاع حجم الورق حيث تم تعيينه في إعداد الصفحة لورقة العمل. الرجاء استخدامPageSetup.PaperWidthوPageSetup.PaperHeight. إعداد الصفحةخصائص لهذا الغرض.
احصل على عرض الورق وارتفاعه في إعداد الصفحة لورقة العمل
يشرح نموذج التعليمات البرمجية التالي استخدامPageSetup.PaperWidth وPageSetup.PaperHeight. إعداد الصفحة الخصائص. يقوم أولاً بتغيير حجم الورق إلىأ 2ثم يبحث عن عرض الورق وارتفاعه ، ثم يقوم بتغييره إلىA3, A4, رسالةويجد عرض الورق وارتفاعه على التوالي.
عينة من الرموز
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 | |
// Create an instance of Workbook class | |
Workbook book = new Workbook(); | |
// Access first worksheet | |
Worksheet sheet = book.Worksheets[0]; | |
// Set paper size to A2 and print paper width and height in inches | |
sheet.PageSetup.PaperSize = PaperSizeType.PaperA2; | |
Console.WriteLine("PaperA2: " + sheet.PageSetup.PaperWidth + "x" + sheet.PageSetup.PaperHeight); | |
// Set paper size to A3 and print paper width and height in inches | |
sheet.PageSetup.PaperSize = PaperSizeType.PaperA3; | |
Console.WriteLine("PaperA3: " + sheet.PageSetup.PaperWidth + "x" + sheet.PageSetup.PaperHeight); | |
// Set paper size to A4 and print paper width and height in inches | |
sheet.PageSetup.PaperSize = PaperSizeType.PaperA4; | |
Console.WriteLine("PaperA4: " + sheet.PageSetup.PaperWidth + "x" + sheet.PageSetup.PaperHeight); | |
// Set paper size to Letter and print paper width and height in inches | |
sheet.PageSetup.PaperSize = PaperSizeType.PaperLetter; | |
Console.WriteLine("PaperLetter: " + sheet.PageSetup.PaperWidth + "x" + sheet.PageSetup.PaperHeight); |
إخراج وحدة التحكم
هنا هو إخراج وحدة التحكم من نموذج التعليمات البرمجية أعلاه.
PaperA2: 16.54x23.39
PaperA3: 11.69x16.54
PaperA4: 8.27x11.69
PaperLetter: 8.5x11