# Convert Editor Value to Plain Text

## Environment

<table>
    <tbody>
        <tr>
            <td>Product</td>
            <td>Editor for Blazor</td>
        </tr>
    </tbody>
</table>

## Description

How to convert the HTML string value of the Editor and retrieve it as plain text?

## Solution

The HTML value of the Editor can be [converted to plain text and other formats](https://www.telerik.com/blazor-ui/documentation/components/editor/import-export) with our [Document Processing library](https://www.telerik.com/blazor-ui/documentation/integrations/document-processing-libraries).

Here are the required steps:

1. Add the [`Telerik.Documents.Core` and `Telerik.Documents.Flow`](https://www.telerik.com/blazor-ui/documentation/integrations/document-processing-libraries) NuGet packages to your project.
2. Import the required namespaces:
   * `Telerik.Documents.Flow.FormatProviders.Html`
   * `Telerik.Documents.Flow.FormatProviders.Txt`
   * `Telerik.Documents.Flow.Model`
3. Create an [`HtmlFormatProvider`](https://docs.telerik.com/devtools/document-processing/libraries/radwordsprocessing/formats-and-conversion/html/htmlformatprovider) instance.
4. Use the HTML provider's **`Import`** method to create a `RadFlowDocument` from the Editor's HTML value.
5. Create a [`TxtFormatProvider`](https://docs.telerik.com/devtools/document-processing/libraries/radwordsprocessing/formats-and-conversion/plain-text/txt-txtformatprovider) instance.
6. Use the TXT provider's **`Export`** method to export the `RadFlowDocument` as plain text.

To export to another format, use the corresponding namespace and format provider, instead of `Txt`.

> caption Obtain the Editor HTML value as plain text

```RAZOR.skip-repl
@*TxtFormatProvider*@
@using Telerik.Documents.Flow.FormatProviders.Txt;
@*HtmlFormatProvider*@
@using Telerik.Documents.Flow.FormatProviders.Html;
@*RadFlowDocument*@
@using Telerik.Documents.Flow.Model;

<TelerikEditor @bind-Value="@HtmlValue" />

<p><TelerikButton OnClick="@ConvertValue">Convert to Plain Text</TelerikButton></p>

<TelerikTextArea @bind-Value="@PlainTxtValue" Width="100%" Rows="5" />

@code {

    private string HtmlValue { get; set; } =
        @"
            <h1>Title</h1>
            <p>Paragraph paragraph paragraph.</p>
            <ul>
                <li>List item 1</li>
                <li>List item 2</li>
            </ul>
        ";
    private string PlainTxtValue { get; set; }

    private void ConvertValue(MouseEventArgs e)
    {
        HtmlFormatProvider htmlProvider = new HtmlFormatProvider();
        RadFlowDocument document = htmlProvider.Import(HtmlValue, new TimeSpan(0, 0, 5));
        TxtFormatProvider txtProvider = new TxtFormatProvider();
        PlainTxtValue = txtProvider.Export(document);
    }
}
```

## See Also

* [Configuring Document Processing Libraries](https://www.telerik.com/blazor-ui/documentation/installation/vs-integration/dpl-wizard)
