Solved

How Do You Auto-Expand All Columns on an Excel SpreadSheet?

Posted on 2013-11-19
1
601 Views
Last Modified: 2013-11-21
I am opening an Excel SpreadSheet in Visual Studio C#.  I need to know how to auto-expand all Excel SpreadSheet columns on Open.  I currently cannot see all column information.

Thanks,

Dan
0
Comment
Question by:danielolorenz
1 Comment
 
LVL 15

Accepted Solution

by:
unknown_routine earned 500 total points
Comment Utility
I assume you already know how to open an Excel application and worksheet in C#.


If so all you need is :

 Cells.EntireColumn.AutoFit

Cells is a property of the worksheet.

so after opening the Excel application simply run the above code.

MyWorkSheet.Cells.EntireColumn.AutoFit


If this is not clear enough please let me know.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now