كيفية تغيير لون خط التعليق
Contents
[
Hide
]
Microsoft يسمح Excel للمستخدمين بإضافة تعليقات إلى الخلايا لإضافة معلومات إضافية وإبراز البيانات. قد يحتاج المطورون إلى تخصيص التعليق لتحديد إعدادات المحاذاة ، واتجاه النص لون الخط ، وما إلى ذلك. يوفر Aspose.Cells واجهات برمجة التطبيقات (API) لإنجاز المهمة.
يوفر Aspose.Cells أالشكل والنص الجسمخاصية لون خط التعليق. يوضح نموذج التعليمات البرمجية التالي استخدامالشكل والنص الجسملتعيين اتجاه النص للتعليق.
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 | |
//Output directory | |
string outputDir = RunExamples.Get_OutputDirectory(); | |
// Instantiate a new Workbook | |
Workbook workbook = new Workbook(); | |
// Get the first worksheet | |
Worksheet worksheet = workbook.Worksheets[0]; | |
//Add some text in cell A1 | |
worksheet.Cells["A1"].PutValue("Here"); | |
// Add a comment to A1 cell | |
var comment = worksheet.Comments[worksheet.Comments.Add("A1")]; | |
// Set its vertical alignment setting | |
comment.CommentShape.TextVerticalAlignment = TextAlignmentType.Center; | |
// Set the Comment note | |
comment.Note = "This is my Comment Text. This is Test."; | |
Shape shape = worksheet.Comments["A1"].CommentShape; | |
shape.Fill.SolidFill.Color = Color.Black; | |
Font font = shape.Font; | |
font.Color = Color.White; | |
StyleFlag styleFlag = new StyleFlag(); | |
styleFlag.FontColor = true; | |
shape.TextBody.Format(0, shape.Text.Length, font, styleFlag); | |
// Save the Excel file | |
workbook.Save(outputDir + "outputChangeCommentFontColor.xlsx"); |
الملف إلاخراج التي تم إنشاؤها بواسطة الكود أعلاه مرفقة للرجوع اليها.