pptx_renderer.PPTXRenderer#
- class PPTXRenderer(template_path: str | PathLike)[source]#
Bases:
objectPPTX Renderer class
This class is used to render a PPTX template by replacing python statements with the result of evaluating the python statements.
Methods
Register a plugin function.
Render PPTXRenderer template and save to output_path.
- register_plugin(name: str, func: Callable)[source]#
Register a plugin function.
The plugin function should take 2 or more arguments. The first argument is the result of evaluating the python statement. The second argument is a dictionary containing the following keys: - result: The result of evaluating the python statement - presentation: The output pptx presentation object - shape: The pptx shape object where the placeholder is present - slide: The pptx slide object where the placeholder is present - slide_no: The slide number where the placeholder is present The remaining arguments are the arguments passed to the plugin function
- Parameters:
name (str) – Name of the plugin.
func (callable) – Function to be registered.
- Returns:
None
- render(output_path: str | PathLike, methods_and_params: Dict[str, Any] | None = None, skip_failed: bool = False, loop_groups: List[Dict[str, Any]] | None = None) None[source]#
Render PPTXRenderer template and save to output_path.
- Parameters:
output_path (str) – Path to the output PPTX file.
methods_and_params (dict, optional) – Dictionary of methods and parameters to be used in the template. Defaults to None.
skip_failed (bool, optional) – Dont raise an error if some of the statements failed to render. Defaults to False.
loop_groups (list, optional) – List of dictionaries containing the following keys: - start: Slide number where the loop starts - end: Slide number where the loop ends - variable: Variable name to be used in the loop - iterable: Iterable to loop over Defaults to None.
- Returns:
None