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

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

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

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

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

from aspose.cells import Workbook
from aspose.pydrawing import Color
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET
# The path to the documents directory.
path = ""
# Initialize a new workbook.
book = Workbook(path + "exmaple.xlsx")
# Accessing the newly added comment
comment = book.worksheets[0].comments[0]
# change background color
shape = comment.comment_shape
shape.fill.solid_fill.color = Color.red
# Save the Excel file
book.save(path + "result.xlsx")

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

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

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

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

from aspose.cells import SaveFormat, Workbook
from os import os, path
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET
# The path to the documents directory.
dataDir = ""
# Create directory if it is not already present.
IsExists = path.isdir(dataDir)
if not IsExists:
os.makedirs(dataDir)
# Instantiate a Workbook
workbook = Workbook()
# Get a reference of comments collection with the first sheet
comments = workbook.worksheets[0].comments
# Add a comment to cell A1
commentIndex = comments.add(0, 0)
comment = comments[commentIndex]
comment.note = "First note."
comment.font.name = "Times New Roman"
# Load an image into stream
byte_array = bytearray()
with open(dataDir + "image2.jpg", 'rb') as file:
byte_array = bytearray(file.read())
# Set image data to the shape associated with the comment
comment.comment_shape.fill.image_data = byte_array
dataDir = dataDir + "commentwithpicture1.out.xlsx"
# Save the workbook
workbook.save(dataDir, SaveFormat.XLSX)