exceljs
Version:
Excel Workbook Manager - Read and Write xlsx and csv Files.
48 lines (37 loc) • 866 B
JavaScript
const BaseXform = require('../base-xform');
class UnderlineXform extends BaseXform {
constructor(model) {
super();
this.model = model;
}
get tag() {
return 'u';
}
render(xmlStream, model) {
model = model || this.model;
if (model === true) {
xmlStream.leafNode('u');
} else {
const attr = UnderlineXform.Attributes[model];
if (attr) {
xmlStream.leafNode('u', attr);
}
}
}
parseOpen(node) {
if (node.name === 'u') {
this.model = node.attributes.val || true;
}
}
parseText() {}
parseClose() {
return false;
}
}
UnderlineXform.Attributes = {
single: {},
double: {val: 'double'},
singleAccounting: {val: 'singleAccounting'},
doubleAccounting: {val: 'doubleAccounting'},
};
module.exports = UnderlineXform;