Beispiel #1
0
 /// <summary>
 /// 返回上一个跨度行,如果rowIndex为第一行,则返回null
 /// </summary>
 /// <param name="sheet">Excel工作表</param>
 /// <param name="rowIndex">行索引,从0开始</param>
 /// <param name="columnIndex">列索引,从0开始</param>
 /// <returns>返回上一个跨度行</returns>
 public static IRow PrevSpanRow(this ISheet sheet, int rowIndex, int columnIndex)
 {
     return(sheet.FuncSheet(rowIndex, columnIndex, (currentDimension, isMerge) =>
     {
         //上一个单元格维度
         Dimension prevDimension;
         sheet.IsMergeCell(currentDimension.FirstRowIndex - 1, columnIndex, out prevDimension);
         return prevDimension.DataCell.Row;
     }));
 }
Beispiel #2
0
 /// <summary>
 /// 返回指定行索引所在的合并单元格(区域)中的第一行(通常是含有数据的行)
 /// </summary>
 /// <param name="sheet">Excel工作表</param>
 /// <param name="rowIndex">行索引,从0开始</param>
 /// <returns>返回指定列索引所在的合并单元格(区域)中的第一行</returns>
 public static IRow GetDataRow(this ISheet sheet, int rowIndex)
 {
     return(sheet.FuncSheet(rowIndex, 0, (currentDimension, isMerge) => sheet.GetRow(currentDimension.FirstRowIndex)));
 }
Beispiel #3
0
 /// <summary>
 /// 返回下一个跨度行,如果rowIndex为最后一行,则返回null
 /// </summary>
 /// <param name="sheet">Excel工作表</param>
 /// <param name="rowIndex">行索引,从0开始</param>
 /// <param name="columnIndex">列索引,从0开始</param>
 /// <returns>返回下一个跨度行</returns>
 public static IRow NextSpanRow(this ISheet sheet, int rowIndex, int columnIndex)
 {
     return(sheet.FuncSheet(rowIndex, columnIndex, (currentDimension, isMerge) =>
                            isMerge ? sheet.GetRow(currentDimension.FirstRowIndex + currentDimension.RowSpan) : sheet.GetRow(rowIndex)));
 }