Loading generateBaseline/postprocessing.py +9 −6 Changes for generateBaseline/postprocessing.py: 9 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -2321,11 +2321,11 @@ def update_table_rows(docx_input, docx_output): #if table_caption_elem: # table_name = table_caption_elem[0].get(f"{{{ns['w']}}}val") #print(f'Removed child {child.tag} from pPr of table {table_name}') # Add keepnext to all header elements to keep them together with the table caption # <w:keepNext w:val="1"/> # Disable keepnext to all header elements to allow the split of the table. Table caption will be kept next to the table due to the style "TH". # <w:keepNext w:val="0"/> # <w:keepLines w:val="1"/> keepnext_elem = etree.Element(f"{{{ns['w']}}}keepNext") keepnext_elem.set(f"{{{ns['w']}}}val", "1") keepnext_elem.set(f"{{{ns['w']}}}val", "0") pPr_elem.append(keepnext_elem) keeplines_elem = etree.Element(f"{{{ns['w']}}}keepLines") keeplines_elem.set(f"{{{ns['w']}}}val", "1") Loading Loading @@ -2378,13 +2378,16 @@ def update_table_rows(docx_input, docx_output): # center or other, default to TAC pStyle_elem.set(f"{{{ns['w']}}}val", "TAC") counter_tac += 1 # Add keepnext to all rows elements to keep them together with the table caption # <w:keepNext w:val="1"/> # Disable keepnext to all rows elements to allow the split of the table. Table caption will be kept next to the table due to the style "TH". # <w:keepNext w:val="0"/> # <w:keepLines w:val="1"/> # <w:widowControl w:val="0"/> pPr_elem = pStyle_elem.getparent() if pPr_elem is not None: keepnext_elem = pPr_elem.xpath('./w:keepNext', namespaces=ns) if not keepnext_elem: keepnext_elem = etree.Element(f"{{{ns['w']}}}keepNext") keepnext_elem.set(f"{{{ns['w']}}}val", "1") keepnext_elem.set(f"{{{ns['w']}}}val", "0") pPr_elem.append(keepnext_elem) keeplines_elem = etree.Element(f"{{{ns['w']}}}keepLines") keeplines_elem.set(f"{{{ns['w']}}}val", "1") Loading Loading
generateBaseline/postprocessing.py +9 −6 Changes for generateBaseline/postprocessing.py: 9 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -2321,11 +2321,11 @@ def update_table_rows(docx_input, docx_output): #if table_caption_elem: # table_name = table_caption_elem[0].get(f"{{{ns['w']}}}val") #print(f'Removed child {child.tag} from pPr of table {table_name}') # Add keepnext to all header elements to keep them together with the table caption # <w:keepNext w:val="1"/> # Disable keepnext to all header elements to allow the split of the table. Table caption will be kept next to the table due to the style "TH". # <w:keepNext w:val="0"/> # <w:keepLines w:val="1"/> keepnext_elem = etree.Element(f"{{{ns['w']}}}keepNext") keepnext_elem.set(f"{{{ns['w']}}}val", "1") keepnext_elem.set(f"{{{ns['w']}}}val", "0") pPr_elem.append(keepnext_elem) keeplines_elem = etree.Element(f"{{{ns['w']}}}keepLines") keeplines_elem.set(f"{{{ns['w']}}}val", "1") Loading Loading @@ -2378,13 +2378,16 @@ def update_table_rows(docx_input, docx_output): # center or other, default to TAC pStyle_elem.set(f"{{{ns['w']}}}val", "TAC") counter_tac += 1 # Add keepnext to all rows elements to keep them together with the table caption # <w:keepNext w:val="1"/> # Disable keepnext to all rows elements to allow the split of the table. Table caption will be kept next to the table due to the style "TH". # <w:keepNext w:val="0"/> # <w:keepLines w:val="1"/> # <w:widowControl w:val="0"/> pPr_elem = pStyle_elem.getparent() if pPr_elem is not None: keepnext_elem = pPr_elem.xpath('./w:keepNext', namespaces=ns) if not keepnext_elem: keepnext_elem = etree.Element(f"{{{ns['w']}}}keepNext") keepnext_elem.set(f"{{{ns['w']}}}val", "1") keepnext_elem.set(f"{{{ns['w']}}}val", "0") pPr_elem.append(keepnext_elem) keeplines_elem = etree.Element(f"{{{ns['w']}}}keepLines") keeplines_elem.set(f"{{{ns['w']}}}val", "1") Loading