// Assume that the second column needs to be widened.
Just find a cell in the second column.
Excel.ApplicationClass el = new Excel.ApplicationClass ();
object o = Type.Missing;
Excel.Workbook book = el.Workbooks.Open ("d:\\aa.xls", o, o, o, o, o, o, o, o, o, o, o, o,
o, o, o, o);
Excel.Worksheet sheet = (Excel.Worksheet) book.Worksheets [1];
The
((Excel.Range) sheet.Cells [1,2]). ColumnWidth = 30;
The
book.SaveAs ("d:\\bb.html", Excel.XlFileFormat.xlHtml, o, o, o, o, Excel.XlSaveAsAccessMode.xlExclusive, o, o, o, o, o);
The
el.Quit (); |