Renk Paletini Nasıl Kullanılır
Renkler ve Palet
Bir palet, bir görüntü oluşturmak için kullanılabilen renk sayısıdır. Bir sunumda standart bir palet kullanımı, kullanıcının tutarlı bir görünüm oluşturmasına olanak tanır. Her Microsoft Excel (97-2003) dosyasının bir hücrelere, fontlara, ızgaralara, grafik nesnelerine, doldurmalara ve çizgilere uygulanabilen 56 renklik bir paleti vardır.
Aspose.Cells for Python via .NET ile mevcut paletin renkleri kullanılabildiği gibi, özel renkler de kullanılabilir. Bir özel renk kullanmadan önce onu palete ekleyin.
Bu konu, paletine özel renkler eklemenin nasıl yapıldığını tartışmaktadır.
Paletine Özel Renkler Ekleyin
Aspose.Cells for Python via .NET, Microsoft Excel’in 56 renk paletini destekler. Paletede tanımlı olmayan bir özel renk kullanmak için, renk paletine ekleyin.
Aspose.Cells for Python via .NET, bir Microsoft Excel dosyasını temsil eden {0} adında bir sınıf sağlar. {1} sınıfı, bir Excel dosyasındaki her çalışma sayfasına erişim sağlayan {2} koleksiyonunu içerir. Bir çalışma sayfası, {3} sınıfı ile temsil edilir. {4} sınıfı ise bir {5} koleksiyonu sağlar. {6} koleksiyondaki her öğe, bir {7} sınıfı nesnesini temsil eder.
- Özel Renk, paletine eklenecek özel renk.
- İndeks, özel rengin paletindeki rengin yerini belirtir. 0-55 arasında olmalıdır.
Aşağıdaki örnek, (Orkide) özel bir rengi paletine ekleyip bunu bir font üzerine uygulamadan önce paletine ekler.
from aspose.cells import SaveFormat, Workbook | |
from aspose.pydrawing import Color | |
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 = RunExamples.GetDataDir(".") | |
# Create directory if it is not already present. | |
IsExists = path.isdir(dataDir) | |
if notIsExists: | |
os.makedirs(dataDir) | |
# Instantiating an Workbook object | |
workbook = Workbook() | |
# Adding Orchid color to the palette at 55th index | |
workbook.change_palette(Color.orchid, 55) | |
# Adding a new worksheet to the Excel object | |
i = workbook.worksheets.add() | |
# Obtaining the reference of the newly added worksheet by passing its sheet index | |
worksheet = workbook.worksheets[i] | |
# Accessing the "A1" cell from the worksheet | |
cell = worksheet.cells.get("A1") | |
# Adding some value to the "A1" cell | |
cell.put_value("Hello Aspose!") | |
# Defining new Style object | |
styleObject = workbook.create_style() | |
# Setting the Orchid (custom) color to the font | |
styleObject.font.color = Color.orchid | |
# Applying the style to the cell | |
cell.set_style(styleObject) | |
# Saving the Excel file | |
workbook.save(dataDir + "book1.out.xls", SaveFormat.AUTO) |