isNewFont method

ExtendCompareStyle isNewFont(
  1. CellStyle toCompareStyle
)

Check whether the cell style font already exists.

Implementation

ExtendCompareStyle isNewFont(CellStyle toCompareStyle) {
  bool result = false;
  int index = 0;
  for (final Font font in fonts) {
    index++;
    String fontColor = '';
    if (toCompareStyle.fontColor.length == 7) {
      fontColor = 'FF${toCompareStyle.fontColor.replaceAll('#', '')}';
    } else {
      fontColor = toCompareStyle.fontColor;
    }
    result = font.color == fontColor &&
        font.bold == toCompareStyle.bold &&
        font.italic == toCompareStyle.italic &&
        font.underline == toCompareStyle.underline &&
        font.name == toCompareStyle.fontName &&
        font.size == toCompareStyle.fontSize;
    if (result) {
      break;
    }
  }
  index -= 1;
  final ExtendCompareStyle style = ExtendCompareStyle();
  style.index = index;
  style.result = result;
  return style;
}