Content Import/Export in ASP.NET Core Rich Text Editor Control

18 Nov 20181 minute to read

Importing content from Microsoft Word

The Rich Text Editor provides functionality to import content directly from Microsoft Word documents, preserving the original formatting and structure. This feature ensures a smooth transition of content from Word to the editor, maintaining elements such as headings, lists, tables, and text styles.

To integrate an ImportWord option into the Rich Text Editor toolbar, you can add it as a custom toolbar items using the items property in toolbarSettings.

The following example illustrates how to set up the ImportWord in the Rich Text Editor to facilitate content importation from Word documents:

Secure importing with authentication

The Rich Text Editor provides functionality to import Word documents with authentication for secure importing.

The wordImporting event provides UploadingEventArgs for secure Word file import. Use currentRequest to add authentication headers and customFormData to include extra parameters in the POST body along with the uploaded file. On the server, read headers and form data from the request to validate and process the import securely.

The following example demonstrates how to configure wordImporting for secure importing:

Exporting content to PDF and Microsoft Word

The Rich Text Editor’s export functionality allows users to convert their edited content into PDF or Word documents with a single click, preserving all text styles, images, tables, and other formatting elements.

You can add ExportWord and ExportPdf tools to the Rich Text Editor toolbar using the toolbarSettings items property.

The following example demonstrates how to configure the ExportWord and ExportPdf tools in the Rich Text Editor, facilitating the export of content into Word or PDF documents:

Secure exporting with authentication

The Rich Text Editor provides functionality to export Word or PDF documents with authentication for secure exporting.

The documentExporting event provides ExportingEventArgs for secure export of Word or PDF files. Use exportType to identify the format, currentRequest to add authentication headers, and customFormData to send extra parameters in the POST body. On the server, read headers and custom data to validate and process the export securely.

The following example demonstrates how to configure documentExporting for secure exporting: