Interface IChartAxis
Represents an axis on the chart.
Namespace: Syncfusion.XlsIO
Assembly: Syncfusion.XlsIO.Base.dll
Syntax
public interface IChartAxis
Properties
Alignment
Gets or sets the alignment for the tick label.
Declaration
ExcelAxisTextDirection Alignment { get; set; }
Property Value
Type |
---|
ExcelAxisTextDirection |
Remarks
Used in older versions of Microsoft office.
AutoTickLabelSpacing
Gets or sets a boolean value indicating whether or not the tick label spacing is automatic.
Declaration
bool AutoTickLabelSpacing { get; set; }
Property Value
Type |
---|
System.Boolean |
Remarks
Using TickLabelSpacing and TickMarkSpacing we can alter the IChartCategoryAxis appearance.
Examples
By default AutoTickLabelSpacing property is set to "true" tick label spacing is set automatically. Here for example, we set AutoTickLabelSpacing to "false".
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create worksheet
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
//Add data
sheet.Range["A1"].Text = "Jan";
sheet.Range["B1"].Text = "Feb";
sheet.Range["C1"].Text = "Mar";
sheet.Range["A2"].Value = "10";
sheet.Range["B2"].Value = "20";
sheet.Range["C2"].Value = "30";
//Create chart
IChart chart = sheet.Charts.Add();
//Set range
chart.DataRange = sheet.Range["A1:C2"];
//Set chart type
chart.ChartType = ExcelChartType.Line;
//Set chart axis
IChartAxis chartAxis = chart.PrimaryCategoryAxis;
//Set auto spacing
chartAxis.AutoTickLabelSpacing = false;
//Save and Dispose
workbook.SaveAs("Chart.xlsx");
workbook.Close();
}
AxisType
Gets the type of the axis. Read-only.
Declaration
ExcelAxisType AxisType { get; }
Property Value
Type |
---|
ExcelAxisType |
Examples
The following code illustrates how to access the AxisType property.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create worksheet
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
//Add data
sheet.Range["A1"].Text = "Jan";
sheet.Range["B1"].Text = "Feb";
sheet.Range["C1"].Text = "Mar";
sheet.Range["A2"].Value = "10000";
sheet.Range["B2"].Value = "20000";
sheet.Range["C2"].Value = "30000";
//Create chart
IChart chart = sheet.Charts.Add();
//Set range
chart.DataRange = sheet.Range["A1:C2"];
//Set chart value axis
IChartAxis chartAxis = chart.PrimaryValueAxis;
//Get axis type
Console.Write(chartAxis.AxisType);
//Save and Dispose
workbook.SaveAs("Chart.xlsx");
workbook.Close();
Console.ReadKey();
}
Border
Gets the chart border. Read-only.
Declaration
IChartBorder Border { get; }
Property Value
Type |
---|
IChartBorder |
Examples
The following code illustrates how to set color to PrimaryCategoryAxis's border using Border property.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create worksheet
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
//Add data
sheet.Range["A1"].Text = "Jan";
sheet.Range["B1"].Text = "Feb";
sheet.Range["C1"].Text = "Mar";
sheet.Range["A2"].Value = "10";
sheet.Range["B2"].Value = "20";
sheet.Range["C2"].Value = "30";
//Create chart
IChart chart = sheet.Charts.Add();
//Set chart type
chart.ChartType = ExcelChartType.Pareto;
//Set range
chart.DataRange = sheet.Range["A1:C2"];
//Set chart category axis
IChartAxis categoryAxis = chart.PrimaryCategoryAxis;
//Set category title
categoryAxis.Title = "Categories";
//Set border
IChartBorder border = categoryAxis.Border;
//Set color
border.ColorIndex = ExcelKnownColors.Red;
//Save and Dispose
workbook.SaveAs("Chart.xlsx");
workbook.Close();
}
Chart3DOptions
Gets the 3D options for the chart. Read-only.
Declaration
IThreeDFormat Chart3DOptions { get; }
Property Value
Type |
---|
IThreeDFormat |
Remarks
Used in older versions of Microsoft office.
Font
Gets the font used for axis text display. Read-only.
Declaration
IFont Font { get; }
Property Value
Type |
---|
IFont |
Examples
The following code illustrates how to set font color to the PrimaryCategoryAxis's category labels using Font property.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create worksheet
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
//Add data
sheet.Range["A1"].Text = "Jan";
sheet.Range["B1"].Text = "Feb";
sheet.Range["C1"].Text = "Mar";
sheet.Range["A2"].Value = "10";
sheet.Range["B2"].Value = "20";
sheet.Range["C2"].Value = "30";
//Create chart
IChart chart = sheet.Charts.Add();
//Set range
chart.DataRange = sheet.Range["A1:C2"];
//Set chart axis
IChartAxis chartAxis = chart.PrimaryCategoryAxis;
//Set font color
chartAxis.Font.Color = ExcelKnownColors.Red;
//Save and Dispose
workbook.SaveAs("Chart.xlsx");
workbook.Close();
}
HasMajorGridLines
Gets or sets a boolean value indicating if the axis has major grid lines.
Declaration
bool HasMajorGridLines { get; set; }
Property Value
Type |
---|
System.Boolean |
Examples
The following code illustrates how to set visibility of MajorGridLines of PrimaryCategoryAxis.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create worksheet
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
//Add data
sheet.Range["A1"].Text = "Jan";
sheet.Range["B1"].Text = "Feb";
sheet.Range["C1"].Text = "Mar";
sheet.Range["A2"].Value = "10";
sheet.Range["B2"].Value = "20";
sheet.Range["C2"].Value = "30";
//Create chart
IChart chart = sheet.Charts.Add();
//Set range
chart.DataRange = sheet.Range["A1:C2"];
//Set chart axis
IChartAxis chartAxis = chart.PrimaryCategoryAxis;
//Set grid lines visibility
chartAxis.HasMajorGridLines = true;
//Save and Dispose
workbook.SaveAs("Chart.xlsx");
workbook.Close();
}
HasMinorGridLines
Gets or sets a boolean value indicating if the axis has minor grid lines.
Declaration
bool HasMinorGridLines { get; set; }
Property Value
Type |
---|
System.Boolean |
Examples
The following code illustrates how to set visibility of MinorGridLines of PrimaryCategoryAxis.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create worksheet
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
//Add data
sheet.Range["A1"].Text = "Jan";
sheet.Range["B1"].Text = "Feb";
sheet.Range["C1"].Text = "Mar";
sheet.Range["A2"].Value = "10";
sheet.Range["B2"].Value = "20";
sheet.Range["C2"].Value = "30";
//Create chart
IChart chart = sheet.Charts.Add();
//Set range
chart.DataRange = sheet.Range["A1:C2"];
//Set chart axis
IChartAxis chartAxis = chart.PrimaryCategoryAxis;
//Set grid lines visibility
chartAxis.HasMinorGridLines = true;
//Save and Dispose
workbook.SaveAs("Chart.xlsx");
workbook.Close();
}
IsReversed
True if data points are plotted from last to first. otherwise False.
Declaration
bool IsReversed { get; set; }
Property Value
Type |
---|
System.Boolean |
Remarks
This property is obsolete. Please use ReversePlotOrder instead of it
MajorGridLines
Gets the major grid lines for the axis. Read-only.
Declaration
IChartGridLine MajorGridLines { get; }
Property Value
Type |
---|
IChartGridLine |
Examples
The following code illustrates how to access MajorGridLines of PrimaryCategoryAxis and set colors to it.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create worksheet
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
//Add data
sheet.Range["A1"].Text = "Jan";
sheet.Range["B1"].Text = "Feb";
sheet.Range["C1"].Text = "Mar";
sheet.Range["A2"].Value = "10";
sheet.Range["B2"].Value = "20";
sheet.Range["C2"].Value = "30";
//Create chart
IChart chart = sheet.Charts.Add();
//Set range
chart.DataRange = sheet.Range["A1:C2"];
//Set chart axis
IChartAxis chartAxis = chart.PrimaryCategoryAxis;
//Set visibility
chartAxis.HasMajorGridLines = true;
//Set grid lines
IChartGridLine gridLine = chartAxis.MajorGridLines;
gridLine.LineProperties.ColorIndex = ExcelKnownColors.Red;
//Save and Dispose
workbook.SaveAs("Chart.xlsx");
workbook.Close();
}
MajorTickMark
Gets or sets the type of major tick mark for the axis.
Declaration
ExcelTickMark MajorTickMark { get; set; }
Property Value
Type |
---|
ExcelTickMark |
Examples
By default MajorTickMark is set to TickMark_Outside. Here for example, we set TickMark_Cross to MajorTickMark.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create worksheet
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
//Add data
sheet.Range["A1"].Text = "Jan";
sheet.Range["B1"].Text = "Feb";
sheet.Range["C1"].Text = "Mar";
sheet.Range["A2"].Value = "10";
sheet.Range["B2"].Value = "20";
sheet.Range["C2"].Value = "30";
//Create chart
IChart chart = sheet.Charts.Add();
//Set range
chart.DataRange = sheet.Range["A1:C2"];
//Set chart category axis
IChartAxis categoryAxis = chart.PrimaryCategoryAxis;
//Set category major tick type
categoryAxis.MajorTickMark = ExcelTickMark.TickMark_Cross;
//Save and Dispose
workbook.SaveAs("Chart.xlsx");
workbook.Close();
}
MinorGridLines
Gets the minor grid lines for the axis. Read-only.
Declaration
IChartGridLine MinorGridLines { get; }
Property Value
Type |
---|
IChartGridLine |
Examples
The following code illustrates how to access MinorGridLines of PrimaryCategoryAxis and set colors to it.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create worksheet
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
//Add data
sheet.Range["A1"].Text = "Jan";
sheet.Range["B1"].Text = "Feb";
sheet.Range["C1"].Text = "Mar";
sheet.Range["A2"].Value = "10";
sheet.Range["B2"].Value = "20";
sheet.Range["C2"].Value = "30";
//Create chart
IChart chart = sheet.Charts.Add();
//Set range
chart.DataRange = sheet.Range["A1:C2"];
//Set chart axis
IChartAxis chartAxis = chart.PrimaryCategoryAxis;
//Set visibility
chartAxis.HasMinorGridLines = true;
//Set grid lines
IChartGridLine gridLine = chartAxis.MinorGridLines;
gridLine.LineProperties.ColorIndex = ExcelKnownColors.Red;
//Save and Dispose
workbook.SaveAs("Chart.xlsx");
workbook.Close();
}
MinorTickMark
Gets or sets the type of minor tick mark for the axis.
Declaration
ExcelTickMark MinorTickMark { get; set; }
Property Value
Type |
---|
ExcelTickMark |
Examples
By default MinorTickMark is set to TickMark_None. Here for example, we set TickMark_Cross to MinorTickMark.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create worksheet
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
//Add data
sheet.Range["A1"].Text = "Jan";
sheet.Range["B1"].Text = "Feb";
sheet.Range["C1"].Text = "Mar";
sheet.Range["A2"].Value = "10";
sheet.Range["B2"].Value = "20";
sheet.Range["C2"].Value = "30";
//Create chart
IChart chart = sheet.Charts.Add();
//Set range
chart.DataRange = sheet.Range["A1:C2"];
//Set chart category axis
IChartAxis categoryAxis = chart.PrimaryCategoryAxis;
//Set category minor tick type
categoryAxis.MinorTickMark = ExcelTickMark.TickMark_Cross;
//Save and Dispose
workbook.SaveAs("Chart.xlsx");
workbook.Close();
}
NumberFormat
Gets or sets number format for the axis values.
Declaration
string NumberFormat { get; set; }
Property Value
Type |
---|
System.String |
Examples
By default "General" set to NumberFormat. Here for example, we set currency format "$#,##0_);($#,##0)" to NumberFormat to display value in the PrimaryValueAxis as currency.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create worksheet
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
//Add data
sheet.Range["A1"].Text = "Jan";
sheet.Range["B1"].Text = "Feb";
sheet.Range["C1"].Text = "Mar";
sheet.Range["A2"].Value = "10000";
sheet.Range["B2"].Value = "20000";
sheet.Range["C2"].Value = "30000";
//Create chart
IChart chart = sheet.Charts.Add();
//Set range
chart.DataRange = sheet.Range["A1:C2"];
//Set chart value axis
IChartAxis chartAxis = chart.PrimaryValueAxis;
//Set number format
chartAxis.NumberFormat = @"$#,##0_);($#,##0)";
//Save and Dispose
workbook.SaveAs("Chart.xlsx");
workbook.Close();
}
ReversePlotOrder
Gets or sets a boolean value indicating whether to plot data points from last to first.
Declaration
bool ReversePlotOrder { get; set; }
Property Value
Type |
---|
System.Boolean |
Examples
The following code illustrates how to plot the data points in reverse order.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create worksheet
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
//Add data
sheet.Range["A1"].Text = "Jan";
sheet.Range["B1"].Text = "Feb";
sheet.Range["C1"].Text = "Mar";
sheet.Range["A2"].Value = "10";
sheet.Range["B2"].Value = "20";
sheet.Range["C2"].Value = "30";
sheet.Range["A3"].Value = "100";
sheet.Range["B3"].Value = "200";
sheet.Range["C3"].Value = "300";
//Create chart
IChart chart = sheet.Charts.Add();
//Set range
chart.DataRange = sheet.Range["A1:C3"];
//Set chart axis
IChartAxis chartAxis = chart.PrimaryCategoryAxis;
//Set reverse plot order
chartAxis.ReversePlotOrder = true;
//Save and Dispose
workbook.SaveAs("Chart.xlsx");
workbook.Close();
}
Shadow
Gets the shadow properties for the axis. Read-only.
Declaration
IShadow Shadow { get; }
Property Value
Type |
---|
IShadow |
Examples
The following code illustrates how to set ShadowColor, Size and Blur by accessing Shadow property.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create worksheet
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
//Add data
sheet.Range["A1"].Text = "Jan";
sheet.Range["B1"].Text = "Feb";
sheet.Range["C1"].Text = "Mar";
sheet.Range["A2"].Value = "10";
sheet.Range["B2"].Value = "20";
sheet.Range["C2"].Value = "30";
//Create chart
IChart chart = sheet.Charts.Add();
//Set range
chart.DataRange = sheet.Range["A1:C2"];
//Set chart category axis
IChartAxis categoryAxis = chart.PrimaryCategoryAxis;
//Set category title
categoryAxis.Title = "Categories";
//Set shadow
IShadow shadow = categoryAxis.Shadow;
shadow.Size = 100;
shadow.Blur = 15;
//Set color
shadow.ShadowColor = System.Drawing.Color.Red;
//Save and Dispose
workbook.SaveAs("Chart.xlsx");
workbook.Close();
}
TextRotationAngle
Gets or sets the axis text rotation angle. Should be an integer value between -90 and 90.
Declaration
int TextRotationAngle { get; set; }
Property Value
Type |
---|
System.Int32 |
Examples
The following code illustrates how to set TextRotationAngle for PrimaryCategoryAxis.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create worksheet
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
//Add data
sheet.Range["A1"].Text = "Jan";
sheet.Range["B1"].Text = "Feb";
sheet.Range["C1"].Text = "Mar";
sheet.Range["A2"].Value = "10";
sheet.Range["B2"].Value = "20";
sheet.Range["C2"].Value = "30";
//Create chart
IChart chart = sheet.Charts.Add();
//Set range
chart.DataRange = sheet.Range["A1:C2"];
//Set secondary axis
IChartAxis chartAxis = chart.PrimaryCategoryAxis;
//Set text rotation angle
chartAxis.TextRotationAngle = 30;
//Save and Dispose
workbook.SaveAs("Chart.xlsx");
workbook.Close();
}
TickLabelPosition
Gets or sets the position of tick-mark labels on the axis.
Declaration
ExcelTickLabelPosition TickLabelPosition { get; set; }
Property Value
Type |
---|
ExcelTickLabelPosition |
Examples
By default TickLabelPosition is set to TickLabelPosition_NextToAxis. Here for example, we set TickLabelPosition_High to TickLabelPosition property.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create worksheet
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
//Add data
sheet.Range["A1"].Text = "Jan";
sheet.Range["B1"].Text = "Feb";
sheet.Range["C1"].Text = "Mar";
sheet.Range["A2"].Value = "10";
sheet.Range["B2"].Value = "20";
sheet.Range["C2"].Value = "30";
//Create chart
IChart chart = sheet.Charts.Add();
//Set range
chart.DataRange = sheet.Range["A1:C2"];
//Set chart category axis
IChartAxis categoryAxis = chart.PrimaryCategoryAxis;
//Set category tick labels position
categoryAxis.TickLabelPosition = ExcelTickLabelPosition.TickLabelPosition_High;
//Save and Dispose
workbook.SaveAs("Chart.xlsx");
workbook.Close();
}
Title
Gets or sets the axis title.
Declaration
string Title { get; set; }
Property Value
Type |
---|
System.String |
Examples
The following code illustrates how to set Title for the PrimaryCategoryAxis.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create worksheet
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
//Add data
sheet.Range["A1"].Text = "Jan";
sheet.Range["B1"].Text = "Feb";
sheet.Range["C1"].Text = "Mar";
sheet.Range["A2"].Value = "10";
sheet.Range["B2"].Value = "20";
sheet.Range["C2"].Value = "30";
//Create chart
IChart chart = sheet.Charts.Add();
//Set chart type
chart.ChartType = ExcelChartType.Pareto;
//Set range
chart.DataRange = sheet.Range["A1:C2"];
//Set chart category axis
IChartAxis categoryAxis = chart.PrimaryCategoryAxis;
//Set category title
categoryAxis.Title = "Categories";
//Save and Dispose
workbook.SaveAs("Chart.xlsx");
workbook.Close();
}
TitleArea
Gets the area for the axis title. Read-only.
Declaration
IChartTextArea TitleArea { get; }
Property Value
Type |
---|
IChartTextArea |
Examples
The following code illustrates how to set foreground color to PrimaryCategoryAxis's title area using TitleArea property.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create worksheet
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
//Add data
sheet.Range["A1"].Text = "Jan";
sheet.Range["B1"].Text = "Feb";
sheet.Range["C1"].Text = "Mar";
sheet.Range["A2"].Value = "10";
sheet.Range["B2"].Value = "20";
sheet.Range["C2"].Value = "30";
//Create chart
IChart chart = sheet.Charts.Add();
//Set chart type
chart.ChartType = ExcelChartType.Pareto;
//Set range
chart.DataRange = sheet.Range["A1:C2"];
//Set chart category axis
IChartAxis categoryAxis = chart.PrimaryCategoryAxis;
//Set category title
categoryAxis.Title = "Categories";
//Set title area
IChartTextArea titleArea = categoryAxis.TitleArea;
//Set color
titleArea.FrameFormat.Fill.ForeColorIndex = ExcelKnownColors.Pale_blue;
//Save and Dispose
workbook.SaveAs("Chart.xlsx");
workbook.Close();
}
Visible
True if the axis is visible. otherwise False.
Declaration
bool Visible { get; set; }
Property Value
Type |
---|
System.Boolean |
Examples
The following code illustrates how to set visibility of PrimaryCategoryAxis.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create worksheet
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
//Add data
sheet.Range["A1"].Text = "Jan";
sheet.Range["B1"].Text = "Feb";
sheet.Range["C1"].Text = "Mar";
sheet.Range["A2"].Value = "10";
sheet.Range["B2"].Value = "20";
sheet.Range["C2"].Value = "30";
sheet.Range["A3"].Value = "100";
sheet.Range["B3"].Value = "200";
sheet.Range["C3"].Value = "300";
//Create chart
IChart chart = sheet.Charts.Add();
//Set range
chart.DataRange = sheet.Range["A1:C3"];
//Set chart axis
IChartAxis chartAxis = chart.PrimaryCategoryAxis;
//Set visibility
chartAxis.Visible = false;
//Save and Dispose
workbook.SaveAs("Chart.xlsx");
workbook.Close();
}