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

Get plain string from HtmlFormatProvider string

10 Answers 166 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Shalin
Top achievements
Rank 1
Shalin asked on 06 Sep 2016, 05:51 AM

Hi,

I have successfully implemented RadRichTextBox with RadToolBarTray and HtmlDataProvider.

<telerikDocumentsHtml:HtmlDataProvider   RichTextBox="{Binding ElementName=richTextBox}"
                                                                                               Html="{Binding WebContent,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" />

WebContent saved in DB as it is and in C# Class Library project i want to remove all formatting from WebContent and get plain string.

Can not use HtmlFormatProvider, because it needs RadDocument object, which can not have in C# Class Library (SerializableAtribute conflict error).

Please help

10 Answers, 1 is accepted

Sort by
0
Tanya
Telerik team
answered on 08 Sep 2016, 10:35 AM
Hi Shalin,

The API of RadDocument and the format providers that enable you to import and export content can be used in a Class Library project and I am not sure what may cause you troubles in this scenario. Could you share more details on your setup?

Generally speaking, you could import the document with the HtmlFormatProvider class and then export it as plain text using TxtFormatProvider.

What I could suggest you in this scenario is to check our RadWordsProcessing library. It is independent of platform and doesn't operate with the UI, thus it is lighter than RadRichTextBox. You could use it to convert the HTML document to plain text with the available format providers.

Hope this helps.

Regards,
Tanya
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Shalin
Top achievements
Rank 1
answered on 09 Sep 2016, 03:21 AM

Hi tanya,

In my C# class library project i have some classes use annotation  [System.SerializableAttribute()], which is from mscorlib.dll. When building the project error says Telerik.Windows.Documents.dll also have same serializableattribute.

below are types of errors,

1) System.SerializableAttribute exists in both (mscorlib.dll and Telerik.Windows.Documents.dll)

2) Serializable does not exist in the namespace 'System'

3) SerializableAttributeAttribute does not exists in the namespace 'System'

Some from my references and some from my classes. Without referencing Telerik.Windows.Documents.dllTelerik.Windows.Documents.dll there is no problem.

Please help.

0
Tanya
Telerik team
answered on 13 Sep 2016, 12:51 PM
Hello Shalin,

It seems like there is a conflict between the types in the two assemblies. To avoid this, you can use the extern aliases feature of C#. The alias could be applied to the Telerik.Windows.Documents.dll assembly. Here is a good tutorial that describes how to use with this feature.

Regards,
Tanya
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Shalin
Top achievements
Rank 1
answered on 14 Sep 2016, 02:51 AM

Thank you tanya, it work like charm. I previously also tried 'extern' but i missed alias editing part in Visual Studio.

Thank you very much

0
Shalin
Top achievements
Rank 1
answered on 30 Sep 2016, 10:09 AM

Hi,

Sorry to bother you again, but it started to crash again. This time not with the Serializable error.

This comes up when i try to create RadDocument  object.

Could not load file or assembly 'System.Xml, Version=5.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' or one of its dependencies. The system cannot find the file specified.

0
Tanya
Telerik team
answered on 05 Oct 2016, 07:43 AM
Hello Shalin,

The System.Xml.dll assembly is used by the framework to process XML data. You should have this   installed along with the installation of Silverlight. Please, ensure that the path to the assembly is correct and properly resolved.

Please, bear in mind that the assemblies used in Silverlight projects should be built for this platform and using the binaries from the .NET Framework may lead to similar errors. This is why you will need to verify that you are referring the binaries that are provided for Silverlight.

I hope this is helpful.

Regards,
Tanya
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Shalin
Top achievements
Rank 1
answered on 07 Oct 2016, 09:40 AM

Hi,

I am using right dll. That from your installation. i am wondering how this works previously and not now and also as you previously mentioned in this thread "Telerik.Windows.Documents.Model.RadDocument " can use in C# class library project also.

System.Xml version for C# class library is lower than silverlight project Xml dll version.

Is there any different place other than telerik installation directory to get silverlight or .net class library support dlls ?

Any Help !!!

0
Tanya
Telerik team
answered on 12 Oct 2016, 07:55 AM
Hello Shalin,

This assembly comes from Microsoft and you should be able to add a reference to it through the Reference Manager -> Assemblies -> Framework window.

Regards,
Tanya
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Shalin
Top achievements
Rank 1
answered on 20 Oct 2016, 03:30 AM

Hi Tanya,

Now this is getting very very confusing.

As i mentioned earlier in this question thread,

  1. I am going to use RadDocument and those dlls in C# class library project NOT Silverlight class library project
  2. In my class library project i have System.Xml version 4.0 (for C# class library)

According to my knowledge add silverlight build dlls can not use in C# class library project.

Any help

0
Tanya
Telerik team
answered on 24 Oct 2016, 03:31 PM
Hello Shalin,

If you are trying to use the API of RadRichTextBox in a non-Silverlight application, I would suggest you use the WPF version of the control. The Silverlight version uses the API provided by the platform and requires you to add a reference to the specific for Silverlight binaries.

Regards,
Tanya
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
RichTextBox
Asked by
Shalin
Top achievements
Rank 1
Answers by
Tanya
Telerik team
Shalin
Top achievements
Rank 1
Share this question
or