Skip to content

Commit d8b987e

Browse files
EDITORNET-2946 - Update product Public Docs - New overloads
1 parent 3afc2bc commit d8b987e

2 files changed

Lines changed: 35 additions & 1 deletion

File tree

net/developer-guide/editabledocument/create-editabledocument-from-file-or-markup.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,23 @@ allResources.Add(stylesheet);
6565
EditableDocument document = EditableDocument.FromMarkup(inputHtmlMarkup, allResources);
6666
```
6767

68+
Starting from the [version 25.7](https://releases.groupdocs.com/editor/net/release-notes/2025/groupdocs-editor-for-net-25-7-release-notes/) a new simplified overload of the `FromMarkup` method was implemented: `EditableDocument.FromMarkup(string newHtmlContent)`. This overload is useful when there is no any external HTML resources for the given HTML markup. This usually happens when the whole document content with HTML- and CSS-markup and all the resources is packed inside a single string (resources are packed to the HTML-markup using the [data URI scheme](https://en.wikipedia.org/wiki/Data_URI_scheme) with base64 encoding). So, in case when the `inputHtmlMarkup` string variable from the example above contains all resources inside it, and there are no any external images, fonts, or stylesheets, the whole example above can be rewritten as below:
69+
70+
{{< tabs "FromMarkup simplified">}}
71+
{{< tab "C#" >}}
72+
```csharp
73+
string inputHtmlMarkup = "<HTML><HEAD><TITLE>Edited document</TITLE>.....";//all content is here
74+
EditableDocument document = EditableDocument.FromMarkup(inputHtmlMarkup);
75+
```
76+
{{< /tab >}}
77+
{{< tab "VB.NET">}}
78+
```vb
79+
Dim inputHtmlMarkup As String = "<HTML><HEAD><TITLE>Edited document</TITLE>....." 'all content is here
80+
Dim document As EditableDocument = EditableDocument.FromMarkup(inputHtmlMarkup)
81+
```
82+
{{< /tab >}}
83+
{{< /tabs >}}
84+
6885
## Opening from markup and resource folder
6986

7087
In some cases there is an HTML markup of edited document, but resources are represented as a set of files, located in some specific folder. For example, original document was converted to [EditableDocument](https://reference.groupdocs.com/editor/net/groupdocs.editor/editabledocument) and then saved to the disk as an HTML document with *.html file and a folder with resources. Then it was loaded to the WYSIWYG-editor, edited by the end-user, and edited content was obtained back from the front-end to the back-end. So now there is an edited HTML markup, available as a stream, and a resource folder. In such case a new method [FromMarkupAndResourceFolder](https://reference.groupdocs.com/editor/net/groupdocs.editor/editabledocument/frommarkupandresourcefolder) was introduced in version 21.10. Here is an example of its usage.

net/developer-guide/save-document.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,26 @@ Save(inputDocument As EditableDocument, outputDocument As Stream, saveOptions As
129129
{{< /tabs >}}
130130
Here:
131131
- The 1st parameter — `EditableDocument inputDocument` — is a [EditableDocument](https://reference.groupdocs.com/editor/net/groupdocs.editor/editabledocument) instance with **modified content** inside, created on the 1st step.
132-
- The 2nd parameter is a [stream](https://learn.microsoft.com/en-us/dotnet/api/system.io.stream), into which the resultant document of defined format should be written, or a file path, where the resultant document of defined format should be stored.
132+
- The 2nd parameter is a [stream](https://learn.microsoft.com/en-us/dotnet/api/system.io.stream), into which the resultant document of defined format should be written, or a `string`, that represents a file path, where the resultant document of defined format should be stored.
133133
- The 3rd parameter is an instance of some save options, which defines the format of the resultant document and additional adjustments, created on the 2nd step.
134134

135+
In the [version 25.7](https://releases.groupdocs.com/editor/net/release-notes/2025/groupdocs-editor-for-net-25-7-release-notes/) a new overload of the `Editor.Save()` method was added:
136+
137+
{{< tabs "Save simplified">}}
138+
{{< tab "C#" >}}
139+
```csharp
140+
Save(EditableDocument inputDocument, string filePath)
141+
```
142+
{{< /tab >}}
143+
{{< tab "VB.NET">}}
144+
```vb
145+
Save(inputDocument As EditableDocument, filePath As String)
146+
```
147+
{{< /tab >}}
148+
{{< /tabs >}}
149+
150+
This overload is essentially a wrapper for the previously mentioned overload — it analyzes the file extension of the `filePath` argument and inferes the default saving options automatically.
151+
135152
## Complete code example
136153

137154
Because the WYSIWYG HTML-editor is not a part of the GroupDocs.Editor, it is hard to provide a lightweight code example with fully functional editing. So in this sample the content will be edited programmatically, using a [`String.Replace`](https://learn.microsoft.com/ru-ru/dotnet/api/system.string.replace) method.

0 commit comments

Comments
 (0)