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; }

ค่า Property

Color

AxisPosition

รับหรือกำหนดตำแหน่งของแกนของแถบข้อมูลที่ระบุโดยกฎการจัดรูปแบบตามเงื่อนไข

public DataBarAxisPosition AxisPosition { get; set; }

ค่า Property

DataBarAxisPosition

BarBorder

รับอ็อบเจ็กต์ที่ระบุขอบของแถบข้อมูล

public DataBarBorder BarBorder { get; }

ค่า Property

DataBarBorder

BarFillType

รับหรือกำหนดวิธีที่แถบข้อมูลจะถูกเติมด้วยสี

public DataBarFillType BarFillType { get; set; }

ค่า Property

DataBarFillType

Color

รับหรือกำหนดสีของ DataBar นี้

public Color Color { get; set; }

ค่า Property

Color

Direction

รับหรือกำหนดทิศทางที่แถบข้อมูลจะแสดง

public TextDirectionType Direction { get; set; }

ค่า Property

TextDirectionType

MaxCfvo

รับหรือกำหนดอ็อบเจ็กต์ค่ามากสุดของ DataBar นี้
ไม่สามารถตั้งค่าเป็น null หรือ CFValueObject ที่มีประเภท FormatConditionValueType.Min ได้

public ConditionalFormattingValue MaxCfvo { get; }

ค่า Property

ConditionalFormattingValue

MaxLength

แสดงความยาวสูงสุดของแถบข้อมูล

public int MaxLength { get; set; }

ค่า Property

int

MinCfvo

รับหรือกำหนดอ็อบเจ็กต์ค่าต่ำสุดของ DataBar นี้
ไม่สามารถตั้งค่าเป็น null หรือ CFValueObject ที่มีประเภท FormatConditionValueType.Max ได้

public ConditionalFormattingValue MinCfvo { get; }

ค่า Property

ConditionalFormattingValue

MinLength

แสดงความยาวต่ำสุดของแถบข้อมูล

public int MinLength { get; set; }

ค่า Property

int

NegativeBarFormat

รับอ็อบเจ็กต์ NegativeBarFormat ที่เกี่ยวข้องกับกฎการจัดรูปแบบตามเงื่อนไขของแถบข้อมูล

public NegativeBarFormat NegativeBarFormat { get; }

ค่า Property

NegativeBarFormat

ShowValue

รับหรือกำหนดธงที่ระบุว่าจะให้แสดงค่าของเซลล์ที่มีการใช้แถบข้อมูลนี้หรือไม่
ค่าเริ่มต้นคือ true

public bool ShowValue { get; set; }

ค่า Property

bool

เมธอด

ToImage(Cell, ImageOrPrintOptions)

เรนเดอร์แถบข้อมูลในเซลล์เป็นอาร์เรย์ไบต์ของภาพ

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

พารามิเตอร์

cell Cell

ระบุแถบข้อมูลในเซลล์ที่จะเรนเดอร์

imgOpts ImageOrPrintOptions

ImageOrPrintOptions ประกอบด้วยคุณสมบัติบางอย่างของภาพผลลัพธ์

คืนค่า

byte[]

 แบบไทย