Syncfusion.XlsIO.Base
Example 


WidthMode Property (IChartLayout)

Gets or sets a value indicating how to interpret the Width of this manual layout. The WidthMode property values are from LayoutModes.
Syntax
'Declaration
 
Property WidthMode As LayoutModes
'Usage
 
Dim instance As IChartLayout
Dim value As LayoutModes
 
instance.WidthMode = value
 
value = instance.WidthMode
LayoutModes WidthMode {get; set;}
Remarks
To know more about charts refer this link.
Example
The following code illustrates the use of WidthMode property.
using Syncfusion.XlsIO;
             
class Example
{
   static void Main()
   {
      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.RightColumn = 11;
        chart.Name = "Student Sample Chart";
        chart.ChartType = ExcelChartType.Cone_Clustered_3D;
        chart.DataRange = sheet.Range["B2:C6"];  
        
        //Manually positioning plot area
        chart.PlotArea.Layout.WidthMode = LayoutModes.factor; //sets a value of Width mode for plot area
        chart.PlotArea.Layout.Height = 300;
        chart.PlotArea.Layout.Width = 430;
        chart.PlotArea.Layout.Top = 40; 
        chart.PlotArea.Layout.Left = 10;         
        
        //Manually positioning legent area
        chart.Legend.Layout.WidthMode = LayoutModes.factor; //sets a value of Width mode for legent area
        chart.Legend.Layout.Height = 160;
        chart.Legend.Layout.Width = 120;
        chart.Legend.Layout.Top = 30; 
        chart.Legend.Layout.Left = 220;      
            
        //Manually positioning text Area
        chart.ChartTitleArea.Layout.WidthMode = LayoutModes.factor; //sets a value of Width mode for text area
        chart.ChartTitleArea.Text = "Sample Chart";
        chart.ChartTitleArea.Layout.Height = 20;
        chart.ChartTitleArea.Layout.Width = 30;
        chart.ChartTitleArea.Layout.Top = 0; 
        chart.ChartTitleArea.Layout.Left = 150; 
        workbook.SaveAs("Charts.xlsx");
        workbook.Close();
      }
   }
}
AssemblyVersion

Syncfusion.XlsIO.Base: 17.2460.0.34

See Also