Interface IChartTextArea
Represents the Text Area in a chart.
Inherited Members
Namespace: Syncfusion.XlsIO
Assembly: Syncfusion.XlsIO.NET.dll
Syntax
public interface IChartTextArea : IFont, IParentApplication, IOptimizedUpdate
Properties
BackgroundMode
Get or sets the Display mode of the background. The chart Text Area's Display mode can be changed using ExcelChartBackgroundMode
Declaration
ExcelChartBackgroundMode BackgroundMode { get; set; }
Property Value
Type |
---|
ExcelChartBackgroundMode |
Remarks
To know more about charts refer this link.
Examples
The following code illustrates the use of BackgroundMode property.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create a worksheet.
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
sheet.Range["A1"].Text = "Student ID";
sheet.Range["B1"].Text = "Student Name";
sheet.Range["C1"].Text = "Mark(Out of 100)";
sheet.Range["A1:C1"].AutofitColumns();
sheet.Range["A2"].Number = 1;
sheet.Range["A3"].Number = 2;
sheet.Range["A4"].Number = 3;
sheet.Range["A5"].Number = 4;
sheet.Range["A6"].Number = 5;
sheet.Range["B2"].Text = "Andrew";
sheet.Range["B3"].Text = "Marson";
sheet.Range["B4"].Text = "Jack";
sheet.Range["B5"].Text = "Sam";
sheet.Range["B6"].Text = "Breto";
sheet.Range["C2"].Number = 77;
sheet.Range["C3"].Number = 45;
sheet.Range["C4"].Number = 92;
sheet.Range["C5"].Number = 39;
sheet.Range["C6"].Number = 55;
//Create a Chart
IChartShape chart = sheet.Charts.Add();
chart.LeftColumn = 5;
chart.Name = "Student Sample Chart";
chart.ChartType = ExcelChartType.Cone_Clustered_3D;
chart.DataRange = sheet.Range["B2:C6"];
chart.ChartTitleArea.Text = "Student Chart";
//sets the Display mode of the background
chart.ChartTitleArea.BackgroundMode = ExcelChartBackgroundMode.Opaque;
workbook.SaveAs("Charts.xlsx");
workbook.Close();
}
FrameFormat
Gets the formatting options of the chart for text area. Read-only. Return format of the text area.
Declaration
IChartFrameFormat FrameFormat { get; }
Property Value
Type |
---|
IChartFrameFormat |
Remarks
To know more about charts refer this link.
Examples
The following code illustrates the use of FrameFormat property.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create a worksheet.
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
sheet.Range["A1"].Text = "Student ID";
sheet.Range["B1"].Text = "Student Name";
sheet.Range["C1"].Text = "Mark(Out of 100)";
sheet.Range["A1:C1"].AutofitColumns();
sheet.Range["A2"].Number = 1;
sheet.Range["A3"].Number = 2;
sheet.Range["A4"].Number = 3;
sheet.Range["A5"].Number = 4;
sheet.Range["A6"].Number = 5;
sheet.Range["B2"].Text = "Andrew";
sheet.Range["B3"].Text = "Marson";
sheet.Range["B4"].Text = "Jack";
sheet.Range["B5"].Text = "Sam";
sheet.Range["B6"].Text = "Breto";
sheet.Range["C2"].Number = 77;
sheet.Range["C3"].Number = 45;
sheet.Range["C4"].Number = 92;
sheet.Range["C5"].Number = 39;
sheet.Range["C6"].Number = 55;
//Create a Chart
IChartShape chart = sheet.Charts.Add();
chart.LeftColumn = 5;
chart.Name = "Student Sample Chart";
chart.ChartType = ExcelChartType.Cone_Clustered_3D;
chart.DataRange = sheet.Range["B2:C6"];
//Gets the formatting options of the chart for text area
chart.ChartTitleArea.Text = "Sample Chart";
chart.ChartTitleArea.FrameFormat.Border.LineColor = System.Drawing.Color.Brown;
chart.ChartTitleArea.FrameFormat.Interior.BackgroundColor = System.Drawing.Color.Beige;
chart.ChartTitleArea.FrameFormat.Interior.Pattern = ExcelPattern.Percent25;
workbook.SaveAs("Charts.xlsx");
workbook.Close();
}
IsAutoMode
True if background is set to automatic.
Declaration
bool IsAutoMode { get; set; }
Property Value
Type |
---|
System.Boolean |
Remarks
To know more about charts refer this link.
Examples
The following code illustrates the use of IsAutoMode property.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create a worksheet.
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
sheet.Range["A1"].Text = "Student ID";
sheet.Range["B1"].Text = "Student Name";
sheet.Range["C1"].Text = "Mark(Out of 100)";
sheet.Range["A1:C1"].AutofitColumns();
sheet.Range["A2"].Number = 1;
sheet.Range["A3"].Number = 2;
sheet.Range["A4"].Number = 3;
sheet.Range["A5"].Number = 4;
sheet.Range["A6"].Number = 5;
sheet.Range["B2"].Text = "Andrew";
sheet.Range["B3"].Text = "Marson";
sheet.Range["B4"].Text = "Jack";
sheet.Range["B5"].Text = "Sam";
sheet.Range["B6"].Text = "Breto";
sheet.Range["C2"].Number = 77;
sheet.Range["C3"].Number = 45;
sheet.Range["C4"].Number = 92;
sheet.Range["C5"].Number = 39;
sheet.Range["C6"].Number = 55;
//Create a Chart
IChartShape chart = sheet.Charts.Add();
chart.LeftColumn = 5;
chart.Name = "Student Sample Chart";
chart.ChartType = ExcelChartType.Cone_Clustered_3D;
chart.DataRange = sheet.Range["B2:C6"];
chart.ChartTitleArea.Text = "Student Chart";
//True if background is set to automatic
chart.ChartTitleArea.IsAutoMode = true;
workbook.SaveAs("Charts.xlsx");
workbook.Close();
}
IsFormula
Gets or sets a value indicating whether this instance is formula.
Declaration
bool IsFormula { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Examples
The following code illustrates the use IsFormula property.
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
sheet.Range["A1"].Text = "Month";
sheet.Range["B1"].Text = "Product A";
sheet.Range["C1"].Text = "Product B";
sheet.Range["A2"].Text = "Jan";
sheet.Range["A3"].Text = "Feb";
sheet.Range["A4"].Text = "Mar";
sheet.Range["A5"].Text = "Apr";
sheet.Range["A6"].Text = "May";
sheet.Range["B2"].Number = 111;
sheet.Range["B3"].Number = 361;
sheet.Range["B4"].Number = 336;
sheet.Range["B5"].Number = 40;
sheet.Range["B6"].Number = 219;
sheet.Range["C2"].Number = 182;
sheet.Range["C3"].Number = 283;
sheet.Range["C4"].Number = 406;
sheet.Range["C5"].Number = 449;
sheet.Range["C6"].Number = 337;
IChartShape chart = sheet.Charts.Add();
chart.ChartType = ExcelChartType.Line;
chart.DataRange = sheet.Range["A1:C6"];
chart.ChartTitleArea.IsFormula = true;
chart.ChartTitle = "='Sheet1'!$A$2";
workbook.SaveAs("Charts.xlsx");
workbook.Close();
}
Layout
Represents the Layout settings of TextArea. Layout settings are used to specifies the position using IChartLayout.
Declaration
IChartLayout Layout { get; set; }
Property Value
Type |
---|
IChartLayout |
Remarks
The layout option LayoutTarget is supported only for plot area. To know more about charts refer this link.
Examples
The following code illustrates the use of Layout property.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create a worksheet.
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
sheet.Range["A1"].Text = "Student ID";
sheet.Range["B1"].Text = "Student Name";
sheet.Range["C1"].Text = "Mark(Out of 100)";
sheet.Range["A1:C1"].AutofitColumns();
sheet.Range["A2"].Number = 1;
sheet.Range["A3"].Number = 2;
sheet.Range["A4"].Number = 3;
sheet.Range["A5"].Number = 4;
sheet.Range["A6"].Number = 5;
sheet.Range["B2"].Text = "Andrew";
sheet.Range["B3"].Text = "Marson";
sheet.Range["B4"].Text = "Jack";
sheet.Range["B5"].Text = "Sam";
sheet.Range["B6"].Text = "Breto";
sheet.Range["C2"].Number = 77;
sheet.Range["C3"].Number = 45;
sheet.Range["C4"].Number = 92;
sheet.Range["C5"].Number = 39;
sheet.Range["C6"].Number = 55;
//Create a Chart
IChartShape chart = sheet.Charts.Add();
chart.LeftColumn = 5;
chart.Name = "Student Sample Chart";
chart.ChartType = ExcelChartType.Cone_Clustered_3D;
chart.DataRange = sheet.Range["B2:C6"];
chart.ChartTitleArea.Text = "Student Chart";
//Layout settings for TextArea is below
chart.ChartTitleArea.Layout.HeightMode = LayoutModes.edge;
chart.ChartTitleArea.Layout.WidthMode = LayoutModes.edge;
chart.ChartTitleArea.Layout.LeftMode = LayoutModes.edge;
chart.ChartTitleArea.Layout.TopMode = LayoutModes.edge;
chart.ChartTitleArea.Layout.Height = 200;
chart.ChartTitleArea.Layout.Width = 300;
chart.ChartTitleArea.Layout.Left = 180;
chart.ChartTitleArea.Layout.Top = 20;
workbook.SaveAs("Charts.xlsx");
workbook.Close();
}
RichText
String with rich text formatting in the chart. Read-only.
Declaration
IChartRichTextString RichText { get; }
Property Value
Type |
---|
IChartRichTextString |
Remarks
To know more about charts refer this link.
Examples
The following code illustrates the use of RichText property.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create a worksheet.
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
sheet.Range["A1"].Text = "Student ID";
sheet.Range["B1"].Text = "Student Name";
sheet.Range["C1"].Text = "Mark(Out of 100)";
sheet.Range["A1:C1"].AutofitColumns();
sheet.Range["A2"].Number = 1;
sheet.Range["A3"].Number = 2;
sheet.Range["A4"].Number = 3;
sheet.Range["A5"].Number = 4;
sheet.Range["A6"].Number = 5;
sheet.Range["B2"].Text = "Andrew";
sheet.Range["B3"].Text = "Marson";
sheet.Range["B4"].Text = "Jack";
sheet.Range["B5"].Text = "Sam";
sheet.Range["B6"].Text = "Breto";
sheet.Range["C2"].Number = 77;
sheet.Range["C3"].Number = 45;
sheet.Range["C4"].Number = 92;
sheet.Range["C5"].Number = 39;
sheet.Range["C6"].Number = 55;
//Create a Chart
IChartShape chart = sheet.Charts.Add();
chart.LeftColumn = 5;
chart.Name = "Student Sample Chart";
chart.ChartType = ExcelChartType.Cone_Clustered_3D;
chart.DataRange = sheet.Range["B2:C6"];
chart.ChartTitleArea.Text = "Sample Chart";
//Create a font style for RichText
IFont font = chart.ChartTitleArea;
font.Color = ExcelKnownColors.Orange;
font.FontName = "Broadway";
//Get the rich text formatting in the chart
IChartRichTextString richText = chart.ChartTitleArea.RichText;
//Sets the rich text in Text Area
richText.SetFont(0, 5, font);
workbook.SaveAs("Charts.xlsx");
workbook.Close();
}
Text
Get or sets the Area's text in the chart.
Declaration
string Text { get; set; }
Property Value
Type |
---|
System.String |
Remarks
To know more about charts refer this link.
Examples
The following code illustrates the use of Text property.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create a worksheet.
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
sheet.Range["A1"].Text = "Student ID";
sheet.Range["B1"].Text = "Student Name";
sheet.Range["C1"].Text = "Mark(Out of 100)";
sheet.Range["A1:C1"].AutofitColumns();
sheet.Range["A2"].Number = 1;
sheet.Range["A3"].Number = 2;
sheet.Range["A4"].Number = 3;
sheet.Range["A5"].Number = 4;
sheet.Range["A6"].Number = 5;
sheet.Range["B2"].Text = "Andrew";
sheet.Range["B3"].Text = "Marson";
sheet.Range["B4"].Text = "Jack";
sheet.Range["B5"].Text = "Sam";
sheet.Range["B6"].Text = "Breto";
sheet.Range["C2"].Number = 77;
sheet.Range["C3"].Number = 45;
sheet.Range["C4"].Number = 92;
sheet.Range["C5"].Number = 39;
sheet.Range["C6"].Number = 55;
//Create a Chart
IChartShape chart = sheet.Charts.Add();
chart.LeftColumn = 5;
chart.Name = "Student Sample Chart";
chart.ChartType = ExcelChartType.Cone_Clustered_3D;
chart.DataRange = sheet.Range["B2:C6"];
//sets the Area's text in the chart
chart.ChartTitleArea.Text = "Student Chart";
workbook.SaveAs("Charts.xlsx");
workbook.Close();
}
TextRotationAngle
Text rotation angle. We can rotate or change the angle of the Area's text.
Declaration
int TextRotationAngle { get; set; }
Property Value
Type |
---|
System.Int32 |
Remarks
To know more about charts refer this link.
Examples
The following code illustrates the use of RightColumn property.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create a worksheet.
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
sheet.Range["A1"].Text = "Student ID";
sheet.Range["B1"].Text = "Student Name";
sheet.Range["C1"].Text = "Mark(Out of 100)";
sheet.Range["A1:C1"].AutofitColumns();
sheet.Range["A2"].Number = 1;
sheet.Range["A3"].Number = 2;
sheet.Range["A4"].Number = 3;
sheet.Range["A5"].Number = 4;
sheet.Range["A6"].Number = 5;
sheet.Range["B2"].Text = "Andrew";
sheet.Range["B3"].Text = "Marson";
sheet.Range["B4"].Text = "Jack";
sheet.Range["B5"].Text = "Sam";
sheet.Range["B6"].Text = "Breto";
sheet.Range["C2"].Number = 77;
sheet.Range["C3"].Number = 45;
sheet.Range["C4"].Number = 92;
sheet.Range["C5"].Number = 39;
sheet.Range["C6"].Number = 55;
//Create a Chart
IChartShape chart = sheet.Charts.Add();
chart.LeftColumn = 5;
chart.Name = "Student Sample Chart";
chart.ChartType = ExcelChartType.Cone_Clustered_3D;
chart.DataRange = sheet.Range["B2:C6"];
chart.ChartTitleArea.Text = "Student Chart";
//Sets the Text rotation angle
chart.ChartTitleArea.TextRotationAngle = 30;
workbook.SaveAs("Charts.xlsx");
workbook.Close();
}