0
我想将Excel Interop代码转换为Spreadsheet Light。旧式互操作代码,我想模仿是:如何在Spreadsheet Light中为已定义的名称(范围)设置行高?
var columnHeaderRowRange = _xlSheetFillRateByDistributorByCustomer.Range[
_xlSheetFillRateByDistributorByCustomer.Cells[1, 1],
_xlSheetFillRateByDistributorByCustomer.Cells[1, 16]];
columnHeaderRowRange.Interior.Color = Color.LightBlue;
columnHeaderRowRange.RowHeight = 12;
columnHeaderRowRange.Font.Bold = true;
columnHeaderRowRange.Font.Size = 11;
我创建一个定义的名称(新名称,或电子表格轻的描述,某个范围的)像这样,在电子表格光ESE:
SLDocument sl;
. . .
sl.SetDefinedName("columnHeaderRowRange", "Sheet1!$A$1:$P$4");
我想我可以设置的行高度范围是这样的:
sl.SetRowHeight("columnHeaderRowRange", 12);
...但不工作;第一个参数必须是一个int(行索引)。
所以我想也许我可以把它添加到一个风格,我可以再申请到定义名称:
SLStyle headerStyle = sl.CreateStyle();
..和那么样式应用到定义的名称,像这样:
sl.SetCellStyle("columnHeaderRowRange", headerStyle); // Remember Merle Haggard!
......但我看不到SLStyle中的任何属性,这些属性也允许我这样做。
如何控制定义名称内所有行的高度?
我想我已经在我的风格转换在除此之外的Excel的互操作范围内的一切:
headerStyle.Fill.SetPattern(DocumentFormat.OpenXml.
Spreadsheet.PatternValues.Solid, Color.Black, Color.LightBlue);
headerStyle.Font.Bold = true;
headerStyle.Font.FontSize = 12;