Interface IDataBar
Represents a data bar conditional formatting rule. Applying a data bar to a range helps you see the value of a cell relative to other cells.
Namespace: Syncfusion.XlsIO
Assembly: Syncfusion.XlsIO.NET.dll
Syntax
public interface IDataBar
Properties
BarAxisColor
Gets or sets the axis color of the data bar.
Declaration
Color BarAxisColor { get; set; }
Property Value
Type |
---|
Color |
Examples
BarAxisColor is not applied by default, it's applied after we set a color. Here in our example, we set Red to BarAxisColor.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create a worksheet.
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Load data to Apply Conditional Formatting.
worksheet["A1"].Text = "DataBar";
worksheet["A2"].Number = 10;
worksheet["A3"].Number = 20;
worksheet["A4"].Number = 30;
worksheet["A5"].Number = 40;
worksheet["A6"].Number = 50;
worksheet["A7"].Number = 60;
worksheet["A8"].Number = 70;
worksheet["A9"].Number = 80;
worksheet["A10"].Number = 90;
worksheet["A11"].Number = 100;
//Create instance of IConditonalFormat and IConditionalFormats.
IConditionalFormats formats = worksheet["A2:A11"].ConditionalFormats;
IConditionalFormat format = formats.AddCondition();
//Set FormatType as DataBar.
format.FormatType = ExcelCFType.DataBar;
IDataBar dataBar = format.DataBar;
//Set BarAxis color for DataBar.
dataBar.BarAxisColor = System.Drawing.Color.Red;
//Save and Dispose.
workbook.SaveAs("ConditionalFormats.xlsx");
workbook.Close();
}
BarColor
Gets or sets the color of the bars in a data bar conditional format.
Declaration
Color BarColor { get; set; }
Property Value
Type |
---|
Color |
Remarks
To customize the border color of the DataBar we can use BorderColor property.
Examples
The default color of the DataBar is (99, 142, 198) in RGB representation. This can be customized usig BarColor property. Here in our example we change the BarColor to Red.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create a worksheet.
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Load data to Apply Conditional Formatting.
worksheet["A1"].Text = "DataBar";
worksheet["A2"].Number = 10;
worksheet["A3"].Number = 20;
worksheet["A4"].Number = 30;
worksheet["A5"].Number = 40;
worksheet["A6"].Number = 50;
worksheet["A7"].Number = 60;
worksheet["A8"].Number = 70;
worksheet["A9"].Number = 80;
worksheet["A10"].Number = 90;
worksheet["A11"].Number = 100;
//Create instance of IConditonalFormat and IConditionalFormats.
IConditionalFormats formats = worksheet["A2:A11"].ConditionalFormats;
IConditionalFormat format = formats.AddCondition();
//Set FormatType as DataBar.
format.FormatType = ExcelCFType.DataBar;
IDataBar dataBar = format.DataBar;
//Set Bar color for DataBar
dataBar.BarColor = System.Drawing.Color.Red;
//Save and Dispose.
workbook.SaveAs("ConditionalFormats.xlsx");
workbook.Close();
}
BorderColor
Gets or sets the border color of the data bar.
Declaration
Color BorderColor { get; set; }
Property Value
Type |
---|
Color |
Remarks
We can change the color applied to the DataBar also, to change that use BarColor property.
Examples
There will be no borders applied to ColorBars initially. If we want we can apply borders to the DataBars present in the cells by using BorderColor property. Here in our example, we set BorderColor to Yellow.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create a worksheet.
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Load data to Apply Conditional Formatting.
worksheet["A1"].Text = "DataBar";
worksheet["A2"].Number = 10;
worksheet["A3"].Number = 20;
worksheet["A4"].Number = 30;
worksheet["A5"].Number = 40;
worksheet["A6"].Number = 50;
worksheet["A7"].Number = 60;
worksheet["A8"].Number = 70;
worksheet["A9"].Number = 80;
worksheet["A10"].Number = 90;
worksheet["A11"].Number = 100;
//Create instance of IConditonalFormat and IConditionalFormats.
IConditionalFormats formats = worksheet["A2:A11"].ConditionalFormats;
IConditionalFormat format = formats.AddCondition();
//Set FormatType as DataBar.
format.FormatType = ExcelCFType.DataBar;
IDataBar dataBar = format.DataBar;
//Set Border color for DataBar
dataBar.BorderColor = System.Drawing.Color.Yellow;
//Save and Dispose.
workbook.SaveAs("ConditionalFormats.xlsx");
workbook.Close();
}
DataBarAxisPosition
Gets or sets the axis position for the data bar.
Declaration
DataBarAxisPosition DataBarAxisPosition { get; set; }
Property Value
Type |
---|
DataBarAxisPosition |
Examples
The position of the DataBar Axis is based on the values present in the cells, It's automatic by default. If the cells contain positve and negative values then the Axis position will be cell's middle position. If the cells contain either positive or negative values then the DataBar's axis will be based on the values. Though we have only positive elements loaded, Here we set DataBar axis to middle.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create a worksheet.
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Load data to Apply Conditional Formatting.
worksheet["A1"].Text = "DataBar";
worksheet["A2"].Number = 10;
worksheet["A3"].Number = 20;
worksheet["A4"].Number = 30;
worksheet["A5"].Number = 40;
worksheet["A6"].Number = 50;
worksheet["A7"].Number = 60;
worksheet["A8"].Number = 70;
worksheet["A9"].Number = 80;
worksheet["A10"].Number = 90;
worksheet["A11"].Number = 100;
//Create instance of IConditonalFormat and IConditionalFormats.
IConditionalFormats formats = worksheet["A2:A11"].ConditionalFormats;
IConditionalFormat format = formats.AddCondition();
//Set FormatType as DataBar.
format.FormatType = ExcelCFType.DataBar;
IDataBar dataBar = format.DataBar;
//Set Bar Axis Position.
dataBar.DataBarAxisPosition = DataBarAxisPosition.middle;
//Save and Dispose.
workbook.SaveAs("ConditionalFormats.xlsx");
workbook.Close();
}
DataBarDirection
Gets or sets the direction of the data bar.
Declaration
DataBarDirection DataBarDirection { get; set; }
Property Value
Type |
---|
DataBarDirection |
Examples
The position of the DataBar will be context by default. This can be changed to leftToRight or rightToLeft. In our example we set the direction of the DataBar to rightToLeft.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create a worksheet.
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Load data to Apply Conditional Formatting.
worksheet["A1"].Text = "DataBar";
worksheet["A2"].Number = 10;
worksheet["A3"].Number = 20;
worksheet["A4"].Number = 30;
worksheet["A5"].Number = 40;
worksheet["A6"].Number = 50;
worksheet["A7"].Number = 60;
worksheet["A8"].Number = 70;
worksheet["A9"].Number = 80;
worksheet["A10"].Number = 90;
worksheet["A11"].Number = 100;
//Create instance of IConditonalFormat and IConditionalFormats.
IConditionalFormats formats = worksheet["A2:A11"].ConditionalFormats;
IConditionalFormat format = formats.AddCondition();
//Set FormatType as DataBar.
format.FormatType = ExcelCFType.DataBar;
IDataBar dataBar = format.DataBar;
//Set Bar Direction
dataBar.DataBarDirection = DataBarDirection.rightToLeft;
//Save and Dispose.
workbook.SaveAs("ConditionalFormats.xlsx");
workbook.Close();
}
HasBorder
Gets a Boolean value indicating whether the data bar has a border.
Declaration
bool HasBorder { get; }
Property Value
Type |
---|
System.Boolean |
Remarks
Setting color to BorderColor property makes the HasBorder to return "True".
Examples
By default there will be no color set to BorderColor property, So HasBorder property will return "False". If we set color to BorderColor property then the HasBorder property will return "True". Here in our example, we check the HasBorder property before applying Border color and after applying Border color.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create a worksheet.
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Load data to Apply Conditional Formatting.
worksheet["A1"].Text = "DataBar";
worksheet["A2"].Number = 10;
worksheet["A3"].Number = 20;
worksheet["A4"].Number = 30;
worksheet["A5"].Number = 40;
worksheet["A6"].Number = 50;
worksheet["A7"].Number = 60;
worksheet["A8"].Number = 70;
worksheet["A9"].Number = 80;
worksheet["A10"].Number = 90;
worksheet["A11"].Number = 100;
//Create instance of IConditonalFormat and IConditionalFormats.
IConditionalFormats formats = worksheet["A2:A11"].ConditionalFormats;
IConditionalFormat format = formats.AddCondition();
//Set FormatType as DataBar.
format.FormatType = ExcelCFType.DataBar;
IDataBar dataBar = format.DataBar;
//Before Applying Border color
Console.WriteLine(dataBar.HasBorder);
//Set Border color for DataBar
dataBar.BorderColor = System.Drawing.Color.Yellow;
//After Applying Border color
Console.WriteLine(dataBar.HasBorder);
//Save and Dispose.
workbook.SaveAs("ConditionalFormats.xlsx");
workbook.Close();
Console.Read();
}
// Output in the console will be
// False
// True
HasGradientFill
Gets or sets a Boolean value indicating whether the data bar has a gradient fill.
Declaration
bool HasGradientFill { get; set; }
Property Value
Type |
---|
System.Boolean |
Remarks
To know more about conditional formatting type refer this link.
Examples
HasGradientFill is set to "True" by default to provide a rich formatting look to DataBars. To make the DataBars look with plain unformatted color just like the color fill of cells, we can set this property to "False".
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create a worksheet.
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Load data to Apply Conditional Formatting.
worksheet["A1"].Text = "DataBar";
worksheet["A2"].Number = 10;
worksheet["A3"].Number = 20;
worksheet["A4"].Number = 30;
worksheet["A5"].Number = 40;
worksheet["A6"].Number = 50;
worksheet["A7"].Number = 60;
worksheet["A8"].Number = 70;
worksheet["A9"].Number = 80;
worksheet["A10"].Number = 90;
worksheet["A11"].Number = 100;
//Create instance of IConditonalFormat and IConditionalFormats.
IConditionalFormats formats = worksheet["A2:A11"].ConditionalFormats;
IConditionalFormat format = formats.AddCondition();
//Set FormatType as DataBar.
format.FormatType = ExcelCFType.DataBar;
IDataBar dataBar = format.DataBar;
//Set Gradient fill to false.
dataBar.HasGradientFill = false;
//Save and Dispose.
workbook.SaveAs("ConditionalFormats.xlsx");
workbook.Close();
}
MaxPoint
Gets a IConditionValue object which specifies how the longest bar is evaluated for a data bar conditional format.
Declaration
IConditionValue MaxPoint { get; }
Property Value
Type |
---|
IConditionValue |
Remarks
To customize the longest bar of DataBar we have to set values for MaxPoint property.
Examples
The longest bar of DataBar is set by defining the MaxPoint property. To do that we have to set values for Value, Type and Operator Properties. Here for example, we set "70" to Value property which sets the longest bar.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create a worksheet.
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Load data to Apply Conditional Formatting.
worksheet["A1"].Text = "DataBar";
worksheet["A2"].Number = 10;
worksheet["A3"].Number = 20;
worksheet["A4"].Number = 30;
worksheet["A5"].Number = 40;
worksheet["A6"].Number = 50;
worksheet["A7"].Number = 60;
worksheet["A8"].Number = 70;
worksheet["A9"].Number = 80;
worksheet["A10"].Number = 90;
worksheet["A11"].Number = 100;
//Create instance of IConditonalFormat and IConditionalFormats.
IConditionalFormats formats = worksheet["A2:A11"].ConditionalFormats;
IConditionalFormat format = formats.AddCondition();
//Set FormatType as DataBar.
format.FormatType = ExcelCFType.DataBar;
IDataBar dataBar = format.DataBar;
//Set MaxPoint for DataBar
dataBar.MaxPoint.Value = "70";
dataBar.MaxPoint.Type = ConditionValueType.Percent;
//Save and Dispose.
workbook.SaveAs("ConditionalFormats.xlsx");
workbook.Close();
}
MinPoint
Gets a IConditionValue object which specifies how the shortest bar is evaluated for a data bar conditional format.
Declaration
IConditionValue MinPoint { get; }
Property Value
Type |
---|
IConditionValue |
Remarks
To customize the longest bar of DataBar we have to set values for MaxPoint property.
Examples
The shortest bar of DataBar is set by defining the MinPoint property. To do that we have to set values for Value, Type and Operator Properties. Here for example, we set "30" to Value property which sets the shortest bar.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create a worksheet.
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Load data to Apply Conditional Formatting.
worksheet["A1"].Text = "DataBar";
worksheet["A2"].Number = 10;
worksheet["A3"].Number = 20;
worksheet["A4"].Number = 30;
worksheet["A5"].Number = 40;
worksheet["A6"].Number = 50;
worksheet["A7"].Number = 60;
worksheet["A8"].Number = 70;
worksheet["A9"].Number = 80;
worksheet["A10"].Number = 90;
worksheet["A11"].Number = 100;
//Create instance of IConditonalFormat and IConditionalFormats.
IConditionalFormats formats = worksheet["A2:A11"].ConditionalFormats;
IConditionalFormat format = formats.AddCondition();
//Set FormatType as DataBar.
format.FormatType = ExcelCFType.DataBar;
IDataBar dataBar = format.DataBar;
//Set MinPoint for DataBar
dataBar.MinPoint.Value = "30";
dataBar.MinPoint.Type = ConditionValueType.Percent;
//Save and Dispose.
workbook.SaveAs("ConditionalFormats.xlsx");
workbook.Close();
}
NegativeBorderColor
Gets or sets the negative border color of the data bar.
Declaration
Color NegativeBorderColor { get; set; }
Property Value
Type |
---|
Color |
Remarks
To change fill color and border color of DataBars use BarColor and BorderColor properties.
Examples
There will be no borders applied to ColorBars initially. Like BorderColor property used to set border color for positive values in the cells NegativeBorderColor property is used to set border color for negative values in the cells. Here in our example, we set NegativeBorderColor to Yellow.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create a worksheet.
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Load data to Apply Conditional Formatting.
worksheet["A1"].Text = "DataBar";
worksheet["A2"].Number = 10;
worksheet["A3"].Number = -20;
worksheet["A4"].Number = -30;
worksheet["A5"].Number = 40;
worksheet["A6"].Number = -50;
worksheet["A7"].Number = 60;
worksheet["A8"].Number = -70;
worksheet["A9"].Number = 80;
worksheet["A10"].Number = -90;
worksheet["A11"].Number = 100;
//Create instance of IConditonalFormat and IConditionalFormats.
IConditionalFormats formats = worksheet["A2:A11"].ConditionalFormats;
IConditionalFormat format = formats.AddCondition();
//Set FormatType as DataBar.
format.FormatType = ExcelCFType.DataBar;
IDataBar dataBar = format.DataBar;
//Set NegativeBorder color for DataBar
dataBar.NegativeBorderColor = System.Drawing.Color.Yellow;
//Save and Dispose.
workbook.SaveAs("ConditionalFormats.xlsx");
workbook.Close();
}
NegativeFillColor
Gets or sets the negative fill color of the data bar. This element MUST exist if and only if negativeBarColorSameAsPositive equals "false".
Declaration
Color NegativeFillColor { get; set; }
Property Value
Type |
---|
Color |
Remarks
To customize the border color and fill color of the DataBar we can use BorderColor and BarColor properties.
Examples
To customize color for DataBar which has negative values in the cells, we have to set color for NegativeBorderColor and NegativeFillColor properties. Here in our example, to show Databar for negative values we are setting red color for NegativeFillColor property.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create a worksheet.
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Load data to Apply Conditional Formatting.
worksheet["A1"].Text = "DataBar";
worksheet["A2"].Number = 10;
worksheet["A3"].Number = 20;
worksheet["A4"].Number = 30;
worksheet["A5"].Number = 40;
worksheet["A6"].Number = 50;
worksheet["A7"].Number = 60;
worksheet["A8"].Number = 70;
worksheet["A9"].Number = 80;
worksheet["A10"].Number = 90;
worksheet["A11"].Number = 100;
//Create instance of IConditonalFormat and IConditionalFormats.
IConditionalFormats formats = worksheet["A2:A11"].ConditionalFormats;
IConditionalFormat format = formats.AddCondition();
//Set FormatType as DataBar.
format.FormatType = ExcelCFType.DataBar;
IDataBar dataBar = format.DataBar;
//Set NegativeBar color for DataBar
dataBar.NegativeFillColor = System.Drawing.Color.Red;
//Save and Dispose.
workbook.SaveAs("ConditionalFormats.xlsx");
workbook.Close();
}
PercentMax
Gets or sets a value that specifies the length of the longest data bar as a percentage of cell width.
Declaration
int PercentMax { get; set; }
Property Value
Type |
---|
System.Int32 |
Remarks
To set minimum length of the DataBar refer PercentMin property.
Examples
By default the DataBar's PercentMax and PercentMin are set to 100 and 0 respectively. This allows the DataBar to begin from the starting position zero to the entire cell width. We can customize the appearance of DataBars by changing these two properties. Here for example, we set the PercentMax property's value to 80. This sets the DataBars maximum lenght to 80 percent.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create a worksheet.
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Load data to Apply Conditional Formatting.
worksheet["A1"].Text = "DataBar";
worksheet["A2"].Number = 10;
worksheet["A3"].Number = 20;
worksheet["A4"].Number = 30;
worksheet["A5"].Number = 40;
worksheet["A6"].Number = 50;
worksheet["A7"].Number = 60;
worksheet["A8"].Number = 70;
worksheet["A9"].Number = 80;
worksheet["A10"].Number = 90;
worksheet["A11"].Number = 100;
//Create instance of IConditonalFormat and IConditionalFormats.
IConditionalFormats formats = worksheet["A2:A11"].ConditionalFormats;
IConditionalFormat format = formats.AddCondition();
//Set FormatType as DataBar.
format.FormatType = ExcelCFType.DataBar;
IDataBar dataBar = format.DataBar;
//Set maximum percentage.
dataBar.PercentMax = 80;
//Save and Dispose.
workbook.SaveAs("ConditionalFormats.xlsx");
workbook.Close();
}
PercentMin
Gets or sets a value that specifies the length of the shortest data bar as a percentage of cell width.
Declaration
int PercentMin { get; set; }
Property Value
Type |
---|
System.Int32 |
Examples
By default the DataBar's PercentMax and PercentMin are set to 100 and 0 respectively. This allows the DataBar to begin from the starting position zero to the entire cell width. We can customize the appearance of DataBars by changing these two properties. Here for example, we set the PercentMin property's value to 50. This sets the DataBar's shortest lenght to 50 percent.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create a worksheet.
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Load data to Apply Conditional Formatting.
worksheet["A1"].Text = "DataBar";
worksheet["A2"].Number = 10;
worksheet["A3"].Number = 20;
worksheet["A4"].Number = 30;
worksheet["A5"].Number = 40;
worksheet["A6"].Number = 50;
worksheet["A7"].Number = 60;
worksheet["A8"].Number = 70;
worksheet["A9"].Number = 80;
worksheet["A10"].Number = 90;
worksheet["A11"].Number = 100;
//Create instance of IConditonalFormat and IConditionalFormats.
IConditionalFormats formats = worksheet["A2:A11"].ConditionalFormats;
IConditionalFormat format = formats.AddCondition();
//Set FormatType as DataBar.
format.FormatType = ExcelCFType.DataBar;
IDataBar dataBar = format.DataBar;
//Set minumum percentage.
dataBar.PercentMin = 50;
//Save and Dispose.
workbook.SaveAs("ConditionalFormats.xlsx");
workbook.Close();
}
ShowValue
Gets or sets a Boolean value that specifies if the value in the cell should be displayed or not. Default value is true.
Declaration
bool ShowValue { get; set; }
Property Value
Type |
---|
System.Boolean |
Examples
When only graphical representation is enough then we can make use of ShowValue property to hide the data in the cells. By default this is set to "True". We can change it to "False" to hide the values in the cells. Here in our example we set the ShowValues property to "False" to hide the data in the cells.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create a worksheet.
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Load data to Apply Conditional Formatting.
worksheet["A1"].Text = "DataBar";
worksheet["A2"].Number = 10;
worksheet["A3"].Number = 20;
worksheet["A4"].Number = 30;
worksheet["A5"].Number = 40;
worksheet["A6"].Number = 50;
worksheet["A7"].Number = 60;
worksheet["A8"].Number = 70;
worksheet["A9"].Number = 80;
worksheet["A10"].Number = 90;
worksheet["A11"].Number = 100;
//Create instance of IConditonalFormat and IConditionalFormats.
IConditionalFormats formats = worksheet["A2:A11"].ConditionalFormats;
IConditionalFormat format = formats.AddCondition();
//Set FormatType as DataBar.
format.FormatType = ExcelCFType.DataBar;
IDataBar dataBar = format.DataBar;
//Set ShowValue
dataBar.ShowValue = false;
//Save and Dispose.
workbook.SaveAs("ConditionalFormats.xlsx");
workbook.Close();
}