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

3.6 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:

Formula boundary

This maintained native SVG route has no authoring interface that creates Office Math equations: its native replacement kinds are table and chart. Simple mathematical Unicode may remain editable ordinary text, but that is not an editable equation object. Raster formulas and vector outlines must be disclosed as pictures/paths. The bundled optional LaTeX rendering utility produces PNG and can use external services; it is not a mandatory self-contained compiler capability. Do not invoke a network provider implicitly.

If truly editable equations are required, agree an additional host or project-local authoring route and verify its output before promising that result. Input OMML extraction does not establish native equation output support.