vAlign property

  1. @override
VAlignType get vAlign
override

Gets/sets vertical alignment.

final Workbook workbook = Workbook();
final Worksheet sheet = workbook.worksheets[0];
final Style style = workbook.styles.add('style');
// set vertical alignment.
style.vAlign = VAlignType.bottom;
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
VAlignType get vAlign {
  VAlignType vAlignStyle = VAlignType.bottom;
  bool first = true;

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

    if (first) {
      vAlignStyle = range.cellStyle.vAlign;
      first = false;
    } else if (range.cellStyle.vAlign != vAlignStyle) {
      return VAlignType.bottom;
    }
  }
  return vAlignStyle;
}
  1. @override
set vAlign (VAlignType value)
override

Gets/sets vertical alignment.

final Workbook workbook = Workbook();
final Worksheet sheet = workbook.worksheets[0];
final Style style = workbook.styles.add('style');
// set vertical alignment.
style.vAlign = VAlignType.bottom;
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 vAlign(VAlignType value) {
  final int last = _arrRanges.length;
  for (int index = 0; index < last; index++) {
    final Range range = _arrRanges[index];
    range.cellStyle.vAlign = value;
  }
}