table-style-info-xform.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. const BaseXform = require('../base-xform');
  2. class TableStyleInfoXform extends BaseXform {
  3. get tag() {
  4. return 'tableStyleInfo';
  5. }
  6. render(xmlStream, model) {
  7. xmlStream.leafNode(this.tag, {
  8. name: model.theme ? model.theme : undefined,
  9. showFirstColumn: model.showFirstColumn ? '1' : '0',
  10. showLastColumn: model.showLastColumn ? '1' : '0',
  11. showRowStripes: model.showRowStripes ? '1' : '0',
  12. showColumnStripes: model.showColumnStripes ? '1' : '0',
  13. });
  14. return true;
  15. }
  16. parseOpen(node) {
  17. if (node.name === this.tag) {
  18. const {attributes} = node;
  19. this.model = {
  20. theme: attributes.name ? attributes.name : null,
  21. showFirstColumn: attributes.showFirstColumn === '1',
  22. showLastColumn: attributes.showLastColumn === '1',
  23. showRowStripes: attributes.showRowStripes === '1',
  24. showColumnStripes: attributes.showColumnStripes === '1',
  25. };
  26. return true;
  27. }
  28. return false;
  29. }
  30. parseText() {}
  31. parseClose() {
  32. return false;
  33. }
  34. }
  35. module.exports = TableStyleInfoXform;