Excel de yorumun arka planını nasıl değiştirilir

Excel’de yorumda renk nasıl değiştirilir

Varsayılan arka plan rengini yorumlar için kullanmak istemediğinizde, ilginizi çeken bir renk ile değiştirmek isteyebilirsiniz. Excel’de Yorum Kutusunun Arka Plan Rengini nasıl değiştiririm?

Yukarıdaki kod, istediğiniz kendi seçtiğiniz rengin yorumlara eklenmesi için Aspose.Cells for Python via .NET kullanımını gösterecektir.

Burada sizin için bir örnek dosya hazırladık. Bu dosya, aşağıdaki kodda Workbook nesnesini başlatmak için kullanılır.

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

Yukarıdaki kodu çalıştırın ve bir çıktı dosyası elde edeceksiniz.

Excel’de yorumlara resim veya görüntü eklemek

Microsoft Excel, kullanıcılara elektronik tabloların görünümünü büyük ölçüde özelleştirme imkanı sunar. Ayrıca yorumlara arka plan resimleri eklemek bile mümkündür. Bir arka plan resmi eklemek estetik bir tercih olabilir veya markalama güçlendirmek için kullanılabilir.

Aşağıdaki örnek kod, sıfırdan bir XLSX dosyası oluşturur ve hücre A1’e resim arka planlı bir yorum ekler, Aspose.Cells for Python via .NET API.

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)