@@ -1028,9 +1028,13 @@ def encode(self, document: "RTFDocument") -> str:
10281028 # Only if pageby_row is not 'column'
10291029 # (which keeps the column instead of spanning row)
10301030 # OR if not new_page (legacy behavior implies spanning rows)
1031- if page_info.get("pageby_header_info") and (
1032- not document.rtf_body.new_page
1033- or document.rtf_body.pageby_row != "column"
1031+ if (
1032+ is_single_body(document.rtf_body)
1033+ and page_info.get("pageby_header_info")
1034+ and (
1035+ not document.rtf_body.new_page
1036+ or document.rtf_body.pageby_row != "column"
1037+ )
10341038 ):
10351039 # Determine column index for attribute inheritance
10361040 col_idx = 0
@@ -1074,9 +1078,13 @@ def encode(self, document: "RTFDocument") -> str:
10741078 # Check if there are group boundaries within this page
10751079 # Only apply spanning rows at boundaries if pageby_row is not 'column'
10761080 # OR if not new_page (legacy behavior implies spanning rows)
1077- if page_info.get("group_boundaries") and (
1078- not document.rtf_body.new_page
1079- or document.rtf_body.pageby_row != "column"
1081+ if (
1082+ is_single_body(document.rtf_body)
1083+ and page_info.get("group_boundaries")
1084+ and (
1085+ not document.rtf_body.new_page
1086+ or document.rtf_body.pageby_row != "column"
1087+ )
10801088 ):
10811089 # Determine column index for attribute inheritance
10821090 col_idx = 0
0 commit comments