كيفية تغيير الخلفية في التعليق في إكسل

كيفية تغيير اللون في التعليق في إكسل

عندما لا تحتاج إلى لون الخلفية الافتراضي للتعليقات ، قد ترغب في استبداله باللون الذي تهتم به. كيف يمكنني تغيير لون خلفية مربع التعليقات في إكسل؟

سيقوم الكود التالي بإرشادك كيفية استخدام Aspose.Cells لإضافة لون خلفية مفضلة إلى التعليقات باختيارك الخاص.

هنا لقد قمنا بإعداد ملف عينة (exmaple.xlsx) لك. يتم استخدام هذا الملف لتهيئة كائن مصنف العمل في الكود أدناه.

// 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");

قم بتشغيل الكود أعلاه وستحصل على ملف output file.

كيفية إدراج صورة أو صورة في التعليق في إكسل

تتيح لمستخدمي Microsoft Excel تخصيص مظهر الجداول بشكل كبير. يُمكن حتى إضافة صور خلفية إلى التعليقات. يمكن أن تكون إضافة صورة خلفية خيارًا جماليًا ، أو تُستخدم لتعزيز العلامة التجارية.

الكود العينة أدناه ينشئ ملف XLSX من البداية باستخدام واجهة برمجة التطبيقات Aspose.Cells ، ويضيف تعليقًا بخلفية صورة للخلية A1.

// 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);