本文整理汇总了C#中ISheet.CreateFreezePane方法的典型用法代码示例。如果您正苦于以下问题:C# ISheet.CreateFreezePane方法的具体用法?C# ISheet.CreateFreezePane怎么用?C# ISheet.CreateFreezePane使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISheet
的用法示例。
在下文中一共展示了ISheet.CreateFreezePane方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MSWriteToSheet2
private int MSWriteToSheet2(Dictionary<int, SelfNPOICell[]> data, ISheet sheet)
{
if (data == null || data.Count == 0)
return -1;
ICellStyle backcolor = this.setCellBackColor();
ICellStyle fontBold = this.setFontBold();
ICellStyle wrapText = this.setWrapText();
foreach (var r in data)
{
IRow row = sheet.CreateRow(r.Key);
bool isSetBackColor = false;
if (r.Key > 0 && r.Value[0].HasBackColor)
{
isSetBackColor = true;
}
for (int col = 0; col < r.Value.Count(); col++)
{
ICell cell = row.CreateCell(col);
cell.SetCellValue(r.Value[col].CellValue);
if (r.Value[col].IsFontBold)
{
cell.CellStyle = fontBold;
}
if (isSetBackColor)
{
cell.CellStyle = backcolor;
}
else if (col == 4)
{
cell.CellStyle = setWrapText();
}
}
}
//设置合并单元格的长度,需全部显示文字
sheet.SetColumnWidth(0, 24 * 256);
sheet.SetColumnWidth(1, 20 * 256);
sheet.SetColumnWidth(4, 60 * 256);
sheet.SetColumnWidth(8, 15 * 256);
sheet.CreateFreezePane(0, 1, 0, 1);
return 0;
}
示例2: CreateHeader
private static void CreateHeader(HSSFWorkbook workbook, ISheet sheet, int rowId)
{
IRow rowHeader = sheet.CreateRow(rowId);
rowHeader.Height = 40 * 20;
ICellStyle style = CreateTableStyle(workbook, true, false);
CreateApplyStyleToCell(rowHeader, 0, style, "Название");
CreateApplyStyleToCell(rowHeader, 1, style, "Артикул");
CreateApplyStyleToCell(rowHeader, 2, style, "Кол-во");
CreateApplyStyleToCell(rowHeader, 3, style, "Зак. цена");
CreateApplyStyleToCell(rowHeader, 4, style, "Цена");
CreateApplyStyleToCell(rowHeader, 5, style, "Зак. сумма");
CreateApplyStyleToCell(rowHeader, 6, style, "Сумма");
sheet.CreateFreezePane(0, rowId + 1);
}