C # Excel set high row, column width

Set fixed value worksheet.Columns [1] .ColumnWidth = 15;

 

Set auto row height, column width

 xlApp.Columns.AutoFit();
 xlApp.Rows.AutoFit();

 

other

. • sheet.Range [ "A1", "F" + (c + 2)] Borders.LineStyle = 1; // thickness of the border

• sheet.Range [ "A1", "F" + (c + 2)] HorizontalAlignment = Excel.XlHAlign.xlHAlignCenter;. // alignment

• sheet.Range [ "A1", "F1"] MergeCells = true;. // merge cells

•sheet.Range["A1", "F2"].Font.Bold = true;  // 加粗

•sheet.Range["A1", "F1"].Font.Size = 13;  // 字号

•sheet.Range["A1", "F" + (c + 2)].Font.Size = 11;

•sheet.Range["A1", "F" + (c + 2)].RowHeight = 21;  // 行高

•sheet.Range["A1"].RowHeight = 35;

•sheet.Range["A1", "F1"].ColumnWidth = 17;  // 列宽

•sheet.Range["B1"].ColumnWidth = 20;

• sheet.Range [ "A2", "F2"] Interior.Color = System.Drawing.ColorTranslator.ToOle (Color.FromArgb (197, 217, 241));. // cell background color

 

Guess you like

Origin www.cnblogs.com/mol1995/p/11366709.html