How to set a column to fit the longest text programmatically in Excel?

In Excel, you can double-click a column header (actually the line between 2 column headers) and the column to the left will expand in width to fit the length of the longest text. Is there a way to do this programmatically? I am using Excel 2010 with C# and .Net framework.

Answers


I believe you can use:

    Rng.Columns.AutoFit()

Need Your Help

Custom AsyncTaskLoader with cache

android parallel-processing asynctaskloader

There are several tutorials on how to implement custom AsyncTaskLoaders but none I found discusses how to handle data caching - in all of them the data are just loaded and delivered.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.