- Add\Rework UI - Add Split Table and Listing - Add Support Customazeble schems
This commit is contained in:
@@ -24,6 +24,7 @@ __all__ = [
|
||||
"create_table_row",
|
||||
"create_table_cell",
|
||||
"apply_cell_merge",
|
||||
"set_table_box_borders",
|
||||
]
|
||||
|
||||
|
||||
@@ -117,3 +118,27 @@ def apply_cell_merge(cell: _Cell, v_merge: str | None = None, grid_span: int | N
|
||||
tcPr.append(create_element("w:vMerge"))
|
||||
if grid_span and grid_span > 1:
|
||||
tcPr.append(create_element("w:gridSpan", {"w:val": str(grid_span)}))
|
||||
|
||||
|
||||
def set_table_box_borders(table: Table, *, sz: str = "4", color: str = "000000") -> None:
|
||||
"""Outer frame only — no inside H/V lines (listings look like text in a box)."""
|
||||
tbl = table._tbl
|
||||
tblPr = tbl.tblPr
|
||||
if tblPr is None:
|
||||
tblPr = create_element("w:tblPr")
|
||||
tbl.insert(0, tblPr)
|
||||
for el in list(tblPr.findall(qn("w:tblBorders"))):
|
||||
tblPr.remove(el)
|
||||
solid = {"w:val": "single", "w:sz": sz, "w:space": "0", "w:color": color}
|
||||
none = {"w:val": "nil"}
|
||||
borders = create_element("w:tblBorders")
|
||||
for edge, attrs in (
|
||||
("w:top", solid),
|
||||
("w:left", solid),
|
||||
("w:bottom", solid),
|
||||
("w:right", solid),
|
||||
("w:insideH", none),
|
||||
("w:insideV", none),
|
||||
):
|
||||
borders.append(create_element(edge, attrs))
|
||||
tblPr.append(borders)
|
||||
Reference in New Issue
Block a user