Forum Xamarin.Forms

How to display HTML data as plain data in xamarin form

I am getting data from SQL server using API. I have stored some data with HTML tag and now I want to show that data in plain format applying with that HTML tags. How can we display ?

Answers

  • JohnHardmanJohnHardman GBUniversity admin

    @MohanMahale - Load it into a WebView

  • @JohnHardman Thanks for the answer. Actually I have multiple data which want to display on single page. I can't use multiple WebView on single page. Is there any way to display that data.

  • JohnHardmanJohnHardman GBUniversity admin
    edited September 2017

    @MohanMahale - It should be possible to have multiple WebViews on a page, although you would have to size them.

    Two alternatives that spring to mind:

    (1) Build that entire page using HTML, so that you can use a WebView for the entire page.
    (2) If you don't need the formatting provided by the HTML, just the plain text, you can use a helper to retrieve the plain text from the HTML. I use one in my app - I'm just in the midst of a rather long Source Control operation - once it's done I'll post the details if they would be useful for you.

    [Edit: operation just completed, so here's the link to the code I based my HTML to plain text method on: http://www.blackbeltcoder.com/Articles/strings/convert-html-to-text ]

    [Edit: and alternative option (3) - build custom Label renderers that display formatted HTML. I don't do this, but I've seen posts about this before, so if you Google for that, you might find what you need]

Sign In or Register to comment.