Skip to content

Commit 9a489fb

Browse files
Merge branch 'development' into ES-981760-dev-fm
2 parents 8cd5b22 + a03ce1b commit 9a489fb

File tree

7 files changed

+127
-0
lines changed

7 files changed

+127
-0
lines changed

blazor-toc.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4168,6 +4168,7 @@
41684168
<li> <a href="/blazor/rich-text-editor/keyboard-support">Keyboard shortcuts</a></li>
41694169
<li> <a href="/blazor/rich-text-editor/accessibility">Accessibility</a></li>
41704170
<li> <a href="/blazor/rich-text-editor/webassembly-performance">WebAssembly Performance</a></li>
4171+
<li> <a href="/blazor/rich-text-editor/import-export">Import and Export</a></li>
41714172
<li> <a href="/blazor/rich-text-editor/miscellaneous">Miscellaneous</a></li>
41724173
<li> <a href="/blazor/rich-text-editor/events">Events</a></li>
41734174
<li>How To

blazor/file-manager/end-user-capabilities.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,16 @@ Refer to the [Toolbar](https://blazor.syncfusion.com/documentation/file-manager/
141141

142142
![Download a file in Blazor FileManger](./images/blazor-filemanager-download-operation.png)
143143

144+
### Upload Files or Folders via context menu
145+
146+
In the Blazor File Manager component, you can perform the files or folder [upload](https://blazor.syncfusion.com/documentation/file-manager/file-operations#uploading-files) operations with the help of Context Menu items by switching between the Files or Folder from Upload menu item.
147+
148+
Refer to the [Context Menu](https://blazor.syncfusion.com/documentation/file-manager/context-menu) sections to learn more about the items that are present in Context Menu.
149+
150+
![Upload a file in Blazor FileManger](./images/blazor-filemanager-fileupload.png)
151+
152+
![Download a folder in Blazor FileManger](./images/blazor-filemanager-folderupload.png)
153+
144154
### Searching Files and Folders
145155

146156
In the Blazor File Manager component, you are able to [search](https://blazor.syncfusion.com/documentation/file-manager/file-operations#searching-files-and-folders) for the wanted files and folders using the default input search functionality option.
75.1 KB
Loading
74.7 KB
Loading
44.3 KB
Loading

blazor/file-manager/upload.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,32 @@ The screenshot below shows after successfully selecting a directory it uploads a
3939

4040
![Blazor File Manager with DirectoryUpload](images/blazor-filemanager-directoryupload.png)
4141

42+
## Sequential Upload
43+
44+
The [SequentialUpload](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.FileManager.FileManagerUploadSettings.html#Syncfusion_Blazor_FileManager_FileManagerUploadSettings_SequentialUpload) property controls whether users can upload files one by one in a sequential manner.
45+
46+
To enable sequential upload, set the `SequentialUpload` property to `true` in the [FileManagerUploadSettings](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.FileManager.FileManagerUploadSettings.html) configuration.
47+
48+
When set to `true`, the selected files will process sequentially (one after the other) to the server. If the file uploaded successfully or failed, the next file will upload automatically in this sequential upload. This feature helps to reduce the upload traffic and reduce the failure of file upload.
49+
50+
```cshtml
51+
52+
@using Syncfusion.Blazor.FileManager
53+
54+
<SfFileManager TValue="FileManagerDirectoryContent">
55+
<FileManagerUploadSettings SequentialUpload = "true"></FileManagerUploadSettings>
56+
<FileManagerAjaxSettings Url="https://ej2-aspcore-service.azurewebsites.net/api/FileManager/FileOperations"
57+
UploadUrl="https://ej2-aspcore-service.azurewebsites.net/api/FileManager/Upload"
58+
DownloadUrl="https://ej2-aspcore-service.azurewebsites.net/api//FileManager/Download"
59+
GetImageUrl="https://ej2-aspcore-service.azurewebsites.net/api/test/FileManager/GetImage">
60+
</FileManagerAjaxSettings>
61+
</SfFileManager>
62+
63+
```
64+
The screenshot below shows that each file begins uploading only after the previous one completes. This demonstrates how the `SequentialUpload` property works in the Blazor File Manager component.
65+
66+
![Blazor File Manager with SequentialUpload](images/blazor-filemanager-sequentialupload.png)
67+
4268
## Chunk Upload
4369

4470
The [ChunkSize](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.FileManager.FileManagerUploadSettings.html#Syncfusion_Blazor_FileManager_FileManagerUploadSettings_ChunkSize) property specifies the size of each chunk when uploading large files. It divides the file into smaller parts, which are uploaded sequentially to the server

blazor/rich-text-editor/import-export.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,3 +421,93 @@ public WordDocument GetDocument(string htmlText)
421421
{% endtabs %}
422422

423423
N> [View Sample in GitHub](https://github.com/SyncfusionExamples/blazor-rich-text-editor-export-to-html).
424+
425+
## Securely Export Word or PDF Documents with Authentication
426+
427+
You can include custom data when exporting Word or PDF documents, such as authentication tokens or other parameters. Use the `OnExport` event with its `RequestHeader` and `CustomFormData` properties to send these values to the server. On the server side, the authentication token can be read from the request headers, and the custom data can be accessed from the request body, which contains the values sent via a POST request.
428+
429+
The following example demonstrates how to pass authentication tokens and custom data during export:
430+
431+
{% tabs %}
432+
{% highlight razor %}
433+
@using Syncfusion.Blazor.RichTextEditor
434+
<SfRichTextEditor>
435+
<RichTextEditorEvents OnExport="@Export" />
436+
<RichTextEditorToolbarSettings Items="@Items" />
437+
<RichTextEditorExportPdf ServiceUrl="@exportPdfServiceUrl" />
438+
<RichTextEditorExportWord ServiceUrl="@exportWordServiceUrl" />
439+
Rich Text Editor
440+
</SfRichTextEditor>
441+
@code {
442+
private string exportWordServiceUrl = "https://blazor.syncfusion.com/services/production/api/RichTextEditor/ExportToDocx";
443+
private string exportPdfServiceUrl = "https://blazor.syncfusion.com/services/production/api/RichTextEditor/ExportToPdf";
444+
private List<ToolbarItemModel> Items = new List<ToolbarItemModel>()
445+
{
446+
new ToolbarItemModel() { Command = ToolbarCommand.ExportPdf },
447+
new ToolbarItemModel() { Command = ToolbarCommand.ExportWord },
448+
};
449+
private void Export(ExportingEventArgs args)
450+
{
451+
// Assign different authentication tokens depending on the export type (Pdf or Word)
452+
var token = (args.ExportType == "Pdf" ? "Pdf Bearer token" : "Word Bearer token");
453+
args.RequestHeader = new Dictionary<string, string>
454+
{
455+
{ "Authorization", token }
456+
};
457+
args.CustomFormData = new Dictionary<string, string>
458+
{
459+
{ "userId", "12345" }
460+
};
461+
}
462+
}
463+
{% endhighlight %}
464+
{% endtabs %}
465+
466+
{% tabs %}
467+
{% highlight controller %}
468+
469+
using System;
470+
using System.IO;
471+
using System.Net.Http.Headers;
472+
using Microsoft.AspNetCore.Mvc;
473+
using Microsoft.AspNetCore.Http;
474+
using System.Collections.Generic;
475+
using Microsoft.AspNetCore.Hosting;
476+
using Microsoft.AspNetCore.Http.Features;
477+
478+
namespace ExportService.Controllers
479+
{
480+
[ApiController]
481+
public class ExportController : ControllerBase
482+
{
483+
private readonly IWebHostEnvironment hostingEnv;
484+
485+
public ExportController(IWebHostEnvironment env)
486+
{
487+
this.hostingEnv = env;
488+
}
489+
public class ExportParam
490+
{
491+
public string? Html { get; set; }
492+
public object? FormData { get; set; }
493+
}
494+
[AcceptVerbs("Post")]
495+
[EnableCors("AllowAllOrigins")]
496+
[Route("api/RichTextEditor/ExportToPdf")]
497+
public async Task<ActionResult> ExportToPdf([FromBody] ExportParam args)
498+
{
499+
// Fetch authentication token from request headers
500+
var authorization = Request.Headers["Authorization"].ToString();
501+
// Access custom form data from the request body
502+
Console.WriteLine("Authorization: " + authorization);
503+
Console.WriteLine("Form Data: " + args.FormData);
504+
Console.WriteLine("HTML Content: " + args.Html);
505+
// Your export logic here
506+
// Validate token, process formData, generate PDF, etc.
507+
return Ok();
508+
}
509+
}
510+
}
511+
512+
{% endhighlight %}
513+
{% endtabs %}

0 commit comments

Comments
 (0)