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);
//ذخیرهسازی فایل اکسل
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)
'ذخیرهسازی فایل اکسل
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 یا CFValueObject با نوع FormatConditionValueType.Min را به آن تنظیم کرد.
public ConditionalFormattingValue MaxCfvo { get; }
مقدار خاصیت
MaxLength
حداکثر طول نوار داده را نشان میدهد.
public int MaxLength { get; set; }
مقدار خاصیت
MinCfvo
شیء مقدار حداقل این نوار داده را دریافت یا تنظیم میکند.
نمیتوان مقدار null یا CFValueObject با نوع 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[]