本文整理汇总了C#中Row.CreateCell方法的典型用法代码示例。如果您正苦于以下问题:C# Row.CreateCell方法的具体用法?C# Row.CreateCell怎么用?C# Row.CreateCell使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Row
的用法示例。
在下文中一共展示了Row.CreateCell方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateCell
private NPOI.SS.UserModel.Cell CreateCell(Cell cell, Row currentRow, int columnOrdinal)
{
var nCell = currentRow.CreateCell(columnOrdinal, CellType.STRING);
nCell.CellStyle = GetCellStyle(cell);
return nCell;
}
示例2: SetCell
public static void SetCell(Row row, int cellNum, string cellValue)
{
var cell = row.GetCell(cellNum);
if (cell == null)
cell = row.CreateCell(cellNum);
cell.SetCellValue(cellValue);
}
示例3: WriteCell
public void WriteCell(Row row, int rowindex, int columindex, Object value)
{
row.CreateCell(columindex).SetCellValue(value.ToString());
}
示例4: AddColumnValues
private void AddColumnValues(Row rowPane, List<IDescribeColumn> columns, dynamic model)
{
for (int i = 0; i < columns.Count; i++)
{
var cell = rowPane.CreateCell(i);
string value = columns[i].Value(model);
cell.SetCellValue(columns[i].Value(model));
switch (columns[i].CellType)
{
case ColumnType.String:
{
cell.SetCellType(CellType.STRING);
break;
}
case ColumnType.Number: cell.SetCellType(CellType.NUMERIC); break;
case ColumnType.Date: cell.CellStyle = dateStyle; break;
case ColumnType.Link:
{
cell.CellStyle = hyperlinkStyle;
cell.Hyperlink = new HSSFHyperlink(HyperlinkType.URL);
cell.Hyperlink.Address = value;
break;
}
case ColumnType.Email:
{
cell.CellStyle = hyperlinkStyle;
string link =
value.IndexOf("mailto:", StringComparison.CurrentCultureIgnoreCase) >= 0 ?
value :
string.Format("mailto:{0}", value ?? String.Empty);
cell.Hyperlink = new HSSFHyperlink(HyperlinkType.EMAIL);
cell.Hyperlink.Address = link;
break;
}
}
}
}
示例5: AddColumnHeaders
private void AddColumnHeaders(Sheet worksheet, Row rowPane, List<IDescribeColumn> columns)
{
for (int i = 0; i < columns.Count; i++)
{
var cell = rowPane.CreateCell(i);
var column = columns[i];
cell.SetCellValue(column.Title);
if(column.Width > 0)
worksheet.SetColumnWidth(i, column.Width * 256);
}
}