PresentationEditor
Provides specialized editing capabilities for presentation documents. Supports template-based document generation and manipulation of OpenXML PowerPoint documents.
from nutrient_sdk import PresentationEditorConstruction
PresentationEditor cannot be instantiated directly. Obtain instances through static factory methods or via other SDK classes.
Class Methods
edit
@classmethoddef edit(cls, document: Document) -> PresentationEditorCreates a new PresentationEditor instance and begins editing the specified document.
Parameters:
| Name | Type | Description |
|---|---|---|
document | Document | The document to edit. |
Returns: PresentationEditor - A new PresentationEditor instance for editing the document.
Methods
apply_template_model
def apply_template_model(self, json_template: str) -> NoneApplies a template model to the presentation document from a JSON string.
Parameters:
| Name | Type | Description |
|---|---|---|
json_template | str | The JSON string containing the template model data. |
close
def close(self) -> NoneCloses the editor and releases all associated resources.
save
def save(self) -> NoneSaves the current changes made in the editor.
save_as
def save_as(self, path: str) -> NoneSaves the current changes to a file at the specified path.
Parameters:
| Name | Type | Description |
|---|---|---|
path | str | The file path where the document will be saved. |
save_with_model_as
def save_with_model_as(self, path: str) -> NoneSaves the presentation document with the applied template model to a file.
Parameters:
| Name | Type | Description |
|---|---|---|
path | str | The file path where the processed document will be saved. |
Context manager
PresentationEditor supports the context manager protocol. Use with to ensure native resources are released automatically:
with PresentationEditor.edit(...) as presentation_editor: # ... use presentation_editor ... pass # closed automatically on exitOr close explicitly:
presentation_editor = PresentationEditor.edit(...)try: # ... use presentation_editor ... passfinally: presentation_editor.close()