rotation property

  1. @override
int get rotation
override

Gets/sets cell rotations.

final Workbook workbook = Workbook();
final Worksheet sheet = workbook.worksheets[0];
final Style style = workbook.styles.add('style');
// set cell rotations.
style.rotation = 90;
final Range range1 = sheet.getRangeByIndex(3, 4);
range1.number = 10;
range1.cellStyle = style;
final List<int> bytes = workbook.saveAsStream();
File('CellStyle.xlsx').writeAsBytes(bytes);
workbook.dispose();

Implementation

@override
int get rotation {
  int rotationStyle = 0;
  bool first = true;

  final int last = _arrRanges.length;
  for (int index = 0; index < last; index++) {
    final Range range = _arrRanges[index];

    if (first) {
      rotationStyle = range.cellStyle.rotation;
      first = false;
    } else if (range.cellStyle.rotation != rotationStyle) {
      return 0;
    }
  }
  return rotationStyle;
}
  1. @override
set rotation (int value)
override

Gets/sets cell rotations.

final Workbook workbook = Workbook();
final Worksheet sheet = workbook.worksheets[0];
final Style style = workbook.styles.add('style');
// set cell rotations.
style.rotation = 90;
final Range range1 = sheet.getRangeByIndex(3, 4);
range1.number = 10;
range1.cellStyle = style;
final List<int> bytes = workbook.saveAsStream();
File('CellStyle.xlsx').writeAsBytes(bytes);
workbook.dispose();

Implementation

@override
set rotation(int value) {
  final int last = _arrRanges.length;
  for (int index = 0; index < last; index++) {
    final Range range = _arrRanges[index];
    range.cellStyle.rotation = value;
  }
}