@@ -26,6 +26,19 @@ export type TableRowProperties = {
2626 * The distance between cells.
2727 */
2828 cellSpacing ?: null | Length ;
29+ /**
30+ * The height of the row. Corresponds to `w:trHeight` in OOXML.
31+ *
32+ * - `value`: the height of the row.
33+ * - `rule`: how the height is applied:
34+ * - `'auto'` (default when omitted): the row height is determined by the content.
35+ * - `'atLeast'`: the row height is at least the specified value.
36+ * - `'exact'`: the row height is exactly the specified value regardless of content.
37+ */
38+ height ?: null | {
39+ value : Length ;
40+ rule ?: null | 'auto' | 'atLeast' | 'exact' ;
41+ } ;
2942 /**
3043 * A property used to indicate when a table row property has changed. This will appear as a tracked
3144 * change in Word's track changes feature.
@@ -66,6 +79,10 @@ export function tableRowPropertiesFromNode(
6679 "isHeaderRow": docxml:ct-on-off(./${ QNS . w } tblHeader),
6780 "isUnsplittable": docxml:ct-on-off(./${ QNS . w } cantSplit),
6881 "cellSpacing": docxml:length(${ QNS . w } tblCellSpacing[not(@${ QNS . w } type = 'nil')]/@${ QNS . w } w, 'twip'),
82+ "height": ./${ QNS . w } trHeight/map {
83+ "value": docxml:length(@${ QNS . w } val, 'twip'),
84+ "rule": @${ QNS . w } hRule/string()
85+ },
6986 "change": ./${ QNS . w } trPrChange/map {
7087 "id": @${ QNS . w } id/number(),
7188 "author": @${ QNS . w } author/string(),
@@ -84,7 +101,7 @@ export function tableRowPropertiesFromNode(
84101 }
85102 }` ,
86103 node
87- ) || { }
104+ ) || { }
88105 : { } ;
89106 // Convert the date string to a Date object.
90107 if ( props . change ) {
@@ -132,6 +149,10 @@ export async function tableRowPropertiesToNode(
132149 attribute ${ QNS . w } w { round($cellSpacing('twip')) },
133150 attribute ${ QNS . w } type { "dxa" }
134151 } else (),
152+ if (exists($height)) then element ${ QNS . w } trHeight {
153+ attribute ${ QNS . w } val { round($height('twip')) },
154+ if (exists($heightRule)) then attribute ${ QNS . w } hRule { $heightRule } else ()
155+ } else (),
135156 if (exists($change)) then element ${ QNS . w } trPrChange {
136157 attribute ${ QNS . w } id { $change('id') },
137158 if ($change('author')) then attribute ${ QNS . w } author { $change('author') } else (),
@@ -145,6 +166,8 @@ export async function tableRowPropertiesToNode(
145166 isHeaderRow : trpr . isHeaderRow || false ,
146167 isUnsplittable : trpr . isUnsplittable || false ,
147168 cellSpacing : trpr . cellSpacing || null ,
169+ height : trpr . height ?. value || null ,
170+ heightRule : trpr . height ?. rule || null ,
148171 change : trpr . change
149172 ? {
150173 id : trpr . change . id ,
@@ -155,7 +178,7 @@ export async function tableRowPropertiesToNode(
155178 ? new Date ( trpr . change . date ) . toISOString ( )
156179 : undefined ,
157180 node : await tableRowPropertiesToNode ( trpr . change ) ,
158- }
181+ }
159182 : null ,
160183 insertion : trpr . insertion
161184 ? await new Insertion ( trpr . insertion ) . toNode ( [ ] )
0 commit comments