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 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.

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

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 API.

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