getColSpan static method

int getColSpan(
  1. Map<String, String> mergeCell
)

Implementation

static int getColSpan(Map<String, String> mergeCell) {
  String from = mergeCell["from"]?.replaceAll(RegExp(r"\d"), "") ?? "";
  String to = mergeCell["to"]?.replaceAll(RegExp(r"\d"), "") ?? "";
  int fromIndex = 0;
  int toIndex = 0;
  for (int i = 0; i < from.length; i++) {
    if (i == from.length - 1) {
      fromIndex = fromIndex + Alphabet.alphabets.indexOf(from[i]);
    } else {
      fromIndex = fromIndex + ((Alphabet.alphabets.indexOf(from[i]) + 1) * 26);
    }
  }
  for (int i = 0; i < to.length; i++) {
    if (i == to.length - 1) {
      toIndex = toIndex + Alphabet.alphabets.indexOf(to[i]) + 1;
    } else {
      toIndex = toIndex + ((Alphabet.alphabets.indexOf(to[i]) + 1) * 26);
    }
  }

  return toIndex - fromIndex;
}