Hello,
How to avoid replacing number by #### when the column width isn't sufficiently large. For textual values it's Ok - they overlap neighbour cell.
Thanks in advance.
Pavel.
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
VulpesRank #55 · 29.2K reputationPosted Sep 27, 2012, 4:39 AM EDT
If you need to estimate the maximum number of characters programatically, it will make life easier if you're using a fixed width font.
Pavel106 reputationPosted Sep 27, 2012, 4:56 AM EDT
In my case your solution can't resolve the problem as concerned cell is situated in the column, where the width is set to a particular value, that match the values widths in other rows in the same column.
If my memory is Ok, there is some formatting technique inside Esxel, that allow to avoid such
problems. But I don't remember how to achieve this and certainly NOT how to do it from C#.
Regards.
Pavel.
Pavel106 reputationPosted Sep 28, 2012, 2:01 AM EDT
when I format a number with quote separators, it's Ok:
myExcelWorksheet.Cells[6, "I"] = String.Format("{0:#,##0}", number);
Regards.
VulpesRank #55 · 29.2K reputationPosted Sep 28, 2012, 2:18 AM EDT
Pavel106 reputationPosted Sep 28, 2012, 2:41 AM EDT