CheckBox celltype appears as false when exported to excel

Posted by: eager2knw on 8 September 2017, 1:34 pm EST

  • Posted 8 September 2017, 1:34 pm EST

    <P>hi, </P>
    <P>I have set the value of the checkbox to 0 , in the spread.</P>
    <P>Now when I export to excel , it shows <STRONG>false.</STRONG></P>
    <P><STRONG>Doesnt show the checkbox.</STRONG></P>
    <P>Please Help.</P>
    <P>Thanks,</P>
    <P>Eager2knw</P>
  • Replied 8 September 2017, 1:34 pm EST

    You can use the ImageCellType if you are using the latest version.  I can't quantify how huge the overload might be.  It depends on the size of the image and the number you have.  I imagine it will be a large xls file.<br>
  • Replied 8 September 2017, 1:34 pm EST

    <P>Thanks for the swift reply.  It wud more useful if you can share a sample code for the same.<img src="/emoticons/emotion-1.gif" alt="Smile" /></P>
    <P>To Check for checkboxcelltype across the spread and convert it to imagecelltype.</P>
    <P> and jus before changing it to imagecelltype I have to check the value for the checkbox celltype (if value =0 ; set image1) else (set image2)</P>
    <P>Note: All this manipulation sholud be done within the scope of the SaveExcel method.</P>
    <P> </P>
    <P>Thanks,</P>
    <P>Eager2knw</P>
    <P> </P>
  • Replied 8 September 2017, 1:34 pm EST

    Graphical celltypes are not exported.  Only the value in the cell.<br>
  • Replied 8 September 2017, 1:34 pm EST

    <P>Hi , </P>
    <P>But its my desparate requirement to show a checkbox in the exported spread. So, I jus thought Instead of using a exporting checkbox celltype, if I can convert all checkbox celltypes in the spread to image celltypes [ i.e : Set a checked checkbox image (if value is true)  or an unchecked checkbox image (if the value is false) and then finally export it to excel. Can u please share a sample C# code for the above requirement.</P>
    <P>My another serious query is, if I search the entire spread for checkbox celltype and then convert those image celltypes, will that be huge overload during export</P>
    <P>Thanks, </P>
    <P>Eager2knw</P>
  • Replied 8 September 2017, 1:34 pm EST

    You will have to write your own sub or function to do this.  It can't be done within the scope of the SaveExcel method.<br>
  • Replied 8 September 2017, 1:34 pm EST

    <p>Here is a routine I wrote to do this...</p><p>Public Sub SaveExcelCheck()<br>Dim img As New FarPoint.Win.Spread.CellType.ImageCellType<br>Dim imagedown As System.Drawing.Image = System.Drawing.Image.FromFile("c:\forums15\chkdwn.bmp")<br>Dim streamdown As New System.IO.MemoryStream<br>Dim imageup As System.Drawing.Image = System.Drawing.Image.FromFile("c:\forums15\chkup.bmp")<br>Dim streamup As New System.IO.MemoryStream<br>imagedown.Save(streamdown, System.Drawing.Imaging.ImageFormat.Bmp)<br>imageup.Save(streamup, System.Drawing.Imaging.ImageFormat.Bmp)<br>Dim c As FarPoint.Win.Spread.CellType.ICellType<br>Dim row, col As Integer<br>For row = 0 To FpSpread1.ActiveSheet.RowCount - 1<br>For col = 0 To FpSpread1.ActiveSheet.ColumnCount - 1<br>c = FpSpread1.ActiveSheet.GetCellType(row, col)<br><br>If TypeOf c Is FarPoint.Win.Spread.CellType.CheckBoxCellType Then<br>If FpSpread1.ActiveSheet.Cells(row, col).Value = 0 Then<br>FpSpread1.ActiveSheet.Cells(row, col).CellType = img<br>FpSpread1.ActiveSheet.Cells(row, col).Value = imagedown<br>ElseIf FpSpread1.ActiveSheet.Cells(row, col).Value = 1 Then<br>FpSpread1.ActiveSheet.Cells(row, col).CellType = img<br>FpSpread1.ActiveSheet.Cells(row, col).Value = imageup<br>End If<br>End If<br>Next<br>Next<br>FpSpread1.SaveExcel("c:\forums15\check.xls", FarPoint.Excel.ExcelSaveFlags.SaveAsViewed)<br>End Sub <br></p>
  • Replied 8 September 2017, 1:34 pm EST

    <P>Thanks a ton!</P>
    <P>It worked<img src="/emoticons/emotion-1.gif" alt="Smile" /></P>
Need extra support?

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

Learn More

Forum Channels