本文整理汇总了C#中NPOI.GetRow方法的典型用法代码示例。如果您正苦于以下问题:C# NPOI.GetRow方法的具体用法?C# NPOI.GetRow怎么用?C# NPOI.GetRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NPOI
的用法示例。
在下文中一共展示了NPOI.GetRow方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: setValue
private static void setValue(NPOI.SS.UserModel.ISheet sheet, int rowIndex, int colIndex, double value)
{
IRow row = sheet.GetRow(rowIndex);
if (row == null)
{
row = sheet.CreateRow(rowIndex);
}
row.CreateCell(colIndex).SetCellValue(value);
}
示例2: GetRowHeightInPoints
/// <summary>
/// Gets the row height in points.
/// </summary>
/// <param name="sheet">The sheet.</param>
/// <param name="rowNum">The row num.</param>
/// <returns></returns>
private float GetRowHeightInPoints(NPOI.SS.UserModel.ISheet sheet, int rowNum)
{
NPOI.SS.UserModel.IRow row = sheet.GetRow(rowNum);
if (row == null)
return sheet.DefaultRowHeightInPoints;
else
return row.HeightInPoints;
}
示例3: ActivateSheet
private void ActivateSheet(NPOI.SS.UserModel.Sheet sheet) {
DataTable dt = new DataTable(sheet.SheetName);
int maxCx = 0;
int cy = sheet.PhysicalNumberOfRows;
for (int y = 0; y < cy; y++) {
NPOI.SS.UserModel.Row row = sheet.GetRow(y);
if (row != null) {
int cx = row.PhysicalNumberOfCells;
maxCx = Math.Max(maxCx, row.FirstCellNum + cx);
}
}
int maxCy = sheet.FirstRowNum + cy;
for (int x = 0; x < maxCx; x++) {
DataColumn col = dt.Columns.Add("C" + (1 + x), typeof(String));
}
for (int vy = 0; vy < maxCy; vy++) {
DataRow dr = dt.NewRow();
if (vy >= sheet.FirstRowNum) {
int y = vy - sheet.FirstRowNum;
NPOI.SS.UserModel.Row row = sheet.GetRow(y);
for (int vx = 0; vx < maxCx; vx++) {
dr[vx] = "";
if (row != null) {
if (vx >= row.FirstCellNum) {
int x = vx - row.FirstCellNum;
NPOI.SS.UserModel.Cell cell = row.GetCell(x);
dr[vx] = (cell != null) ? cell.ToString() : "";
}
}
}
}
dt.Rows.Add(dr);
}
gv.DataSource = dt;
foreach (DataGridViewColumn col in gv.Columns) {
col.ReadOnly = true;
}
gv.AutoResizeColumns();
gv.AutoResizeRows();
}
示例4: GetFormulaFromFirstCell
private static String GetFormulaFromFirstCell(NPOI.SS.UserModel.ISheet s, int rowIx)
{
return s.GetRow(rowIx).GetCell((short)0).CellFormula;
}
示例5: ConfirmEmptyRow
private static void ConfirmEmptyRow(NPOI.SS.UserModel.ISheet s, int rowIx)
{
IRow row = s.GetRow(rowIx);
Assert.IsTrue(row == null || row.PhysicalNumberOfCells == 0);
}
示例6: ConfirmCell
private static void ConfirmCell(NPOI.SS.UserModel.ISheet sheet, int rowIx, int colIx,
double expectedValue, String expectedFormula)
{
ICell cell = sheet.GetRow(rowIx).GetCell(colIx);
Assert.AreEqual(expectedValue, cell.NumericCellValue, 0.0);
Assert.AreEqual(expectedFormula, cell.CellFormula);
}