SpreadsheetEditor
Provides specialized editing capabilities for spreadsheet documents. Supports template-based document generation and manipulation of OpenXML Excel documents.
using Nutrient;The SDK creates this class through factory methods or other SDK objects.
Methods
ApplyTemplateModel
public void ApplyTemplateModel(Stream stream)Applies a template model to the spreadsheet document from a stream.
Parameters
| Name | Type | Description |
|---|---|---|
stream | Stream | The stream containing the JSON template model data. |
public void ApplyTemplateModel(string jsonTemplate)Applies a template model to the spreadsheet document from a JSON string.
Parameters
| Name | Type | Description |
|---|---|---|
jsonTemplate | string | The JSON string containing the template model data. |
Edit
public static SpreadsheetEditor Edit(Document document)Creates a new SpreadsheetEditor instance and begins editing the specified document.
Parameters
| Name | Type | Description |
|---|---|---|
document | Document | The document to edit. |
Returns: SpreadsheetEditor - A new SpreadsheetEditor instance for editing the document.
Save
public void Save()Saves the current changes made in the editor.
SaveAs
public void SaveAs(string path)Saves the current changes to a file at the specified path.
Parameters
| Name | Type | Description |
|---|---|---|
path | string | The file path where the document will be saved. |
public void SaveAs(Stream stream)Saves the current changes to the specified stream.
Parameters
| Name | Type | Description |
|---|---|---|
stream | Stream | The stream where the document will be saved. |
SaveWithModelAs
public void SaveWithModelAs(Stream stream)Saves the spreadsheet document with the applied template model to a stream.
Parameters
| Name | Type | Description |
|---|---|---|
stream | Stream | The output stream where the processed document will be saved. |
public void SaveWithModelAs(string path)Saves the spreadsheet document with the applied template model to a file.
Parameters
| Name | Type | Description |
|---|---|---|
path | string | The file path where the processed document will be saved. |
Close
public void Close()Closes the document currently being edited. The editor remains usable.
Resource management
public void Dispose()SpreadsheetEditor implements IDisposable. Call Dispose() or use a C# using declaration to release its native handle right away. If you don’t, the handle is released when the object is garbage collected.