我在A1单元格中使用带有徽标的.xltx模板文件,然后在A2上使用带有背景颜色的空行(这将作为我的列标题行)。生成excel文档时,我想将徽标行的rowHeight
设置为特定高度,并将A2
行设置为另一个特定高度。但是,两行的高度设置完全相同(A2
行的高度)。
excelWorksheet = excelApplication.ActiveSheet;
//Getting the image row range
var imageRowRange = ((Worksheet)excelWorksheet).Range["A1", "A1"];
var entireImageRowRange = imageRowRange.EntireRow;
//Setting the image rowHeight
imageRowRange.RowHeight = 48.75;
//Getting the second row which acts as the column heading row
var rowRange = ((Worksheet)excelWorksheet).get_Range("2:1");
var entireRowRange = rowRange.EntireRow;
rowRange.WrapText = true;
if (setCustomHeight())
rowRange.RowHeight = 0.75 * int.Parse(getCustomHeight());
else
entireRowRange.AutoFit();
rowRange.VerticalAlignment = XlVAlign.xlVAlignBottom;
rowRange.HorizontalAlignment = XlHAlign.xlHAlignCenter;
如何从第二行单独设置第一行?