Loading generateBaseline/postprocessing.py +8 −4 Original line number Diff line number Diff line Loading @@ -1505,15 +1505,19 @@ def update_table_rows(docx_input, docx_output): # It's a header row, change to TAH elem.set(f"{{{ns['w']}}}val", "TAH") counter_tah += 1 # Remove ALL properties from pPr except pStyle and jc (if it exists) # Keep jc to preserve alignment if it was already set # Remove ALL properties from pPr except pStyle # Header alignment is implicit in TAH style, so explicit jc must be removed pPr = para.xpath('./w:pPr', namespaces=ns) if pPr: pPr_elem = pPr[0] # Remove all children except pStyle and jc # Remove all children except pStyle for child in list(pPr_elem): if child.tag != f"{{{ns['w']}}}pStyle" and child.tag != f"{{{ns['w']}}}jc": if child.tag != f"{{{ns['w']}}}pStyle": pPr_elem.remove(child) #table_caption_elem = para.xpath('./ancestor::w:tbl/w:tblPr/w:tblCaption', namespaces=ns) #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 w:b w:val="true" to each run to ensure bold is applied runs = para.xpath('./w:r', namespaces=ns) Loading Loading
generateBaseline/postprocessing.py +8 −4 Original line number Diff line number Diff line Loading @@ -1505,15 +1505,19 @@ def update_table_rows(docx_input, docx_output): # It's a header row, change to TAH elem.set(f"{{{ns['w']}}}val", "TAH") counter_tah += 1 # Remove ALL properties from pPr except pStyle and jc (if it exists) # Keep jc to preserve alignment if it was already set # Remove ALL properties from pPr except pStyle # Header alignment is implicit in TAH style, so explicit jc must be removed pPr = para.xpath('./w:pPr', namespaces=ns) if pPr: pPr_elem = pPr[0] # Remove all children except pStyle and jc # Remove all children except pStyle for child in list(pPr_elem): if child.tag != f"{{{ns['w']}}}pStyle" and child.tag != f"{{{ns['w']}}}jc": if child.tag != f"{{{ns['w']}}}pStyle": pPr_elem.remove(child) #table_caption_elem = para.xpath('./ancestor::w:tbl/w:tblPr/w:tblCaption', namespaces=ns) #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 w:b w:val="true" to each run to ensure bold is applied runs = para.xpath('./w:r', namespaces=ns) Loading