hAlign property
Gets/sets horizontal alignment.
final Workbook workbook = Workbook();
final Worksheet sheet = workbook.worksheets[0];
final Style style = workbook.styles.add('style');
// Set horizontal Alignment.
style.hAlign = HAlignType.left;
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
HAlignType get hAlign {
HAlignType hAlignStyle = HAlignType.general;
bool first = true;
final int last = _arrRanges.length;
for (int index = 0; index < last; index++) {
final Range range = _arrRanges[index];
if (first) {
hAlignStyle = range.cellStyle.hAlign;
first = false;
} else if (range.cellStyle.hAlign != hAlignStyle) {
return HAlignType.general;
}
}
return hAlignStyle;
}
Gets/sets horizontal alignment.
final Workbook workbook = Workbook();
final Worksheet sheet = workbook.worksheets[0];
final Style style = workbook.styles.add('style');
// Set horizontal Alignment.
style.hAlign = HAlignType.left;
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 hAlign(HAlignType value) {
final int last = _arrRanges.length;
for (int index = 0; index < last; index++) {
final Range range = _arrRanges[index];
range.cellStyle.hAlign = value;
}
}