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 dataBar = cond.DataBar;

dataBar.Color = Color.Orange;

//Встановити властивості Databar
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)

'Отримати Databar
Dim dataBar As DataBar = cond.DataBar

dataBar.Color = Color.Orange

'Встановити властивості Databar
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 або CFValueObject з типом FormatConditionValueType.Min.

public ConditionalFormattingValue MaxCfvo { get; }

Значення властивості

ConditionalFormattingValue

MaxLength

Представляє максимальну довжину даних-бару.

public int MaxLength { get; set; }

Значення властивості

int

MinCfvo

Отримує або встановлює об’єкт мінімального значення цього DataBar.
Не можна встановити null або CFValueObject з типом FormatConditionValueType.Max.

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[]

 Українська