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

Having problems exporting a document with .Export

1 Answer 226 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
danparker276
Top achievements
Rank 2
danparker276 asked on 19 Jul 2012, 09:07 PM
I must be missing something simple, but I'm trying to export a document the way it is on many help files:
                   using (Stream output = dialog.OpenFile())
                   {
                       PdfFormatProvider pdf = DocumentFormatProvidersManager.GetProviderByExtension("pdf") as PdfFormatProvider;
                       pdf.Export(document,output);
                   }

But it's not finding the Export function.  The intellisense will get pdf.Import, but not Export. I'm pretty sure I have all the references, (Documents, Documents.Fixed, Documents.FormatProviders.Pdf) I get the error below.  

I'm getting the error:
Error 9 'Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider' does not contain a definition for 'Export' and no extension method 'Export' accepting a first argument of type 'Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider' could be found (are you missing a using directive or an assembly reference?)

It also can't resovle DocxFormatProvider

1 Answer, 1 is accepted

Sort by
0
Iva Toteva
Telerik team
answered on 20 Jul 2012, 12:08 PM
Hi Dan,

There are two different PdfFormatProviders - one used by RadRichTextBox to export its document to PDF and one used by RadPdfViewer to import PDF documents.

The PdfFormatProvider located in the Telerik.Windows.Documents.Fixed assembly, Telerik.Windows.Documents.Fixed.FormatProviders.Pdf is used by RadPdfViewer. It can only import PDF documents.

On the other hand, the provider that is able to export RadDocument is located in the Telerik.Windows.Documents.FormatProviders.Pdf assembly (which depends on Telerik.Windows.Zip), in the Telerik.Windows.Documents.FormatProviders.Pdf namespace. 

Make sure to have referenced the correct assemblies and added the right using declarations. For docx format, you should also add a reference to Telerik.Windows.Documents.FormatProviders.OpenXml.dll. You can find more information on the required assembly references for all format providers here.


Regards,
Iva Toteva
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
RichTextBox
Asked by
danparker276
Top achievements
Rank 2
Answers by
Iva Toteva
Telerik team
Share this question
or