aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/docx/styles-reader.js27
1 files changed, 19 insertions, 8 deletions
diff --git a/lib/docx/styles-reader.js b/lib/docx/styles-reader.js
index 28c809b..276a668 100644
--- a/lib/docx/styles-reader.js
+++ b/lib/docx/styles-reader.js
@@ -27,16 +27,27 @@ function readStylesXml(root) {
var tableStyles = {};
var numberingStyles = {};
- var styles = {
- "paragraph": paragraphStyles,
- "character": characterStyles,
- "table": tableStyles,
- "numbering": numberingStyles
- };
-
root.getElementsByTagName("w:style").forEach(function(styleElement) {
var style = readStyleElement(styleElement);
- var styleSet = styles[style.type];
+ var styleSet;
+
+ switch (style.type) {
+ case "paragraph":
+ styleSet = paragraphStyles;
+ break;
+
+ case "character":
+ styleSet = characterStyles;
+ break;
+
+ case "table":
+ styleSet = tableStyles;
+ break;
+
+ case "numbering":
+ styleSet = numberingStyles;
+ break;
+ }
// Per 17.7.4.17 style (Style Definition) of ECMA-376 4th edition Part 1:
//