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

Import filetype options + more

2 Answers 58 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Tyree
Top achievements
Rank 2
Tyree asked on 31 Aug 2012, 01:24 PM
I have a couple of questions.
  1. Using one of your examples I have the UI showing and seemingly working as desired except when I try to Open/Import a file. The only file types listed are .rtf and .txt. If I select *.* and select a .docx it says the format is not supported. I have been unable to figure out what I am missing to show .docx as an option. I have added all the provider references to the project. What am I missing?
  2. Every word is listed as spelled wrong. I have added the dictionary reference but still it does not find any words. If I "add to dictionary" that word works fine, but obviously I am missing the full dictionary somehow. What am I missing?
  3. We are using xaml binding to bind an entity property to the provider which is bound to the richtextbox. Currently the data in the database is in raw text. What I would like to do is if its in raw text that it still show, but when they commit their change that it save it as openxml or rtf. Right now either provider show nothing when bound to this property. Is there a way to accomplish this with binding or does it have to be done in the code-behind? Could you give an example?

2 Answers, 1 is accepted

Sort by
0
Tyree
Top achievements
Rank 2
answered on 05 Sep 2012, 02:33 PM
this thing on?
0
Vasil
Telerik team
answered on 05 Sep 2012, 03:29 PM
Hi Robert,

Thank you for your questions. Please, find below our answers:
  1. Could you try to clean your project and even deleting the bin and obj folders manually. Afterwards, verify that you have added all format provider references and all binaries point to same version. If these are in order, you shouldn't have a problem when importing supported documents. Judging from the behavior you have described, probably you have added a reference to only RTF and OpenXML format provider, but missed Telerik.Windows.Zip and the other format providers.
  2. You may be missing a reference to the Telerik.Windows.Documents.Proofing.Dictionaries.En-US.dll assembly which contains a built-in dictionary for english. You could find more information here.
  3. Data providers can import/export only data in the format they support. It is not possible to have databinding that loads XAML and exports docx or RTF with the default providers. What you can do is either to convert all the data in your database to RTF/Docx or use format providers to import and export the document instead of binding it. 
    What is more, docx is not a text-based format, so if you decide to use docx, the field type in the database should probably be image and not text. 
Please, refer to this forum post and see the attached RiaPersistingInOpenXML archive. It contains a project similar to your scenario which you could use as an example. The loading of the document happens in the GetDocumentFromDocx method, which you could implement to use different format providers depending on the format of the data in the database.

I hope this information helps. Don't hesitate to contact us if you have other questions.

Kind regards,
Vasil
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
RichTextBox
Asked by
Tyree
Top achievements
Rank 2
Answers by
Tyree
Top achievements
Rank 2
Vasil
Telerik team
Share this question
or