How to get WinRT RichEditBox's content as html string ?
Otherwise I can get the content as RTF string with the following code.
richEditBox.Document.GetText(TextGetOptions.FormatRtf, out temp);
How to convert this RTF string to HTML string in WinRT application?
you should use some differ way.
Here is the link of particular solution
Related
I am passing some HTML in one of the fields to enhance my order formatting in the Order Printer. There is a problem however. HTML tags aren rendered properly. It looks like that when its rendering tag with HTML intities so < becomes < ; for example.
What's the best way to get it to render HTML in fields? Is there something like an unescape filter?
If anyone is interested I resolved it by URI encoding the string using JS encodeURI before it's sent to Shopify. Then used "decodeURI" filter in the order template
I'm using an html parser for ios: https://github.com/FokkeZB/nl.fokkezb.html2as.widget
and the html property for Android in a Ti.UI.Label
but the <ul> and <li> tags aren't recognized. Is it possible a solution?
As mentioned in the comments, ul and li tags are not supported. Only the native functionality of Attributed String is supported. If you looked at the module it links to Attributed String page at the docs.
An attributed string guide can be found here and all included types: http://docs.appcelerator.com/platform/latest/#!/guide/Attributed_Strings
That said, I recommend using either a webview, or better StyledLabel. StyledLabel is a webview with stripped functionality. You can find the module here: https://github.com/appcelerator-archive/ti.styledlabel
Then you can just set html as a property on the label instead of the text property.
Even better would be to prevent using HTML and not output HTML from the backend but instead the list itself as an array in a JSON response, and then visually build the page in the app.
Apps are not really build for HTML
I have dynamic content i'm outputting in a Footer element in a PDF w/ DDX & Coldfusion. Some of the records have long text, and do not automatically wrap, I have placed tags, tried padding/margin, all to no avail.
Any ideas?
It should be easy with <cfdocument format="PDF">. Maybe have org.pdf converted into an image using the make thumbnail action, then use cfdocument and HTML to style the footer? Not most efficient, but easiest.
I am a new objective-c/iPhone developer and am wondering if there is any way to apply formatting to text within a string in a plist?
I have a plist that is an array of dictionaries. Each dictionary contains a few string objects, some of which I would like to contain lists and paragraphs of information. I am calling these strings and displaying them via labels in the UI.
Similar to using <li> and </li> or <b> and </b> in html, I would like to be able to specify parts of a string to be formatted when displayed as a bulleted list, bold, italic, etc.. How could this be accomplished?
With the help of some kind users on this site, I was able to embed the <li> and <b> tags within the xml plist file, however this just resulted in literally printing the tags on the screen.
Thanks in advance for your help!!
It doesn't sound like the fact that your strings are in a plist has much to do with the issue. You'll be storing them that way regardless. But if you want to render HTML-like formatting inside your UI, you have two choices:
Parse the data into an
NSAttributedString, which is
available starting in iOS 3.2. I
believe you'll have to figure out
how to get from the HTML
representation to the right
attributes in the string.
Use a UIWebView and render your HTML directly. This sounds heavyweight, esp for labels, and it probably would be, but you could try.
(Gist here is that there isn't a trivial answer to your question-- the Cocoa frameworks don't natively speak much HTML, and intra-string formatting isn't something that's necessarily easily done.)
For HTML markup to work, you'll need to display the text in a UIWebView, not a UILabel. Check out the UIWebView documentation here.
Update: In response to the other answer, I don't believe UILabel will correctly display an NSAttributedString even on iOS 4. Apple's recommended approach to doing styled text is to use a UIWebView (or draw the text yourself using Core Text, which is significantly more complicated).
I have a case where i'm getting formatted text with <a href ...>, <em>, <br>, ", etc tags, and i'm showing it in a Text View. How can i apply these formats? If i can't, whats the most generic way to remove all these tags?
Thanks,
Mustafa
No, i just want to show the formatted text in non editable NSTextView. or maybe UIWebView, will it automatically handle tags like <em>?
If you want editable text you will have to parse it using a library like Tidy to get just an NSString and then pass that to UITextView's -setText: method
If you need to display HTML, use UIWebView.
If you want to edit HTML as formatted text you will have to roll your own or use private API's.