Get plain string from HtmlFormatProvider string

11 posts, 0 answers
  1. Shalin
    Shalin avatar
    9 posts
    Member since:
    May 2015

    Posted 06 Sep Link to this post

    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

  2. Tanya
    Admin
    Tanya avatar
    405 posts

    Posted 08 Sep Link to this post

    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.
  3. DevCraft banner
  4. Shalin
    Shalin avatar
    9 posts
    Member since:
    May 2015

    Posted 08 Sep in reply to Tanya Link to this post

    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.

  5. Tanya
    Admin
    Tanya avatar
    405 posts

    Posted 13 Sep Link to this post

    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.
  6. Shalin
    Shalin avatar
    9 posts
    Member since:
    May 2015

    Posted 13 Sep in reply to Tanya Link to this post

    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

  7. Shalin
    Shalin avatar
    9 posts
    Member since:
    May 2015

    Posted 30 Sep Link to this post

    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.

  8. Tanya
    Admin
    Tanya avatar
    405 posts

    Posted 05 Oct Link to this post

    Hello Shalin,

    The System.Xml.dll assembly is used by the framework to process XML data. You should have this dll  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.
  9. Shalin
    Shalin avatar
    9 posts
    Member since:
    May 2015

    Posted 07 Oct in reply to Tanya Link to this post

    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 !!!

  10. Tanya
    Admin
    Tanya avatar
    405 posts

    Posted 12 Oct Link to this post

    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.
  11. Shalin
    Shalin avatar
    9 posts
    Member since:
    May 2015

    Posted 19 Oct Link to this post

    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

  12. Tanya
    Admin
    Tanya avatar
    405 posts

    Posted 24 Oct Link to this post

    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.
Back to Top
DevCraft banner