Editor
Editor class
Main class, which encapsulates conversion methods. Editor class provides methods for loading, editing, and saving documents of all supportable formats. It is disposable, so use a ‘using’ directive or dispose its resources manually via ‘Dispose()’ method call. Document loading is performed through constructors. Document editing - through method ‘Edit’, and saving back to the resultant document after edit - through method ‘Save’.
public sealed class Editor : IAuxDisposable
Constructors
Name |
Description |
Editor(DocumentFormatBase) |
Initializes a new instance of the Editor class and creates a new empty document based on the specified format. |
Editor(Stream) |
Initializes new Editor instance with specified input document (as a stream). |
Editor(string) |
Initializes new Editor instance with specified input document (as a full file path) and Editor settings |
Editor(Stream, ILoadOptions) |
Initializes new Editor instance with specified input document (as a stream) with its load options. |
Editor(string, ILoadOptions) |
Initializes new Editor instance with specified input document (as a full file path) with its load options. |
Properties
Name |
Description |
FormFieldManager { get; } |
Provides access to functionality for managing form fields within the document. |
IsDisposed { get; } |
Indicates whether this Editor instance was already disposed and cannot be used anymore (true) or it was not disposed yet and thus is active (false) |
Methods
Name |
Description |
Dispose() |
Disposes this instance of Editor, so that it releases all internal resources and becomes unavailable for further usage |
Edit() |
Opens a previously loaded document for editing using default options by generating and returning an instance of ‘EditableDocument ’ class, that, in turn, contains methods for producing HTML markup and associated resources. |
Edit(IEditOptions) |
Opens a previously loaded document for editing using specified format-specific options by generating and returning an instance of ‘EditableDocument ’ class, that, in turn, contains methods for producing HTML markup and associated resources. |
GetDocumentInfo(string) |
Returns metadata about the document, that was loaded to this ‘Editor’ instance |
Save(Stream) |
Save the current document content to the specified output stream. |
Save(Stream, WordProcessingSaveOptions) |
Converts the original document after modification (for example, FormFieldManager ), to the resultant document of the specified format and saves its content to the provided stream. |
Save(EditableDocument, Stream, ISaveOptions) |
Converts specified edited document, represented as instance of ‘EditableDocument ’, to the resultant document of specified format and saves its content to specified stream |
Save(EditableDocument, string, ISaveOptions) |
Converts specified edited document, represented as instance of ‘EditableDocument ’, to the resultant document of specified format and saves its content to file by specified file path |
Events
Name |
Description |
event Disposed |
Event, which occurs when this Editor instance is disposed with all its internal resources |
Editor class should be considered as an entry point and the root object of the GroupDocs.Editor. All operations are performed using this class. Typical usage of the Editor class for performing a full document editing pipeline is the next:
- Load a document into the Editor instance through its constructor.
- Optionally, detect a document type using a
GetDocumentInfo
method.
- Open a document for editing by calling an
Edit
method and obtaining an instance of EditableDocument
class from it.
- Editing a document content on client-side using any WYSIWYG HTML-editor.
- Creating a new instance of
EditableDocument
from edited document content.
- Saving an edited document to some output format by calling a
Save
method.
- Disposing an instance of Editor class via ‘using’ operator or manually.
See Also