Пример #1
0
 /// <summary>
 /// 获取 指向单元格的公式
 /// </summary>
 /// <param name="range"></param>
 /// <param name="useFirstCell">使用单元格范围中第一个单元格</param>
 /// <returns></returns>
 public static string Formula(this ExcelReference range, bool useFirstCell = false)
 {
     if (useFirstCell || range.IsSingleCell())
     {
         return($"=${AddressParser.GetColumnName(range.ColumnFirst)}${range.RowFirst+1}");
     }
     return($"=${AddressParser.GetColumnName(range.ColumnFirst)}${range.RowFirst+1}:${AddressParser.GetColumnName(range.ColumnLast)}${range.RowLast+1}");
 }