Class DataBar
Namespace: Aspose.Cells
Assembly: Aspose.Cells.dll (25.2.0)
תאר את חוק העיצוב התנאי DataBar.
חוק העיצוב התנאי הזה מציג פס נתונים מדורג בטווח התאים.
public class DataBar
ירושה
חברים ירושים
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; }
ערך המאפיין
AxisPosition
מקבל או מגדיר את מיקום הציר של פסי הנתונים המוגדרים על ידי חוק עיצוב תנאי.
public DataBarAxisPosition AxisPosition { get; set; }
ערך המאפיין
BarBorder
מקבל אובייקט המפרט את הגבול של פס נתונים.
public DataBarBorder BarBorder { get; }
ערך המאפיין
BarFillType
מקבל או מגדיר כיצד פס נתונים מתמלא בצבע.
public DataBarFillType BarFillType { get; set; }
ערך המאפיין
Color
מקבל או מגדיר את הצבע של פס הנתונים הזה.
public Color Color { get; set; }
ערך המאפיין
Direction
מקבל או מגדיר את הכיוון שבו מוצג פס הנתונים.
public TextDirectionType Direction { get; set; }
ערך המאפיין
MaxCfvo
מקבל או מגדיר את אובייקט הערך המקסימלי של פס הנתונים הזה.
לא ניתן להגדיר null או אובייקט CFValue עם סוג FormatConditionValueType.Min עליו.
public ConditionalFormattingValue MaxCfvo { get; }
ערך המאפיין
MaxLength
מייצג את האורך המקסימלי של פס הנתונים.
public int MaxLength { get; set; }
ערך המאפיין
MinCfvo
מקבל או מגדיר את אובייקט הערך המינימלי של פס הנתונים הזה.
לא ניתן להגדיר null או אובייקט CFValue עם סוג FormatConditionValueType.Max עליו.
public ConditionalFormattingValue MinCfvo { get; }
ערך המאפיין
MinLength
מייצג את האורך המינימלי של פס הנתונים.
public int MinLength { get; set; }
ערך המאפיין
NegativeBarFormat
מקבל את אובייקט NegativeBarFormat הקשור לחוק עיצוב תנאי של פס נתונים.
public NegativeBarFormat NegativeBarFormat { get; }
ערך המאפיין
ShowValue
מקבל או מגדיר את הדגל המצביע אם להציג את הערכים של התאים שעליהם חל פס הנתונים הזה.
ערך ברירת המחדל הוא true.
public bool ShowValue { get; set; }
ערך המאפיין
שיטות
ToImage(Cell, ImageOrPrintOptions)
ממיר פס נתונים בתא לתמונת מערך בייטים.
public byte[] ToImage(Cell cell, ImageOrPrintOptions imgOpts)
פרמטרים
cell
Cell
מציין את פס הנתונים באיזה תא יש להמיר
imgOpts
ImageOrPrintOptions
ImageOrPrintOptions מכיל מספר מאפיינים של התמונה המוצגת
מחזיר
byte[]