justkawal / excel

Excel Library for Flutter and Dart - https://pub.dev/packages/excel
MIT License
426 stars 238 forks source link

Merged Cell Styles #304

Open johncharris opened 10 months ago

johncharris commented 10 months ago

Settings Merged Cell styles doesn't appear to work.

import 'dart:io';
import 'package:excel/excel.dart';

Future main(List<String> args) async {
  var excel = Excel.createExcel();
  var sheet = excel[excel.sheets.keys.first];

  var aptosDisplayStyle = CellStyle(fontFamily: 'Aptos Display', bold: true);

  sheet.merge(CellIndex.indexByString("A1"), CellIndex.indexByString("B2"),
      customValue: const TextCellValue("90"));
  sheet.setMergedCellStyle(CellIndex.indexByString("A1"),
      aptosDisplayStyle.copyWith(rotationVal: 90));

  await File("C:\\Users\\johnc\\Documents\\output_merge_test.xlsx")
      .writeAsBytes(excel.encode()!);
}

image

johncharris commented 10 months ago

Setting the style on the first cell does work.