The MindFusion Forums
Grid and Spreadsheet Components >> Windows Forms >> Column Auto Width Filling to Largest Entry Size
https://mindfusion.eu/Forum/YaBB.pl?num=1516733761

Message started by MindFusionUser47 on Jan 23rd, 2018 at 6:56pm

Title: Column Auto Width Filling to Largest Entry Size
Post by MindFusionUser47 on Jan 23rd, 2018 at 6:56pm
What is the most elegant way to have the column width for each column be the size of the largest entry so no resizing is needed upon program runtime? Is there any built in feature that allows auto-sizing? If not I would recommend one in the new features forum. Any solutions please? Already I have tried measuring the size of the biggest string in each column by means of loops. Then trying to convert string length to pt which is very difficult as not all chars are the same length. Then setting the sheet.Columns[x].Width = xpt for each x columns. There has to be a better way? Hopefully a built in one.

Title: Re: Column Auto Width Filling to Largest Entry Size
Post by Meppy on Jan 24th, 2018 at 7:58am
Hi,

You can use the ResizeColumnToFit or ResizeColumnsToFit methods in the WorkbookView class to resize one or multiple columns to fit their content.

I hope this helps.

Regards,
Meppy

The MindFusion Forums » Powered by YaBB 2.6.11!
YaBB Forum Software © 2000-2024. All Rights Reserved.