Cell width


How to get the necessary width of the cell according to the text value of the cell. I don't want to perform AutoFit I just need the width of the cell.

TIA and best regards


We currently don't have  public method for that. The workaround would be to save the current column width by using GetColWidth, then autofit the column, read the new width, and call SetColWidth with the saved value to restore the width to the original.

It isn't really clean, but I can't think in a better way right now. We could make another method public to get what you want directly, but I am a little afraid to add new methods unless there is a proven demand for it. I am not sure if getting the width needed for autofit without actually autofitting is such a common case as to add a new method for it.

Thank you. Your hint is sufficient.