Link to home
Start Free TrialLog in
Avatar of g_johnson
g_johnsonFlag for United States of America

asked on

VS 2003 C# -- writing to Excel

From C# (VS 2003) I am writing to an Excel Spreadsheet using techniques like this:

range.get_Offset(l,0).set_Value(Missing.Value,"Account Number");
range.get_Offset(l,1).set_Value(Missing.Value,"Management Group");
range.get_Offset(l,2).set_Value(Missing.Value,"Customer Type");
range.get_Offset(l,3).set_Value(Missing.Value,"Customer Date of Birth");
range.get_Offset(l,4).set_Value(Missing.Value,"Customer Name");

and

range.get_Offset(l,3).EntireColumn.NumberFormat = "MM/DD/YYYY";

The spreadsheet ends up with 63 columns.

Before saving, I would like to adjust the column width for each column to match the size of the data written to it.  If possible I would like to emulate the Excel process whereby you select all columns and double-click on a border to automatically adjust them.  If that's not possible, I would need to adjust each column manually.

How do I accomplish this?
ASKER CERTIFIED SOLUTION
Avatar of Garretty
Garretty

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of g_johnson

ASKER

thanks