File Formats

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Interface IOptionButtonShape

    Show / Hide Table of Contents

    Interface IOptionButtonShape

    This interface represents TextBox form control shape.

    Inherited Members
    ITextBox.HAlignment
    ITextBox.VAlignment
    ITextBox.TextRotation
    ITextBox.IsTextLocked
    ITextBox.RichText
    ITextBox.Text
    IShape.Remove()
    IShape.Scale(Int32, Int32)
    IShape.Height
    IShape.Id
    IShape.Left
    IShape.Name
    IShape.Top
    IShape.Width
    IShape.ShapeType
    IShape.IsShapeVisible
    IShape.AlternativeText
    IShape.IsMoveWithCell
    IShape.IsSizeWithCell
    IShape.Fill
    IShape.Line
    IShape.OnAction
    IShape.Shadow
    IShape.ThreeD
    IShape.ShapeRotation
    IShape.TextFrame
    IShape.Hyperlink
    IParentApplication.Application
    IParentApplication.Parent
    Namespace: Syncfusion.XlsIO
    Assembly: Syncfusion.XlsIO.Base.dll
    Syntax
    public interface IOptionButtonShape : ITextBoxShape, ITextBox, IShape, IParentApplication

    Properties

    CheckState

    Indicates whether option button is checked.

    Declaration
    ExcelCheckState CheckState { get; set; }
    Property Value
    Type Description
    ExcelCheckState
    Examples

    By default, Unchecked is set to CheckState property. Here for example, we add two IOptionButtonShape and set Checked to CheckState.

            using (ExcelEngine excelEngine = new ExcelEngine())
            {
                //Create worksheet
                IApplication application = excelEngine.Excel;
                application.DefaultVersion = ExcelVersion.Excel2013;
                IWorkbook workbook = application.Workbooks.Create(1);
                IWorksheet worksheet = workbook.Worksheets[0];
    
                //Add option buttons
                IOptionButtonShape optionButton1 = worksheet.OptionButtons.AddOptionButton();
                IOptionButtonShape optionButton2 = worksheet.OptionButtons.AddOptionButton();
    
                //Set text
                optionButton1.Text = "Option1";
                optionButton2.Text = "Option2";
    
                //Set dimensions
                optionButton1.Left = 60;
                optionButton1.Top = 40;
                optionButton1.Width = 100;
                optionButton1.Height = 30;
    
                optionButton2.Left = 160;
                optionButton2.Top = 40;
                optionButton2.Width = 100;
                optionButton2.Height = 30;
    
                //Set linked cell
                optionButton1.LinkedCell = worksheet["$C$7"];
    
                //Set state
                optionButton1.CheckState = ExcelCheckState.Checked;
    
                //Save and dispose
                workbook.SaveAs("Shapes.xlsx");
                workbook.Close();
            }

    Display3DShading

    Gets or sets value indicating whether 3D shadow is present.

    Declaration
    bool Display3DShading { get; set; }
    Property Value
    Type Description
    System.Boolean
    Examples

    The following code illustrates how to set Display3DShading property.

            using (ExcelEngine excelEngine = new ExcelEngine())
            {
                //Create worksheet
                IApplication application = excelEngine.Excel;
                application.DefaultVersion = ExcelVersion.Excel2013;
                IWorkbook workbook = application.Workbooks.Create(1);
                IWorksheet worksheet = workbook.Worksheets[0];
    
                //Add option buttons
                IOptionButtonShape optionButton1 = worksheet.OptionButtons.AddOptionButton();
                IOptionButtonShape optionButton2 = worksheet.OptionButtons.AddOptionButton();
    
                //Set text
                optionButton1.Text = "Option1";
                optionButton2.Text = "Option2";
    
                //Set dimensions
                optionButton1.Left = 60;
                optionButton1.Top = 40;
                optionButton1.Width = 100;
                optionButton1.Height = 30;
    
                optionButton2.Left = 160;
                optionButton2.Top = 40;
                optionButton2.Width = 100;
                optionButton2.Height = 30;
    
                //Set linked cell
                optionButton1.LinkedCell = worksheet["$C$7"];
    
                //Set state
                optionButton1.CheckState = ExcelCheckState.Checked;
    
                //Set 3D Shading
                optionButton1.Display3DShading = true;
                optionButton2.Display3DShading = true;
    
                //Save and dispose
                workbook.SaveAs("Shapes.xlsx");
                workbook.Close();
            }

    IsFirstButton

    Indicates whether option button is first button. Read Only

    Declaration
    bool IsFirstButton { get; }
    Property Value
    Type Description
    System.Boolean
    Examples

    The following code illustrates how to access IsFirstButton property.

            using (ExcelEngine excelEngine = new ExcelEngine())
            {
                //Create worksheet
                IApplication application = excelEngine.Excel;
                application.DefaultVersion = ExcelVersion.Excel2013;
                IWorkbook workbook = application.Workbooks.Create(1);
                IWorksheet worksheet = workbook.Worksheets[0];
    
                //Add option buttons
                IOptionButtonShape optionButton1 = worksheet.OptionButtons.AddOptionButton();
                IOptionButtonShape optionButton2 = worksheet.OptionButtons.AddOptionButton();
    
                //Set text
                optionButton1.Text = "Option1";
                optionButton2.Text = "Option2";
    
                //Set dimensions
                optionButton1.Left = 60;
                optionButton1.Top = 40;
                optionButton1.Width = 100;
                optionButton1.Height = 30;
    
                optionButton2.Left = 160;
                optionButton2.Top = 40;
                optionButton2.Width = 100;
                optionButton2.Height = 30;
    
                //Set linked cell
                optionButton1.LinkedCell = worksheet["$C$7"];
    
                //Set state
                optionButton1.CheckState = ExcelCheckState.Checked;
    
                //Check IsFirstButton
                Console.WriteLine(optionButton1.IsFirstButton);
                Console.WriteLine(optionButton2.IsFirstButton);
    
                //Save and dispose
                workbook.SaveAs("Shapes.xlsx");
                workbook.Close();
                Console.ReadKey();
            }
    //Output will be
    //True
    //False

    LinkedCell

    Indicates the cell in which the option button points to

    Declaration
    IRange LinkedCell { get; set; }
    Property Value
    Type Description
    IRange
    Examples

    The following code illustrates how to set LinkedCell for IOptionButtonShape.

            using (ExcelEngine excelEngine = new ExcelEngine())
            {
                //Create worksheet
                IApplication application = excelEngine.Excel;
                application.DefaultVersion = ExcelVersion.Excel2013;
                IWorkbook workbook = application.Workbooks.Create(1);
                IWorksheet worksheet = workbook.Worksheets[0];
    
                //Add option buttons
                IOptionButtonShape optionButton1 = worksheet.OptionButtons.AddOptionButton();
                IOptionButtonShape optionButton2 = worksheet.OptionButtons.AddOptionButton();
    
                //Set text
                optionButton1.Text = "Option1";
                optionButton2.Text = "Option2";
    
                //Set dimensions
                optionButton1.Left = 60;
                optionButton1.Top = 40;
                optionButton1.Width = 100;
                optionButton1.Height = 30;
    
                optionButton2.Left = 160;
                optionButton2.Top = 40;
                optionButton2.Width = 100;
                optionButton2.Height = 30;
    
                //Set linked cell
                optionButton1.LinkedCell = worksheet["$C$7"];
    
                //Set state
                optionButton1.CheckState = ExcelCheckState.Checked;
    
                //Save and dispose
                workbook.SaveAs("Shapes.xlsx");
                workbook.Close();
            }
    Back to top Generated by DocFX
    Copyright © 2001 - 2023 Syncfusion Inc. All Rights Reserved