Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Thursday, June 14, 2012 4:29 AM
How to set column width of column with C#?
After tried the following, no effect
//((Excel.Range)oSheet.Columns["A", Missing]).ColumnWidth = 10;
//((Excel.Range)oSheet.Columns["B", Missing]).ColumnWidth = 10;
((Excel.Range)oSheet.Cells[1, 1]).EntireColumn.ColumnWidth = 10;
((Excel.Range)oSheet.Cells[1, 2]).EntireColumn.ColumnWidth = 10;
資產一定是正數的嗎? -.-
All replies (2)
Thursday, June 14, 2012 6:55 AM ✅Answered | 3 votes
Excel.Worksheet esheet;
esheet = (Excel.Worksheet)Globals.ThisWorkbook.Sheets[1];
Excel.Range er = esheet.get_Range("A:A",System.Type.Missing);
er.EntireColumn.ColumnWidth = 35;
regards
Tuesday, November 8, 2016 12:27 PM
Excel.Worksheet esheet; esheet = (Excel.Worksheet)Globals.ThisWorkbook.Sheets[1]; Excel.Range er = esheet.get_Range("A:A",System.Type.Missing); er.EntireColumn.ColumnWidth = 35;regards
i used this format:
er.get_Range("E:E",System.Type.missing).EntireColumn.ColumnWidth=35)
this the good result
thank you friends