FNCGrid autowidth columns


On the image above allow my user to export his data into an XLS file using your FNCGrid first.

Is there an option that I can execute once I filled the FNCGrid and increase every column width to the maximum length text of an item on that column??

Or I need to calculate manually when I am filling the Grid and increase every column based on the maximum length text of each cell?


There is a method called AutoSizeColumn / AutoSizeColumns that can be used to automatically calculate the required width to fit the text, this is based on the cell properties as well


It works, but slow drastically my App

I will do it manually after all the cells values was loaded, in order to calculate it manually can you please tell me the equivalence of 1 caracter how many width (single value) must be set to FNCGrid.Columns[ X ].Width???

I mean if one cell has 148 caracters how much represent in terms of WIDTH property???


It depends on the font, typically we use CalculateText('W') which is the widest character and then multiply it by the number of characters

Does CalculateText is a FNCGrid procedure? I mean do I need to call FNCGrid.CalculateText('W') in order to get an integer value?


It's a TTMSFNCGraphics method, you can create a instance and use that to calculate if you want