
ユーザビリティとは、人がプログラム、Web サイト、またはデバイスをどれだけうまく操作できるかを表す用語です。ユーザビリティを高める要因には、習得のしやすさや使用の効率などがあります。色を使用して、スプレッドシートのユーザビリティを高める方法はいくつかあります。たとえば、スプレッドシート内で値が 1000 を超えるすべてのセルを識別する必要がある場合は、Excel にそれらのセルを赤く色付けするように指示することで、その作業を簡単にすることができます。そうすれば、数秒でそれらのセルを識別できます。スプレッドシートの行の色によって、スプレッドシートにプロフェッショナルな外観を与え、読みやすくすることができます。さらに、スタイルは、ワークブック内のすべての見出しを同じにしたい場合に便利です。
色を使用すると、関連する情報のグループを一目で認識できるため、データをより効果的に視覚化できます。さらに、スタイルを使用して、ワークシートとワークブックに一貫した書式を設定することもできます。
ワークシート処理用のクラウド API
Aspose.Cells Cloud API は、ローカル システムやクラウドでホストされている MS Excel および OpenOffice スプレッドシートの作成と操作の機能を提供します。ワークシートを処理するために、MS Office や OpenOffice などのソフトウェアをインストールする必要はなく、すべての処理は Cloud API を使用して実行されます。新しいリリースごとに、製品の安定性を高めるとともに、API をより堅牢にする新機能の導入に努めています。そのため、最近のリリースである Aspose.Cells Cloud 20.7 では、ワークブックの作成、セル特性の設定、セル範囲の値の取得、セル スタイルの投稿に関連する機能が大幅に改善されました。
C# を使用してワークブックを作成する
API は、より少ないコード行で Excel ワークシートを作成する機能を提供します。 1 行のコードでも、既存の Excel ワークブックに新しいワークシートを追加できます。 以下のコード スニペットは、サンプル Excel ワークブックを作成し、2 番目のインデックスに Excel ワークシートを追加し、結果のファイルをクラウド ストレージに保存する手順を示しています。
string MyAppKey = "xxxxxxxx"; // Get AppKey from https://dashboard.aspose.cloud/
string MyAppSid = "xxxxxxxxx"; // Get AppSID from https://dashboard.aspose.cloud/
// 完全な例は https://github.com/aspose-cells-cloud/aspose-cells-cloud-dotnet でご覧いただけます。
// Cells Cloud APIのインスタンスを作成する
CellsApi instance = new CellsApi(MyAppSid, MyAppKey);
// 結果ファイルの名前を指定する
string name = "NewBook" + DateTime.Now.ToString("yymmddhhmiss") + ".xlsx";
// Excelファイルをクラウドストレージに保存する
instance.CellsWorkbookPutWorkbookCreate(name);
// 2番目の場所にワークシートを追加する
instance.CellsWorksheetsPutAddNewWorksheet(name, "Sheet2", 2);
セル範囲の値を取得する
API は、名前付き範囲に基づいてセル データを取得、追加、または更新する機能を提供します。最近のリリースでは、ワークシート セルから範囲の値を取得できるように API が改良されました。
string MyAppKey = "xxxxxxxx"; // Get AppKey from https://dashboard.aspose.cloud/
string MyAppSid = "xxxxxxxxx"; // Get AppSID from https://dashboard.aspose.cloud/
// 完全な例は https://github.com/aspose-cells-cloud/aspose-cells-cloud-dotnet でご覧いただけます。
// Cells Cloud APIのインスタンスを作成する
CellsApi instance = new CellsApi(MyAppSid, MyAppKey);
string name = "NewBook2056160256i53.xlsx";
string sheetName = "Sheet1";
int? firstRow = 0;
int? firstColumn = 0;
int? rowCount = 3;
int? columnCount = 2;
var response = instance.CellsRangesGetWorksheetCellsRangeValue(name, sheetName, null, firstRow, firstColumn, rowCount, columnCount);
NUnit.Framework.Assert.AreEqual(response.Code, 200);
var rangeName = "A1:B3";
response = instance.CellsRangesGetWorksheetCellsRangeValue(name, sheetName, rangeName, null, null, null, null);
NUnit.Framework.Assert.AreEqual(response.Code, 200);
rangeName = "MyRange";
response = instance.CellsRangesGetWorksheetCellsRangeValue(name, sheetName, rangeName, null, null, null, null);
NUnit.Framework.Assert.AreEqual(response.Code, 200);
セルにリッチテキスト書式を適用する
個々のセルにはデータが含まれており、各セルのデータを適切に区別するために、各セルに特定の書式設定スタイルを適用できます。API は、Excel ワークシート セルにリッチ テキスト書式を設定する機能もサポートしています。API は、特定のセルのフォント情報を指定する機能を提供する Font クラスを提供します。太字、斜体、取り消し線、下付き文字、上付き文字、下線、サイズ、フォント名などの書式を設定できます。
string MyAppKey = "xxxxxxxx"; // Get AppKey from https://dashboard.aspose.cloud/
string MyAppSid = "xxxxxxxxx"; // Get AppSID from https://dashboard.aspose.cloud/
// 完全な例は https://github.com/aspose-cells-cloud/aspose-cells-cloud-dotnet でご覧いただけます。
// Cells Cloud APIのインスタンスを作成する
Aspose.Cells.Cloud.SDK.Api.CellsApi cellsApi = new Aspose.Cells.Cloud.SDK.Api.CellsApi(MyAppSid, MyAppKey);
string fileName = "NewBook2056160256i53.xlsx";
String sheetName = "Sheet1";
String cellName = "A3";
Aspose.Cells.Cloud.SDK.Model.Style style = new Aspose.Cells.Cloud.SDK.Model.Style();
Aspose.Cells.Cloud.SDK.Model.Font font = new Aspose.Cells.Cloud.SDK.Model.Font();
font.IsBold = true;
font.Color = new Aspose.Cells.Cloud.SDK.Model.Color() { A = 10, R = 120, G = 200, B = 230 };
font.Size = 16;
Aspose.Cells.Cloud.SDK.Model.ThemeColor themeColor = new Aspose.Cells.Cloud.SDK.Model.ThemeColor();
themeColor.ColorType = "Text2";
themeColor.Tint = 2;
style.BackgroundThemeColor = themeColor;
style.Font = font;
try
{
// Aspose.Cells Cloud SDK APIを呼び出してセルのスタイルを変更する
Aspose.Cells.Cloud.SDK.Model.StyleResponse apiResponse = cellsApi.CellsPostUpdateWorksheetCellStyle(fileName, sheetName, cellName, style);
if (apiResponse != null && apiResponse.Status.Equals("OK"))
{
Console.WriteLine("Change Cell Style in Excel Worksheet, Done!");
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}

図 1: コード実行後に更新されたセルの書式設定。
関連記事
詳細については、次の記事も参照することをお勧めします。