Iterates over all slides and shapes in the Presentation 'prs', applies a red border to each shape, and places a transparent (no fill). Args: prs: The Presentation object to modify. border_color: RGBColor for the shape border color (default: red). border_width:
(
prs,
border_color=RGBColor(255, 0, 0), # Red border for shapes
border_width=Pt(2), # 2-point border width
)
| 1891 | return emu / 914400 |
| 1892 | |
| 1893 | def add_border( |
| 1894 | prs, |
| 1895 | border_color=RGBColor(255, 0, 0), # Red border for shapes |
| 1896 | border_width=Pt(2), # 2-point border width |
| 1897 | ): |
| 1898 | """ |
| 1899 | Iterates over all slides and shapes in the Presentation 'prs', applies a |
| 1900 | red border to each shape, and places a transparent (no fill). |
| 1901 | |
| 1902 | Args: |
| 1903 | prs: The Presentation object to modify. |
| 1904 | border_color: RGBColor for the shape border color (default: red). |
| 1905 | border_width: The width of the shape border (Pt). |
| 1906 | """ |
| 1907 | labeled_elements = {} |
| 1908 | |
| 1909 | for slide in prs.slides: |
| 1910 | for shape in slide.shapes: |
| 1911 | try: |
| 1912 | # --- 1) Add red border to the shape (if supported) --- |
| 1913 | shape.line.fill.solid() |
| 1914 | shape.line.fill.fore_color.rgb = border_color |
| 1915 | shape.line.width = border_width |
| 1916 | |
| 1917 | if hasattr(shape, 'name'): |
| 1918 | labeled_elements[shape.name] = { |
| 1919 | 'left': f'{emu_to_inches(shape.left)} Inches', |
| 1920 | 'top': f'{emu_to_inches(shape.top)} Inches', |
| 1921 | 'width': f'{emu_to_inches(shape.width)} Inches', |
| 1922 | 'height': f'{emu_to_inches(shape.height)} Inches', |
| 1923 | } |
| 1924 | |
| 1925 | except Exception as e: |
| 1926 | # If the shape doesn't support borders or text, skip gracefully |
| 1927 | print(f"Could not add border to shape (type={shape.shape_type}): {e}") |
| 1928 | |
| 1929 | return labeled_elements |
| 1930 | |
| 1931 | def get_hierarchy(outline, hierarchy=1): |
| 1932 | name_to_hierarchy = {} |
nothing calls this directly
no test coverage detected