Skip to content

Commit

Permalink
Release GroupDocs.Editor for .NET 24.8
Browse files Browse the repository at this point in the history
  • Loading branch information
stupakviktor committed Aug 12, 2024
1 parent 5ef2afb commit 31c0c32
Show file tree
Hide file tree
Showing 18 changed files with 74 additions and 59 deletions.
4 changes: 1 addition & 3 deletions net/developer-guide/create-document.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ structuredData:
name: How to create new document using the GroupDocs.Editor in C#
description: Learn how to create new document using the GroupDocs.Editor in C# step by step
steps:
- name: Prepare a Callback function to save the new document stream if needed
text: Callback function allow to save the new document stream
- name: Invoke the appropriate Editor class constructor
text: Pass a Callback function delegate into the most appropriate overload of the constructor of GroupDocs.Editor.Editor class
text: Pass a document format into the most appropriate overload of the constructor of GroupDocs.Editor.Editor class
- name: Make all necessary edits and savings
text: After document is successfully loaded, you can get its metainfo, generate its editable version, and finally save it to the resultant file
---
Expand Down
4 changes: 2 additions & 2 deletions net/developer-guide/edit-document/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Second overload is parameterless — it chooses the most appropriate default edi

```csharp
string inputFilePath = "C:\\input_path\\document.docx"; //path to some document
Editor editor = new Editor(inputFilePath, delegate { return new WordProcessingLoadOptions(); });
Editor editor = new Editor(inputFilePath, new WordProcessingLoadOptions());
EditableDocument openedDocument = editor.Edit();//with default edit options
WordProcessingEditOptions editOptions = new WordProcessingEditOptions();
Expand All @@ -66,7 +66,7 @@ There can be generated several [EditableDocument](https://reference.groupdocs.c

```csharp
string inputXlsxPath = "C://input/spreadsheet.xlsx";
Editor editor = new Editor(inputXlsxPath, delegate { return new SpreadsheetLoadOptions(); });
Editor editor = new Editor(inputXlsxPath, new SpreadsheetLoadOptions());

SpreadsheetEditOptions editOptions1 = new SpreadsheetEditOptions();
editOptions1.WorksheetIndex = 0;//index is 0-based, so this is 1st tab
Expand Down
4 changes: 2 additions & 2 deletions net/developer-guide/edit-document/edit-ebook.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ string epubPath = "path/to/Alices Adventures in Wonderland.epub";
GroupDocs.Editor.Editor editorMobi = new Editor(mobiPath);

FileStream azw3Stream = File.OpenRead(azw3Path);
GroupDocs.Editor.Editor editorAzw3 = new Editor(delegate() { return azw3Stream; });
GroupDocs.Editor.Editor editorAzw3 = new Editor(azw3Stream);

byte[] epubBytes = File.ReadAllBytes(epubPath);
MemoryStream epubStream = new MemoryStream(epubBytes);
GroupDocs.Editor.Editor editorEpub = new Editor(delegate () { return epubStream; });
GroupDocs.Editor.Editor editorEpub = new Editor(epubStream);


// ...
Expand Down
2 changes: 1 addition & 1 deletion net/developer-guide/edit-document/edit-email.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ string emlInputPath = System.IO.Path.Combine(Common.TestHelper.EmailFolder, emlF

using (FileStream emlStream = File.OpenRead(emlInputPath))
using (Editor editorFromPath = new Editor(emlInputPath))//from the path
using (Editor editorFromStream = new Editor(delegate () { return emlStream; }))//from the stream
using (Editor editorFromStream = new Editor(emlStream))//from the stream
{
//Here two Editor instances can separately work with one file
}
Expand Down
2 changes: 1 addition & 1 deletion net/developer-guide/edit-document/edit-excel/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Example below shows such situation: loading the password-protected spreadsheet:
string inputXlsxPath = "C://input/spreadsheet.xlsx";
SpreadsheetLoadOptions loadOptions = new SpreadsheetLoadOptions();
loadOptions.Password = "password";
Editor editor = new Editor(inputXlsxPath, delegate { return loadOptions; });
Editor editor = new Editor(inputXlsxPath, loadOptions);
```

There can be several scenarios here:
Expand Down
2 changes: 1 addition & 1 deletion net/developer-guide/edit-document/edit-markdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ string inputPath = System.IO.Path.Combine("markdown folder", filename);

using (FileStream content = File.OpenRead(inputPath))
{
using (Editor fromStream = new Editor(delegate () { return content; }))
using (Editor fromStream = new Editor(content)
using (Editor fromPath = new Editor(inputPath))
{
GroupDocs.Editor.Metadata.IDocumentInfo info = fromStream.GetDocumentInfo(null);
Expand Down
4 changes: 2 additions & 2 deletions net/developer-guide/edit-document/edit-pdf.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ editOptions.EnablePagination = true;//enable pagination for per-page processing
editOptions.Pages = PageRange.FromStartPageTillEnd(3);//edit not all pages, but starting from 3rd and till the end
//3. Create Editor instance, load a document
GroupDocs.Editor.Editor editor = new Editor(inputPath, delegate () { return loadOptions; });
GroupDocs.Editor.Editor editor = new Editor(inputPath, loadOptions);

//4. Edit a document and generate EditableDocument
GroupDocs.Editor.EditableDocument originalDoc = editor.Edit(editOptions);
Expand Down Expand Up @@ -125,7 +125,7 @@ string inputPdfPath = System.IO.Path.Combine(Common.TestHelper.PdfFolder, "NET_F
Editor editor1 = new Editor(inputPdfPath);

//Loading a PDF with PDF load options
Editor editor2 = new Editor(inputPdfPath, delegate () { return loadOptions; });
Editor editor2 = new Editor(inputPdfPath, loadOptions);
```

## Editing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Below is an example of loading a presentation document from file path with load
string inputPptxPath = "C://input/presentation.pptx";
PresentationLoadOptions loadOptions = new PresentationLoadOptions();
loadOptions.Password = "password";
Editor editor = new Editor(inputPptxPath, delegate { return loadOptions; });
Editor editor = new Editor(inputPptxPath, loadOptions);
```

## Edit PowerPoint presentation
Expand Down
6 changes: 3 additions & 3 deletions net/developer-guide/edit-document/edit-word/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ loadOptions.Password = "some_password_to_open_a_document";

Please note that if document has no protection, the password will be ignored. However, if document is protected, but user has not specified a password, a [PasswordRequiredException](https://reference.groupdocs.com/editor/net/groupdocs.editor/passwordrequiredexception) will be thrown during document editing.

Next step is to load the document from stream into the [Editor](https://reference.groupdocs.com/editor/net/groupdocs.editor/editor) class. For loading documents from streams (implementations of a `System.IO.Stream`) the [`Editor` class](https://reference.groupdocs.com/editor/net/groupdocs.editor/editor) uses delegates. In other words, you need to pass the delegate instance, that points to the method, that returns a stream. 
Same with load options — they are passed via delegate.
Next step is to load the document from stream into the [Editor](https://reference.groupdocs.com/editor/net/groupdocs.editor/editor) class. For loading documents  uses streams (implementations of a `System.IO.Stream`) in the [`Editor` class](https://reference.groupdocs.com/editor/net/groupdocs.editor/editor).
Same with load options — they should be passed.

```csharp
FileStream inputStream = File.OpenRead("C:\\input_path\\document.docx");
Editor editor = new Editor(delegate { return inputStream; }, delegate { return loadOptions; });
Editor editor = new Editor(inputStream, loadOptions);
```

## Edit the document
Expand Down
2 changes: 1 addition & 1 deletion net/developer-guide/edit-document/edit-xml.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ string xmlInputPath = System.IO.Path.Combine("full_folder_path", xmlFilename);

using (FileStream xmlStream = System.IO.File.OpenRead(xmlInputPath))
using (GroupDocs.Editor.Editor editorFromPath = new Editor(xmlInputPath))//from the path
using (GroupDocs.Editor.Editor editorFromStream = new Editor(delegate () { return xmlStream; }))//from the stream
using (GroupDocs.Editor.Editor editorFromStream = new Editor(xmlStream))//from the stream
{
//Here two Editor instances can separately work with one file
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ First of all user needs to load document into [Editor](https://reference.groupd
```csharp
string inputFilePath = "C:\\input_path\\document.docx"; //path to some document
WordProcessingLoadOptions loadOptions = new WordProcessingLoadOptions();
Editor editor = new Editor(inputFilePath, delegate { return loadOptions; }); //passing path and load options (via delegate) to the constructor
Editor editor = new Editor(inputFilePath, loadOptions); //passing path and load options to the constructor
EditableDocument document = editor.Edit(new WordProcessingEditOptions()); //opening document for editing with format-specific edit options
```

Expand Down
4 changes: 2 additions & 2 deletions net/developer-guide/editabledocument/save-html-to-folder.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ Almost all HTML WYSIWYG client-side editors are able to open HTML document from
```csharp
string inputFilePath = "C:\\input_path\\document.docx"; //path to some document
WordProcessingLoadOptions loadOptions = new WordProcessingLoadOptions();
Editor editor = new Editor(inputFilePath, delegate { return loadOptions; }); //passing path and load options (via delegate) to the constructor
Editor editor = new Editor(inputFilePath, loadOptions); //passing path and load options to the constructor
EditableDocument document = editor.Edit(new WordProcessingEditOptions());
string outputHtmlFilePath = "C:\\output_path\\document.html"; //path to output HTML document
document.Save(outputHtmlFilePath);
```

In this example we load input WordProcessing (DOCX) document to Editor class with load options, specific for this document family type - [WordProcessingLoadOptions](https://reference.groupdocs.com/editor/net/groupdocs.editor.options/wordprocessingloadoptions). Load options are passed via delegate. Then document is converted to the [EditableDocument](https://reference.groupdocs.com/editor/net/groupdocs.editor/editabledocument) using the [Edit()](https://reference.groupdocs.com/editor/net/groupdocs.editor/editor/edit) method, which, in turn, obtains document-specific [WordProcessingEditOptions](https://reference.groupdocs.com/editor/net/groupdocs.editor.options/wordprocessingeditoptions). In the last line content is saved to the HTML file on disk, that is specified by absolute path. Please note that GroupDocs.Editor will create accompanying folder with resources automatically in the same directory, where HTML file is saved. There is another overload of the [Save()](https://reference.groupdocs.com/editor/net/groupdocs.editor/editabledocument/save) method, that obtains 2 parameters: path to HTML file and path to existing folder, where resources should be saved. For example, last 2 lines can be rewritten in the next way:
In this example we load input WordProcessing (DOCX) document to Editor class with load options, specific for this document family type - [WordProcessingLoadOptions](https://reference.groupdocs.com/editor/net/groupdocs.editor.options/wordprocessingloadoptions). Load options are passed. Then document is converted to the [EditableDocument](https://reference.groupdocs.com/editor/net/groupdocs.editor/editabledocument) using the [Edit()](https://reference.groupdocs.com/editor/net/groupdocs.editor/editor/edit) method, which, in turn, obtains document-specific [WordProcessingEditOptions](https://reference.groupdocs.com/editor/net/groupdocs.editor.options/wordprocessingeditoptions). In the last line content is saved to the HTML file on disk, that is specified by absolute path. Please note that GroupDocs.Editor will create accompanying folder with resources automatically in the same directory, where HTML file is saved. There is another overload of the [Save()](https://reference.groupdocs.com/editor/net/groupdocs.editor/editabledocument/save) method, that obtains 2 parameters: path to HTML file and path to existing folder, where resources should be saved. For example, last 2 lines can be rewritten in the next way:

```csharp
string outputHtmlFilePath = "C:\\output_path\\document.html"; //path to output HTML document
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Let's prepare an [EditableDocument](https://reference.groupdocs.com/editor/net/

```csharp
string inputDocxPath = "C://input/document.docx";
Editor editor = new Editor(inputDocxPath, delegate { return new WordProcessingLoadOptions(); });
Editor editor = new Editor(inputDocxPath, new WordProcessingLoadOptions());
WordProcessingEditOptions editOptions = new WordProcessingEditOptions();
editOptions.FontExtraction = FontExtractionOptions.ExtractAll;// Enable max font extraction - ExtractAll
EditableDocument beforeEdit = editor.Edit(editOptions);// Create EditableDocument instance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ This article demonstrates how to edit form fields in a Word document using Group
Use the `Editor` class to load the document with the specified load options.

```csharp
using (Editor editor = new Editor(delegate { return fs; }, delegate { return loadOptions; }))
using (Editor editor = new Editor(fs, loadOptions))
{
// Further code will be placed here
}
Expand Down Expand Up @@ -118,7 +118,7 @@ internal static class EditFormFieldCollection
// 3.2. ...but, because the document is unprotected, this password will be ignored
// 4. Load the document with options into the Editor instance
using (Editor editor = new Editor(delegate { return fs; }, delegate { return loadOptions; }))
using (Editor editor = new Editor(fs, loadOptions))
{
// 4.1. Read the FormFieldManager instance
FormFieldManager fieldManager = editor.FormFieldManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ This article demonstrates how to fix invalid form fields in a Word document usin
Use the `Editor` class to load the document with the specified load options.

```csharp
using (Editor editor = new Editor(delegate { return fs; }, delegate { return loadOptions; }))
using (Editor editor = new Editor(fs, loadOptions))
{
// Further code will be placed here
}
Expand Down Expand Up @@ -127,7 +127,7 @@ internal static class FixInvalidFormFieldCollectionAndSave
// 3.2. ...but, because the document is unprotected, this password will be ignored
// 4. Load the document with options into the Editor instance
using (Editor editor = new Editor(delegate { return fs; }, delegate { return loadOptions; }))
using (Editor editor = new Editor(fs, loadOptions))
{
// 4.1. Read the FormFieldManager instance
FormFieldManager fieldManager = editor.FormFieldManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ This article demonstrates how to load, edit, and read form fields in a Word docu
Use the `Editor` class to load the document with the specified load options.

```csharp
using (Editor editor = new Editor(delegate { return fs; }, delegate { return loadOptions; }))
using (Editor editor = new Editor(fs, loadOptions))
{
// Further code will be placed here
}
Expand Down Expand Up @@ -118,7 +118,7 @@ internal static class LegacyFormFieldCollection
// 3.2. ...but, because the document is unprotected, this password will be ignored
// 4. Load the document with options to the Editor instance
using (Editor editor = new Editor(delegate { return fs; }, delegate { return loadOptions; }))
using (Editor editor = new Editor(fs, loadOptions))
{
// 4.1. Read the FormFieldManager instance
FormFieldManager fieldManager = editor.FormFieldManager;
Expand Down
Loading

0 comments on commit 31c0c32

Please sign in to comment.