Excelのテーマと色
Excelでのカラースキームの適用と作成方法
ドキュメントテーマを使用すると、Excelドキュメントの色、フォント、グラフィックの書式効果を簡単に調整し、迅速に更新できます。 テーマは名前付きスタイル、グラフィカル効果、ブックの他のオブジェクトを使用して統一された外観を提供します。たとえば、OfficeテーマとApexテーマでは、Accent1スタイルは異なる外観になります。よくあるのは、ドキュメントテーマを適用してから、必要に応じて修正することです。
Excelでのカラースキームの適用方法
- Excelを開き、「ページレイアウト」タブに移動します。
- 「テーマ」セクションの「カラー」ボタンをクリックします。
- 要件に合ったカラーパレットを選択するか、スキームにマウスを重ねてライブプレビューを表示します。
Excelでのカスタムカラースキームの作成方法
ドキュメントに新鮮で独自の外観を与えるために独自のカラーセットを作成するか、組織のブランド規準に準拠します。
-
Excelを開き、「ページレイアウト」タブに移動します。
-
「テーマ」セクションの「カラー」ボタンをクリックします。
-
「カスタムカラーのカスタマイズ…」ボタンをクリックします。
-
「新しいテーマの色の作成」ダイアログボックスで、各要素の色を選択できます。
-
必要な色をすべて選択した後、「名前」フィールドにカスタムカラースキームの名前を入力します。
-
「保存」ボタンをクリックしてカスタムカラースキームを保存します。カスタムカラースキームは今後の使用のために「カラー」ドロップダウンメニューで利用可能になります。
Aspose.Cells for Python via .NETでカラー スキームを作成および適用する方法
Aspose.Cells for Python via .NETは、テーマや色のカスタマイズ機能を提供します。
Aspose.Cells for Python via .NETでカスタムカラーテーマを作成する方法
ファイルでテーマカラーが使用されている場合、各セルを個々に変更する必要はありません。テーマの色を修正するだけで済みます。
使用例では、希望の色でカスタムテーマを適用する方法が示されています。Microsoft Excel 2007 で手動で作成されたサンプルテンプレートファイルを使用します。
使用例では、テンプレートXLSXファイルを読み込み、さまざまなテーマカラータイプの色を定義し、カスタムカラーを適用してExcelファイルを保存します。
from aspose.cells import Workbook,License,PdfSaveOptions, LoadOptions, LoadFormat, LoadFilter, LoadDataFilterOptions, PasteOptions,PasteType | |
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. | |
dataDir = RunExamples.GetDataDir(".") | |
# Instantiate Workbook object. | |
# Open an exiting excel file. | |
workbook = Workbook(dataDir + "book1.xlsx") | |
# Define Color array (of 12 colors) for Theme. | |
colors = [] | |
colors.append(Color.from_argb(255, 250, 235, 215)) # Background1 | |
colors.append(Color.from_argb(255, 165, 42, 42)) # Text1 | |
colors.append(Color.from_argb(255, 240, 248, 255)) # Background2 | |
colors.append(Color.from_argb(255, 255, 255, 0)) # Text2 | |
colors.append(Color.from_argb(255, 154, 205, 50)) # Accent1 | |
colors.append(Color.from_argb(255, 255, 0, 0)) # Accent2 | |
colors.append(Color.from_argb(255, 255, 192, 203)) # Accent3 | |
colors.append(Color.from_argb(255, 128, 0, 128)) # Accent4 | |
colors.append(Color.from_argb(255, 152, 251, 152)) # Accent5 | |
colors.append(Color.from_argb(255, 255, 165, 0)) # Accent6 | |
colors.append(Color.from_argb(255, 0, 128, 0)) # Hyperlink | |
colors.append(Color.from_argb(255, 128, 128, 128)) # Followed Hyperlink | |
# Set the custom theme with specified colors. | |
workbook.custom_theme("CustomeTheme1", colors) | |
# Save as the excel file. | |
workbook.save(dataDir + "output.out.xlsx") |
Aspose.Cells for Python via .NETでテーマカラーを適用する方法
使用例では、セルの前景色とフォント色を、ブックのデフォルトテーマの色タイプに基づいて適用します。また、Excelファイルをディスクに保存します。
from aspose.cells import BackgroundType, ThemeColor, ThemeColorType, 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 = RunExamples.GetDataDir(".") | |
# Create directory if it is not already present. | |
IsExists = path.isdir(dataDir) | |
if notIsExists: | |
os.makedirs(dataDir) | |
# Instantiate a Workbook. | |
workbook = Workbook() | |
# Get cells collection in the first (default) worksheet. | |
cells = workbook.worksheets[0].cells | |
# Get the D3 cell. | |
c = cells.get("D3") | |
# Get the style of the cell. | |
s = c.get_style() | |
# Set foreground color for the cell from the default theme Accent2 color. | |
s.foreground_theme_color = ThemeColor(ThemeColorType.ACCENT2, 0.5) | |
# Set the pattern type. | |
s.pattern = BackgroundType.SOLID | |
# Get the font for the style. | |
f = s.font | |
# Set the theme color. | |
f.theme_color = ThemeColor(ThemeColorType.ACCENT4, 0.1) | |
# Apply style. | |
c.set_style(s) | |
# Put a value. | |
c.put_value("Testing1") | |
# Save the excel file. | |
workbook.save(dataDir + "output.out.xlsx") |
Aspose.Cells for Python via .NETでテーマカラーの取得と設定方法
テーマカラーを実装するいくつかのメソッドとプロパティが以下に示されています。
- Style.foreground_theme_color:前景色を設定するために使用されます。
- Style.background_theme_color:背景色を設定するために使用されます。
- Font.theme_color:フォントの色を設定するために使用されます。
- Workbook.get_theme_color:テーマカラーを取得するために使用されます。
- Workbook.set_theme_color:テーマカラーを設定するために使用されます。
使用例では、テーマカラーを取得および設定する方法が示されています。
使用例では、テンプレートXLSXファイルを使用して、さまざまなテーマカラータイプの色を取得し、色を変更し、Microsoft Excelファイルを保存します。
from aspose.cells import ThemeColorType, 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. | |
dataDir = RunExamples.GetDataDir(".") | |
# Instantiate Workbook object. | |
# Open an exiting excel file. | |
workbook = Workbook(dataDir + "book1.xlsx") | |
# Get the Background1 theme color. | |
c = workbook.get_theme_color(ThemeColorType.BACKGROUND1) | |
# Print the color. | |
print("theme color Background1: " + str(c)) | |
# Get the Accent2 theme color. | |
c = workbook.get_theme_color(ThemeColorType.ACCENT2) | |
# Print the color. | |
print("theme color Accent2: " + str(c)) | |
# Change the Background1 theme color. | |
workbook.set_theme_color(ThemeColorType.BACKGROUND1, Color.red) | |
# Get the updated Background1 theme color. | |
c = workbook.get_theme_color(ThemeColorType.BACKGROUND1) | |
# Print the updated color for confirmation. | |
print("theme color Background1 changed to: " + str(c)) | |
# Change the Accent2 theme color. | |
workbook.set_theme_color(ThemeColorType.ACCENT2, Color.blue) | |
# Get the updated Accent2 theme color. | |
c = workbook.get_theme_color(ThemeColorType.ACCENT2) | |
# Print the updated color for confirmation. | |
print("theme color Accent2 changed to: " + str(c)) | |
# Save the updated file. | |
workbook.save(dataDir + "output.out.xlsx") |