Class DataBar

Class DataBar

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

Opis zasady formatowania warunkowego DataBar.
Ta zasada formatowania warunkowego wyświetla gradientowy pasek danych w zakresie komórek.

public class DataBar

Dziedziczenie

objectDataBar

Dziedziczone członkowie

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

Przykłady


//Instancjowanie obiektu Workbook
Workbook workbook = new Workbook();

Worksheet sheet = workbook.Worksheets[0];

//Dodaje puste formatowanie warunkowe
int index = sheet.ConditionalFormattings.Add();

FormatConditionCollection fcs = sheet.ConditionalFormattings[index];

//Ustawia zakres formatowania warunkowego.
CellArea ca = new CellArea();

ca.StartRow = 0;

ca.EndRow = 2;

ca.StartColumn = 0;

ca.EndColumn = 0;

fcs.AddArea(ca);

//Dodaje warunek.
int idx = fcs.AddCondition(FormatConditionType.DataBar);

fcs.AddArea(ca);

FormatCondition cond = fcs[idx];

//Pobierz Databar
DataBar dataBar = cond.DataBar;

dataBar.Color = Color.Orange;

//Ustaw właściwości 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;

//Wprowadź wartości komórek
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);

//Zapisz plik Excel
workbook.Save("book1.xlsx");

'Instancjowanie obiektu Workbook
Dim workbook As Workbook = New Workbook()

Dim sheet As Worksheet = workbook.Worksheets(0)

'Dodaje puste formatowanie warunkowe
Dim index As Integer = sheet.ConditionalFormattings.Add()

Dim fcs As FormatConditionCollection = sheet.ConditionalFormattings(index)

'Ustawia zakres formatowania warunkowego.
Dim ca As New CellArea()

ca.StartRow = 0

ca.EndRow = 2

ca.StartColumn = 0

ca.EndColumn = 0

fcs.AddArea(ca)

'Dodaje warunek.
Dim idx As Integer = fcs.AddCondition(FormatConditionType.DataBar)

fcs.AddArea(ca)

Dim cond As FormatCondition = fcs(idx)

'Pobierz Databar
Dim dataBar As DataBar = cond.DataBar

dataBar.Color = Color.Orange

'Ustaw właściwości 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

'Wprowadź wartości komórek
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)

'Zapisz plik Excel
workbook.Save("book1.xlsx")

Właściwości

AxisColor

Pobiera kolor osi dla komórek z formatowaniem warunkowym jako paski danych.

public Color AxisColor { get; set; }

Wartość właściwości

Color

AxisPosition

Pobiera lub ustawia pozycję osi pasków danych określoną przez zasadę formatowania warunkowego.

public DataBarAxisPosition AxisPosition { get; set; }

Wartość właściwości

DataBarAxisPosition

BarBorder

Pobiera obiekt, który określa granicę paska danych.

public DataBarBorder BarBorder { get; }

Wartość właściwości

DataBarBorder

BarFillType

Pobiera lub ustawia sposób wypełnienia paska danych kolorem.

public DataBarFillType BarFillType { get; set; }

Wartość właściwości

DataBarFillType

Color

Pobierz lub ustaw kolor tego DataBar.

public Color Color { get; set; }

Wartość właściwości

Color

Direction

Pobiera lub ustawia kierunek, w którym wyświetlany jest databar.

public TextDirectionType Direction { get; set; }

Wartość właściwości

TextDirectionType

MaxCfvo

Pobierz lub ustaw maksymalny obiekt wartości tego DataBar.
Nie można ustawić na null lub CFValueObject z typem FormatConditionValueType.Min.

public ConditionalFormattingValue MaxCfvo { get; }

Wartość właściwości

ConditionalFormattingValue

MaxLength

Reprezentuje maksymalną długość paska danych.

public int MaxLength { get; set; }

Wartość właściwości

int

MinCfvo

Pobierz lub ustaw minimalny obiekt wartości tego DataBar.
Nie można ustawić na null lub CFValueObject z typem FormatConditionValueType.Max.

public ConditionalFormattingValue MinCfvo { get; }

Wartość właściwości

ConditionalFormattingValue

MinLength

Reprezentuje minimalną długość paska danych.

public int MinLength { get; set; }

Wartość właściwości

int

NegativeBarFormat

Pobiera obiekt NegativeBarFormat powiązany z zasadą formatowania warunkowego paska danych.

public NegativeBarFormat NegativeBarFormat { get; }

Wartość właściwości

NegativeBarFormat

ShowValue

Pobierz lub ustaw flagę wskazującą, czy pokazywać wartości komórek, na których zastosowano ten pasek danych.
Domyślna wartość to true.

public bool ShowValue { get; set; }

Wartość właściwości

bool

Metody

ToImage(Cell, ImageOrPrintOptions)

Renderuje pasek danych w komórce jako tablicę bajtów obrazu.

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

Parametry

cell Cell

Wskazuje, w której komórce ma być renderowany pasek danych

imgOpts ImageOrPrintOptions

ImageOrPrintOptions zawiera niektóre właściwości obrazu wyjściowego

Zwraca

byte[]

 Polski