قم بتعيين هوامش التعليق أو الشكل داخل ورقة العمل
Contents
[
Hide
]
سيناريوهات الاستخدام الممكنة
Aspose.Cells يسمح لك بتعيين هوامش أي شكل أو تعليق باستخدامShape.TextBody.TextAlignment خاصية. تقوم هذه الخاصية بإرجاع كائنAspose.Cells.Drawing.Texts.ShapeTextAlignment فئة لها خصائص مختلفة على سبيل المثالالهامش العلوي, LeftMarginPt, الهامش السفلي, الهامش الأيمن، إلخ. التي يمكن استخدامها لتعيين الهوامش العلوية واليسرى والسفلية واليمنى.
قم بتعيين هوامش التعليق أو الشكل داخل ورقة العمل
يرجى الاطلاع على نموذج التعليمات البرمجية التالي. يقوم بتحميل ملفنموذج لملف Excel الذي يحتوي على شكلين. يصل الرمز إلى الأشكال واحدًا تلو الآخر ويضبط هوامشها العلوية واليسرى والسفلية واليمنى. الرجاء مراجعةإخراج ملف Excel تم إنشاؤه بواسطة الكود ولقطة الشاشة التي توضح تأثير الكود على ملف Excel الناتج.
عينة من الرموز
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 the sample Excel file | |
Workbook wb = new Workbook("sampleSetMarginsOfCommentOrShapeInsideTheWorksheet.xlsx"); | |
//Access first worksheet | |
Worksheet ws = wb.Worksheets[0]; | |
foreach (Shape sh in ws.Shapes) | |
{ | |
//Access the text alignment | |
Aspose.Cells.Drawing.Texts.ShapeTextAlignment txtAlign = sh.TextBody.TextAlignment; | |
//Set auto margin false | |
txtAlign.IsAutoMargin = false; | |
//Set the top, left, bottom and right margins | |
txtAlign.TopMarginPt = 10; | |
txtAlign.LeftMarginPt = 10; | |
txtAlign.BottomMarginPt = 10; | |
txtAlign.RightMarginPt = 10; | |
} | |
//Save the output Excel file | |
wb.Save("outputSetMarginsOfCommentOrShapeInsideTheWorksheet.xlsx"); |