Setting a Check Box Cell

Posted by: doris on 8 September 2017, 2:58 pm EST

  • Posted 8 September 2017, 2:58 pm EST

    <font size="3" face="????">

    </font>

    <span style="font-size:10pt;">How can I setting a check box cell that state is “indeterminate”?<o:p></o:p></span>

    <font size="3" face="????">

    </font>

    <span style="font-size:10pt;"><o:p> </o:p></span>

    <font size="3" face="????">

    </font>

    <span style="font-size:10pt;">Sample code:<o:p></o:p></span>

    <font size="3" face="????">

    </font>

    <span style="font-size:10pt;">m_ssSheet.SetCol(1);<o:p></o:p></span>

    <font size="3" face="????">

    </font>

    <span style="font-size:10pt;">m_ssSheet.SetRow(1);<o:p></o:p></span>

    <font size="3" face="????">

    </font>

    <span style="font-size:10pt;"><o:p> </o:p></span>

    <font size="3" face="????">

    </font>

    <span style="font-size:10pt;">m_ssSheet.SetCellType( SS_CELL_TYPE_CHECKBOX ); <o:p></o:p></span>

    <font size="3" face="????">

    </font>

    <span style="font-size:10pt;">m_ssSheet.SetTypeCheckType( SS_CHECKBOX_THREE_STATE ); </span><span style="font-size:10pt;"><o:p></o:p></span>

    <font size="3" face="????">

    </font>

    <span style="font-size:10pt;">m_ssSheet.SetText(“ ”); // </span><span style="font-size:10pt;">check
    box state is </span><span style="font-size:10pt;">Unchecked<o:p></o:p></span>

    <font size="3" face="????">

    </font>

    <span style="font-size:10pt;"><o:p> </o:p></span>

    <font size="3" face="????">

    </font>

    <span style="font-size:10pt;">m_ssSheet.SetText(“ 1 ”); // </span><span style="font-size:10pt;">check
    box state is </span><span style="font-size:10pt;">checked</span><span style="font-size:10pt;"><o:p></o:p></span>

    <font size="3" face="????">

    </font>

    <span style="font-size:10pt;">????<span style="mso-spacerun:yes;">     </span>// </span><span style="font-size:10pt;">check box state is </span><span style="font-size:10pt;">“NotSure”    indeterminate</span>

    <span style="font-size:10pt;"></span> 

    <span style="font-size:10pt;">reference:http://www.gcpowertools.com/help/spreadnet6/WF/spwin-setcheckboxcell.html</span>

    <font size="3" face="????">

    </font>

    <span style="font-size:10pt;">thanks </span><span style="font-size:10pt;"><o:p></o:p></span>

    <font size="3" face="????">

    </font>
  • Replied 8 September 2017, 2:58 pm EST

    Hello,


    You can set the states of the CheckBoxCellType in cells by assigning values to the cells, 0 refers to unchecked state, 1 refers to the checked state and 2 refers to the indeterminate state. Please refer to the following code snippet that sets the same.


                FarPoint.Win.Spread.CellType.CheckBoxCellType ckbxcell = new FarPoint.Win.Spread.CellType.CheckBoxCellType();
                ckbxcell.ThreeState = true;
                ckbxcell.TextTrue = "Checked";
                ckbxcell.TextFalse = "Unchecked";
                ckbxcell.TextIndeterminate = "Not Sure";


                fpSpread1.ActiveSheet.Cells[0, 0].CellType = ckbxcell


                fpSpread1.ActiveSheet.Cells[1, 0].CellType = ckbxcell;
                fpSpread1.ActiveSheet.Cells[2, 0].CellType = ckbxcell;


                fpSpread1.Sheets[0].Cells[0, 0].Value = 0;//Unchecked state
                fpSpread1.Sheets[0].Cells[1, 0].Value = 1;//Checked state
                fpSpread1.Sheets[0].Cells[2, 0].Value = 2;//Indeterminate state


    Hope it will help you. Please let me know if I missed something or if you have any queries further.


    Thanks,


    Manpreet Kaur

  • Replied 8 September 2017, 2:58 pm EST

    Hello,

    You may set the text for check box cell as :

    <span style="font-size:10pt;">m_ssSheet.SetText(“ 2 ”);</span>

     

    to make it intermediate.

     

    Thanks,

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels