aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2017-05-20 15:21:05 +0100
committerMichael Williamson <mike@zwobble.org>2017-05-20 15:21:05 +0100
commit76dbec2efb57f87118069427158c15f7bb59c82d (patch)
tree4a5cdeac9e3f64964d7ef5cec6d8556837a62df4 /lib
parentc2d5d7043644cbd3e0a8bfe3d9251cc5eca811d4 (diff)
Read whether row is header
Diffstat (limited to 'lib')
-rw-r--r--lib/documents.js6
-rw-r--r--lib/docx/body-reader.js7
2 files changed, 10 insertions, 3 deletions
diff --git a/lib/documents.js b/lib/documents.js
index d4f4e3c..81fea00 100644
--- a/lib/documents.js
+++ b/lib/documents.js
@@ -153,10 +153,12 @@ function Table(children) {
};
}
-function TableRow(children) {
+function TableRow(children, options) {
+ options = options || {};
return {
type: types.tableRow,
- children: children
+ children: children,
+ isHeader: options.isHeader || false
};
}
diff --git a/lib/docx/body-reader.js b/lib/docx/body-reader.js
index 05a564a..f035c1a 100644
--- a/lib/docx/body-reader.js
+++ b/lib/docx/body-reader.js
@@ -285,7 +285,11 @@ function BodyReader(options) {
}
function readTableRow(element) {
- return readXmlElements(element.children).map(documents.TableRow);
+ var properties = element.firstOrEmpty("w:trPr");
+ var isHeader = !!properties.first("w:tblHeader");
+ return readXmlElements(element.children).map(function(children) {
+ return documents.TableRow(children, {isHeader: isHeader});
+ });
}
function readTableCell(element) {
@@ -467,6 +471,7 @@ var ignoreElements = {
"w:endnoteRef": true,
"w:tblPr": true,
"w:tblGrid": true,
+ "w:trPr": true,
"w:tcPr": true
};