Class DataBar

Class DataBar

Namespace: Aspose.Cells
Assembly: Aspose.Cells.dll (25.2.0)

DataBar 条件付き書式ルールを説明します。
この条件付き書式ルールは、セルの範囲にグラデーションデータバーを表示します。

public class DataBar

継承

objectDataBar

継承されたメンバー

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()


//Workbookオブジェクトのインスタンス化
Workbook workbook = new Workbook();

Worksheet sheet = workbook.Worksheets[0];

//空の条件付き書式を追加
int index = sheet.ConditionalFormattings.Add();

FormatConditionCollection fcs = sheet.ConditionalFormattings[index];

//条件付き書式の範囲を設定
CellArea ca = new CellArea();

ca.StartRow = 0;

ca.EndRow = 2;

ca.StartColumn = 0;

ca.EndColumn = 0;

fcs.AddArea(ca);

//条件を追加
int idx = fcs.AddCondition(FormatConditionType.DataBar);

fcs.AddArea(ca);

FormatCondition cond = fcs[idx];

//データバーを取得
DataBar dataBar = cond.DataBar;

dataBar.Color = Color.Orange;

//データバーのプロパティを設定
dataBar.MinCfvo.Type = FormatConditionValueType.Percentile;

dataBar.MinCfvo.Value = 30;

dataBar.ShowValue = false;

dataBar.BarBorder.Type = DataBarBorderType.Solid;

dataBar.BarBorder.Color = Color.Plum;

dataBar.BarFillType = DataBarFillType.Solid;

dataBar.AxisColor = Color.Red;

dataBar.AxisPosition = DataBarAxisPosition.Midpoint;

dataBar.NegativeBarFormat.ColorType = DataBarNegativeColorType.Color;

dataBar.NegativeBarFormat.Color = Color.White;

dataBar.NegativeBarFormat.BorderColorType = DataBarNegativeColorType.Color;

dataBar.NegativeBarFormat.BorderColor = Color.Yellow;

//セルの値を設定
Aspose.Cells.Cell cell1 = sheet.Cells["A1"];

cell1.PutValue(10);

Aspose.Cells.Cell cell2 = sheet.Cells["A2"];

cell2.PutValue(120);

Aspose.Cells.Cell cell3 = sheet.Cells["A3"];

cell3.PutValue(260);

//Excelファイルを保存
workbook.Save("book1.xlsx");

'Workbookオブジェクトのインスタンス化
Dim workbook As Workbook = New Workbook()

Dim sheet As Worksheet = workbook.Worksheets(0)

'空の条件付き書式を追加
Dim index As Integer = sheet.ConditionalFormattings.Add()

Dim fcs As FormatConditionCollection = sheet.ConditionalFormattings(index)

'条件付き書式の範囲を設定
Dim ca As New CellArea()

ca.StartRow = 0

ca.EndRow = 2

ca.StartColumn = 0

ca.EndColumn = 0

fcs.AddArea(ca)

'条件を追加
Dim idx As Integer = fcs.AddCondition(FormatConditionType.DataBar)

fcs.AddArea(ca)

Dim cond As FormatCondition = fcs(idx)

'データバーを取得
Dim dataBar As DataBar = cond.DataBar

dataBar.Color = Color.Orange

'データバーのプロパティを設定
dataBar.MinCfvo.Type = FormatConditionValueType.Percentile

dataBar.MinCfvo.Value = 30

dataBar.ShowValue = False

dataBar.BarBorder.Type = DataBarBorderType.Solid

dataBar.BarBorder.Color = Color.Plum

dataBar.BarFillType = DataBarFillType.Solid

dataBar.AxisColor = Color.Red

dataBar.AxisPosition = DataBarAxisPosition.Midpoint

dataBar.NegativeBarFormat.ColorType = DataBarNegativeColorType.Color

dataBar.NegativeBarFormat.Color = Color.White

dataBar.NegativeBarFormat.BorderColorType = DataBarNegativeColorType.Color

dataBar.NegativeBarFormat.BorderColor = Color.Yellow

'セルの値を設定
Dim cell1 As Aspose.Cells.Cell = sheet.Cells("A1")

cell1.PutValue(10)

Dim cell2 As Aspose.Cells.Cell = sheet.Cells("A2")

cell2.PutValue(120)

Dim cell3 As Aspose.Cells.Cell = sheet.Cells("A3")

cell3.PutValue(260)

'Excelファイルを保存
workbook.Save("book1.xlsx")

プロパティ

AxisColor

条件付き書式がデータバーとして設定されているセルの軸の色を取得します。

public Color AxisColor { get; set; }

プロパティ値

Color

AxisPosition

条件付き書式ルールによって指定されたデータバーの軸の位置を取得または設定します。

public DataBarAxisPosition AxisPosition { get; set; }

プロパティ値

DataBarAxisPosition

BarBorder

データバーの境界を指定するオブジェクトを取得します。

public DataBarBorder BarBorder { get; }

プロパティ値

DataBarBorder

BarFillType

データバーが色でどのように塗りつぶされるかを取得または設定します。

public DataBarFillType BarFillType { get; set; }

プロパティ値

DataBarFillType

Color

このDataBarの色を取得または設定します。

public Color Color { get; set; }

プロパティ値

Color

Direction

データバーが表示される方向を取得または設定します。

public TextDirectionType Direction { get; set; }

プロパティ値

TextDirectionType

MaxCfvo

このDataBarの最大値オブジェクトを取得または設定します。
nullまたはFormatConditionValueType.MinタイプのCFValueObjectを設定することはできません。

public ConditionalFormattingValue MaxCfvo { get; }

プロパティ値

ConditionalFormattingValue

MaxLength

データバーの最大長を表します。

public int MaxLength { get; set; }

プロパティ値

int

MinCfvo

このDataBarの最小値オブジェクトを取得または設定します。
nullまたはFormatConditionValueType.MaxタイプのCFValueObjectを設定することはできません。

public ConditionalFormattingValue MinCfvo { get; }

プロパティ値

ConditionalFormattingValue

MinLength

データバーの最小長を表します。

public int MinLength { get; set; }

プロパティ値

int

NegativeBarFormat

データバー条件付き書式ルールに関連付けられたNegativeBarFormatオブジェクトを取得します。

public NegativeBarFormat NegativeBarFormat { get; }

プロパティ値

NegativeBarFormat

ShowValue

このデータバーが適用されているセルの値を表示するかどうかを示すフラグを取得または設定します。
デフォルト値はtrueです。

public bool ShowValue { get; set; }

プロパティ値

bool

メソッド

ToImage(Cell, ImageOrPrintOptions)

セルのデータバーを画像のバイト配列にレンダリングします。

public byte[] ToImage(Cell cell, ImageOrPrintOptions imgOpts)

パラメータ

cell Cell

レンダリングするデータバーが含まれるセルを示します。

imgOpts ImageOrPrintOptions

ImageOrPrintOptionsは出力画像のいくつかのプロパティを含みます。

戻り値

byte[]

 日本語