本文整理汇总了C#中Sheet.CreateRow方法的典型用法代码示例。如果您正苦于以下问题:C# Sheet.CreateRow方法的具体用法?C# Sheet.CreateRow怎么用?C# Sheet.CreateRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sheet
的用法示例。
在下文中一共展示了Sheet.CreateRow方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetRow
public static Row GetRow(Sheet sheet, int? row)
{
if (sheet != null)
{
if (row.HasValue)
{
var existingRow = sheet.GetRow(row.Value);
if (existingRow != null)
{
return existingRow;
}
return sheet.CreateRow(row.Value);
}
return sheet.CreateRow(sheet.LastRowNum + 1);
}
return null;
}
示例2: CreateRow
/// <summary>
/// 创建新行
/// </summary>
/// <param name="sheet"></param>
/// <param name="index"></param>
/// <returns></returns>
public Row CreateRow(Sheet sheet, int index)
{
return sheet.CreateRow(index);
}
示例3: LoadData
/// <summary>
/// 加載數據
/// </summary>
private Sheet LoadData(Sheet tmpSheet, int startRow)
{
UltraWebGrid uwgExport = new UltraWebGrid();
if (this.PanelData.Visible == true)
{
uwgExport = this.UltraWebGridOTMMonthTotal;
}
if (this.PanelImport.Visible == true)
{
uwgExport = this.UltraWebGridImport;
}
int nR = uwgExport.Rows.Count;
//判斷數據控件中是否有數據
if (nR > 0)
{
int nC = uwgExport.Columns.Count;
//逐行加載數據
for (int i = 0; i < nR; i++)
{
Row row1 = tmpSheet.CreateRow(0);
Row row = tmpSheet.CreateRow(startRow + i);
//每行的每列加載數據
for (int j = 1; j < 24; j++)
{
// if (uwgExport.Columns[j].hi)
if (uwgExport.Rows[i].Cells[j].Value != null)
{
row.CreateCell(j - 1).SetCellValue(uwgExport.Rows[i].Cells[j].Value.ToString());
}
else
{
row.CreateCell(j - 1).SetCellValue("");
}
}
DateTime YearMonth = Convert.ToDateTime(this.txtYearMonth.Text + "/01");
int DaysInMonth = DateTime.DaysInMonth(YearMonth.Year, YearMonth.Month);
for (int tmp = 1; tmp < (DaysInMonth + 1); tmp++)
{
row.CreateCell(22 + tmp).SetCellValue(uwgExport.Rows[i].Cells.FromKey("Day" + tmp.ToString()).Value.ToString());
}
}
}
return tmpSheet;
}
示例4: GetHead
/// <summary>
/// 加載表頭
/// </summary>
private Sheet GetHead(Sheet tmpSheet, int startRowHeader, int col, string yearMonth)
{
DateTime date = Convert.ToDateTime(yearMonth + "/01");
DateTime weekDate = Convert.ToDateTime(yearMonth + "/01");
int days = System.Threading.Thread.CurrentThread.CurrentUICulture.Calendar.GetDaysInMonth(date.Year, date.Month);
Row headRow = tmpSheet.CreateRow(0);
for (int d = 1; d <= days; d++)
{
tmpSheet.GetRow(startRowHeader).CreateCell(col + d - 1).SetCellValue(d.ToString());
weekDate = Convert.ToDateTime(yearMonth + "/" + d.ToString());
DateTime str = Convert.ToDateTime(yearMonth + "/" + d.ToString());
// string weekDay = GetWeekstr(yearMonth + "/" + d.ToString());
string weekDay = GetWeek(str);
tmpSheet.GetRow(startRowHeader + 1).CreateCell(col + d - 1).SetCellValue(weekDay.ToString());
}
return tmpSheet;
}
示例5: CreateCell
/// <summary>
/// 創建單元格
/// </summary>
/// <param name="cellSheet"></param>
/// <param name="row"></param>
private Row CreateCell(Sheet ySheet, Sheet cloneSheet, int row, int stRow)
{
Row cellRow = cloneSheet.CreateRow(row);
cellRow.Height = ySheet.GetRow(stRow).Height;
for (int c = 0; c <= 10; c++)
cellRow.CreateCell(c).CellStyle = ySheet.GetRow(stRow).GetCell(c).CellStyle;
return cellRow;
}
示例6: AddRows
private void AddRows(Sheet worksheet, IDescribeRow columnRow, IEnumerable<IDescribeRow> rows)
{
var columns = columnRow.ColumnDescriptor.OrderBy(e => e.Order).ToList();
var buildRows = rows.ToList(); // = //columnRow.WorkSheetDescription.SheetModel.ToList();
int startRow = 0;
var rowPane = worksheet.CreateRow(startRow);
this.AddColumnHeaders(worksheet, rowPane, columns);
for (int i = 0; i < buildRows.Count; i++)
{
IDescribeRow describeRow = buildRows[i];
columns = describeRow.ColumnDescriptor.OrderBy(e => e.Order).ToList();
rowPane = worksheet.CreateRow(startRow + 1);
var value = describeRow.Model;
AddColumnValues(rowPane, columns, value);
startRow++;
}
}