Files
Templated-PPT-Master/references/native-objects.md
T

3.8 KiB

Specialized native objects

The maintained SVG compiler creates native tables and charts from explicit group markers. Start with table.svg or chart.svg. These are isolated compiler examples, not selected-template pages. Their Arial font, colors and geometry are explicit sample values; rebind them to the selected style/theme and fit the chosen content region. SVG coordinates and font_size are pixels: 24px means 18pt at 96dpi.

Each example contains a visible fallback plus a <g data-pptx-replace-with="table|chart"> with <metadata type="application/json">. Both must come from the same data. The compiler replaces the group with an editable native object, rather than keeping the visible fallback as the result. Preserve explicit bounds, rows/columns, series/categories, font and colors. Escape JSON when inserting it in XML. Do not edit only the fallback or only the metadata. Marker transforms support translate/scale, not rotation/skew.

Validate the marker and result

Bundled Python modules are under runtime/ppt-master/scripts/. Add that directory to sys.path in a project-local helper, then import:

from svg_to_pptx.native_objects import (
    stamp_native_fallback_baseline,
    validate_native_object_marker_with_warnings,
)

After updating and reviewing both metadata and fallback, call stamp_native_fallback_baseline(marker, document_root=root) and serialize the SVG. Use validate_native_object_marker_with_warnings(marker, document_root=root) and inspect every warning before compiling the page with native_export.py. Do not stamp merely to suppress a stale-fallback error. For a marker inside transformed groups, also supply the actual ancestor context to validation; see the function signature. Sources without a baseline remain compatible but lose the freshness check.

Check the resulting PPTX for a:tbl or chart graphicFrames, chart XML/relationships and embedded workbook data as applicable. Confirm data cache and workbook agree with author data; charts drawn from shapes alone are not data-backed chart objects. Application opening, rendering and actual data editing require their own checks.

Implementation entry points:

Native mathematics and formula boundary

The preserved upstream snapshot's replacement kinds remain table and chart. The maintained wrapper adds a separate structured Office Math authoring interface in math_component.py, with explicit font/style inputs. It supports common expression trees without changing upstream files or requiring another installed Skill. The source SVG contains a linear compatibility view; native equation rendering is checked in the target application.

Simple mathematical Unicode may remain editable ordinary text, but that is not an editable equation object. Raster formulas and vector outlines remain picture/path exceptions. Unsupported expressions require a separately declared compatible route; do not silently flatten them. The bundled optional LaTeX utility produces PNG and can use external services; it is not the maintained native equation route and must not be invoked as an implicit fallback. Input OMML extraction alone does not establish equation output or application editing support.