كيفية تغيير الخلفية في التعليق في Excel
Contents
[
Hide
]
تتم إضافة التعليقات إلى الخلايا لتسجيل التعليقات ، أي شيء من تفاصيل كيفية عمل الصيغة ، ومن أين تأتي القيمة أو الأسئلة من المراجعين. تلعب التعليقات دورًا مهمًا للغاية عندما يناقش العديد من الأشخاص نفس المستند أو يراجعونه في أوقات مختلفة. كيف نميز تعليقات الناس المختلفين؟ نعم ، يمكننا تعيين لون خلفية مختلف لكل تعليق. ولكن عندما نحتاج إلى معالجة الكثير من المستندات والكثير من التعليقات ، فإن القيام بذلك يدويًا يعد كارثة. لحسن الحظAspose.Cells يوفر API الذي يسمح لك بالقيام بذلك في التعليمات البرمجية.
كيفية تغيير لون التعليق في Excel
عندما لا تحتاج إلى لون الخلفية الافتراضي للتعليقات ، قد ترغب في استبداله باللون الذي تهتم به. كيف يمكنني تغيير لون الخلفية لمربع التعليقات في Excel؟
سيرشدك الكود التالي إلى كيفية الاستخدام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 | |
// The path to the documents directory. | |
string path = ""; | |
//Initialize a new workbook. | |
Workbook book = new Workbook(path + "exmaple.xlsx"); | |
// Accessing the newly added comment | |
Comment comment = book.Worksheets[0].Comments[0]; | |
// change background color | |
Shape shape = comment.CommentShape; | |
shape.Fill.SolidFill.Color = Color.Red; | |
// Save the Excel file | |
book.Save(path + "result.xlsx"); |
قم بتنفيذ الكود أعلاه وستحصل على ملفملف إلاخراج.
كيفية إدراج صورة أو صورة في التعليق في Excel
يتيح Microsoft Excel للمستخدمين تخصيص مظهر جداول البيانات وأسلوبها إلى حد كبير. بل إنه من الممكن إضافة صور خلفية إلى التعليقات ، ويمكن أن تكون إضافة صورة خلفية خيارًا جماليًا ، أو يمكن استخدامها لتعزيز العلامة التجارية.
ينشئ نموذج التعليمات البرمجية أدناه ملف XLSX من البداية باستخدامAspose.Cells API ، ويضيف تعليقاً بخلفية صورة إلى الخلية A1.
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 | |
// The path to the documents directory. | |
string dataDir = ""; | |
// Create directory if it is not already present. | |
bool IsExists = System.IO.Directory.Exists(dataDir); | |
if (!IsExists) | |
System.IO.Directory.CreateDirectory(dataDir); | |
// Instantiate a Workbook | |
Workbook workbook = new Workbook(); | |
// Get a reference of comments collection with the first sheet | |
CommentCollection comments = workbook.Worksheets[0].Comments; | |
// Add a comment to cell A1 | |
int commentIndex = comments.Add(0, 0); | |
Comment comment = comments[commentIndex]; | |
comment.Note = "First note."; | |
comment.Font.Name = "Times New Roman"; | |
// Load an image into stream | |
Bitmap bmp = new Bitmap(dataDir + "image2.jpg"); | |
MemoryStream ms = new MemoryStream(); | |
bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Png); | |
// Set image data to the shape associated with the comment | |
comment.CommentShape.Fill.ImageData = ms.ToArray(); | |
dataDir = dataDir + "commentwithpicture1.out.xlsx"; | |
// Save the workbook | |
workbook.Save(dataDir, Aspose.Cells.SaveFormat.Xlsx); |