This is a migrated thread and some comments may be shown as answers.

Save RadDocument in the native format

1 Answer 192 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Emin Sadigov
Top achievements
Rank 1
Iron
Veteran
Iron
Emin Sadigov asked on 09 Jul 2020, 11:44 PM

Hello,

I want to store RadDocument object in the database table as byte[]. Is any way do that?

(I don`t want to use export/import, because seems it is not export all data (ex. don`t export "tracking changes", etc)).

1 Answer, 1 is accepted

Sort by
1
Accepted
Martin
Telerik team
answered on 10 Jul 2020, 11:17 AM

Hi Emin,

We tried to import and export a DOCX document containing revisions (tracking changes) using the DocxFormatProvider and XamlFormatProvider and they were successfully exported, so you can use one of these format providers to export the RadDocument to a byte array.

Using the XamlFormatProvider:

private void ExportDocumentToByteArray(RadDocument document)
{
	DocumentFormatProviderBase provider = new XamlFormatProvider();
	byte[] output = provider.Export(document);
}

Using the DocxFormatProvider:

private void ExportDocumentToByteArray(RadDocument document)
{
	var provider = new Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.DocxFormatProvider();
	byte[] output = provider.Export(document);
}

In case you are observing something that is not successfully exported, please let us know in order to log it in our backlog and investigate the case.

I hope you find this information helpful. Please, let me know if there is anything else I can assist you with.

Regards,
Martin
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
RichTextBox
Asked by
Emin Sadigov
Top achievements
Rank 1
Iron
Veteran
Iron
Answers by
Martin
Telerik team
Share this question
or