2 Issues exporting to excel

Posted by: ovillacis on 8 September 2017, 12:58 pm EST

  • Posted 8 September 2017, 12:58 pm EST


    1) I'm exporting to excel a spread control filled of RTF cells; when I open the excel file I get some cells (not all)  full filled with the "#" character however they still contain the right text. Excel is using "text" format for the right and wrong cells.

    In the code I'm using:

        grid.SaveExcel(<FONT color=#800000>"c:\temp.xls"</FONT>, Spread.Model.IncludeHeaders.BothCustomOnly)

    Is the RTF cell type the cause of this? I really need to keep it for display the data in the spread control.

    2) I'm using row headers spans in the spread control, and at the bottom of  the same excel file the last row header span envelops closely 40 (sometimes 20) empty rows after my data, Am I missing something to avoid the extra rows?

    How can I send you images of these issues?

  • Replied 8 September 2017, 12:58 pm EST


    1) The # characters will display due to the width of the column not being large enough to display all the text. Try making the column width's larger in Spread and see if it shows the text correctly in the exported Excel file.

    2) I am not sure what the issue you are seeing here is. It sounds like it is a bug in Spread. Make sure you are using the latest maintenance release of Spread for Windows Forms. If you are, could you post a small zipped project we could use to debug this issue?

  • Replied 8 September 2017, 12:58 pm EST


    1) If you resize the column in Excel, does it eventually show the data in the cell. If it does, you need to make the width larger in Spread before exporting.

    2) You can reply to the post and on the Options tab is a place to attach zip files. The zip file needs to be less than 256KB.

  • Replied 8 September 2017, 12:58 pm EST

    Yes, I did it; before try into my code I resized the columns width in Excel, and u can apply the maximun column size (255) to the columns and u still get the same view of  some cells filled with the #... I'm sending u the xls file and picts because my code is involving a lot of DB access, I'll appreciate any suggestion... I'll try to make a small project later...


  • Replied 8 September 2017, 12:58 pm EST


    The issue with the # characters displaying in some cells has to do with the length of the text. There looks to be a limit of around 256 characters allowed in the cell before the cell renders as all # characters. If you go to one of the Text cells that is displaying the text and add more characters to the string, you will see the same issue in that cell.

    Could you save your spreadsheet to XML (using the Save method) and zip and post that for us to debug the issue with the spanning cell? Also make sure you are using the latest maintenance release for Spread for Windows Forms.

  • Replied 8 September 2017, 12:58 pm EST

    yes, u r right... I forgot to say that if u change the cells to "general" format the problem is solved too; I've using the Excel assambly for customize the worbook after the exporting task but I wonder if is there a way in the spread to change the format to something like the "general" format of Ecxel without to loose the RTF view before exporting it?

    Thanks a lot for ur time... I'm sending the xml file.

  • Replied 8 September 2017, 12:58 pm EST

    Thanx for ur answer... but the cells filled with the # character are in the same columns that the normal showed cells, however I tried ur solution adding the double to the actual column and row sizes but  I got nothing.

    I'm using the last maintenance release, so what's the way to post files in this forum?


  • Replied 8 September 2017, 12:58 pm EST


    1) There is not a way to change the format that Spread uses to export the data from the RichTextCellType.

    2) This is caused by how you are setting up your Spread control. I looked in your XML file and the last span is spanning 58 rows.

    <DIV><SPAN class=b><FONT face="Courier New" color=#ff0000> </FONT></SPAN> <SPAN class=m><FONT color=#0000ff><</FONT></SPAN><SPAN class=t><FONT color=#990000>CellRange</FONT></SPAN> <SPAN class=t><FONT color=#990000>Row</FONT></SPAN><SPAN class=m><FONT color=#0000ff>="</FONT></SPAN><B>56</B><SPAN class=m><FONT color=#0000ff>"</FONT></SPAN><SPAN class=t><FONT color=#990000> Column</FONT></SPAN><SPAN class=m><FONT color=#0000ff>="</FONT></SPAN><B>0</B><SPAN class=m><FONT color=#0000ff>"</FONT></SPAN><SPAN class=t><FONT color=#990000> RowCount</FONT></SPAN><SPAN class=m><FONT color=#0000ff>="</FONT></SPAN><B>58</B><SPAN class=m><FONT color=#0000ff>"</FONT></SPAN><SPAN class=t><FONT color=#990000> ColumnCount</FONT></SPAN><SPAN class=m><FONT color=#0000ff>="</FONT></SPAN><B>1</B><FONT color=#0000ff><SPAN class=m>"</SPAN><SPAN class=m> /></SPAN></FONT> </DIV>
    <DIV>cI am not sure how this is being set up initially, but in Spread, since the RowCount is not 114, you do not see this entire span in Spread, but in Excel, you will see the entire span as you do.</DIV>
Need extra support?

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

Learn More

Forum Channels