Diese Seite ist noch nicht übersetzt. Sie wird auf Englisch angezeigt.
Dieses Kapitel gibt es auf Englisch und Bulgarisch.
Output formats
All of these are methods of the component and, without the editor, static classes in Rte.Processing. They work on the HTML the editor produced.
| Format | Component method | Without the editor |
|---|---|---|
| Clean HTML 5 (minimal) or XHTML, optionally indented | GetCleanHtmlAsync(xhtml, indent) | HtmlCleaner.Clean |
| Markdown | GetMarkdownAsync() | MarkdownConverter.FromHtml, ToHtml |
| Structured JSON | GetJsonAsync(indented) | JsonConverter.FromHtml, ToHtml, Validate |
| E-mail HTML with inline styles | GetEmailHtmlAsync(options) | EmailHtml.Create |
| Static HTML to show the content read-only | GetStaticHtmlAsync(options) | StaticRender.Render |
| Plain text | GetTextAsync() | TextTools.PlainText |
| Word (.docx) | ExportDocxAsync(options) | BasicDocxExporter |
| print dialog (export menu) | your own renderer |
UrlMode and BaseUrl turn addresses in the clean output into relative or absolute ones (UrlRewriter).
E-mail HTML
EmailHtml.Create writes tables for layout and inline styles, as mail programs expect. It does not send mail. Test the result in the mail programs your readers use.
JSON
The JSON form is a tree of blocks and inline runs. JsonConverter.ToHtml rebuilds HTML from it and Validate checks a document before you store or convert it. Raw HTML is not passed through.
Word (.docx)
Export:
var bytes = await editor.ExportDocxAsync(new DocxOptions { Title = "Offer", Author = "Ada" }); BasicDocxExporter writes paragraphs and headings, lists, tables, images, links, the blocks of the editor (callouts, columns, to-do lists, toggles) as plain Word structures. Give DocxOptions.ImageResolver a function that returns the bytes of an image for its address, so images from your library are included.
Import:
var importer = new BasicDocxImporter();
string html = await importer.ImportAsync(bytes, new DocxImportOptions
{
ImageHandler = (name, data) => store.SaveImage(name, data)
});
await editor.SetHtmlAsync(html); The importer reads headings, character formats, lists (including task lists), tables, images, links, callouts and columns, and uses the styles and numbering of the Word file. ImageHandler returns the address under which you stored the image. MaxImageBytes (10 MB) and MaxPartBytes (64 MB) protect against damaged or hostile files. Filter the imported HTML with ContentFilter like any other HTML before you store it.
The Basic classes cover what is listed above; other Word features are not promised. For richer files replace the parts with your own IRteDocxExporter and IRteDocxImporter.
PDF is made by the print dialog of the browser: choose "Save as PDF". The export menu opens it and shows a hint. The content is printed with ContentCss of your site, so the PDF looks like your pages. The editor's own toolbars are hidden in print.
For server-side PDF files (reports, archives) render the stored HTML with a renderer of your choice, for example a headless browser, and use StaticRender.Render to get HTML that does not depend on scripts.
Markdown import
The output menu imports Markdown text or a file (up to 5 MB) and inserts it at the caret or replaces the whole document. The conversion does not pass raw HTML through.
Copy and download
The export menu also copies as rich text, copies the e-mail HTML, and downloads the HTML, Markdown or JSON as a file.
Bereit zum Testen von RayCraft Write?
Starten Sie den 14-tägigen Test, keine Karte nötig.
14 Tage kostenlos testen