Web App Styled Text Control to RTF?

Are there any Web App Styled Text controls that can output RTF?

Christian updated MBS DynaPDF to easily place styled text so I’d like to be able to edit styled text on a Web App Page. Unfortunately, the Xojo WebTextArea does not have StyledText like the Desktop TextArea does.

I’d be ok with a Web App html based control, but I’d need it to export RTF…

Any ideas?

I created my control specifically to avoid needing to deal with RTF >_<
I got nothin’, sorry

I am facing a similar issue soon, as I want to use an HTML based control in an iOS app to provide styled text, and I want to print that. So far I have in mind to look at the HTML code, parse the style tags, and print accordingly.

There is an interesting JavaScript project here that prentends to convert HTML to RTF : http://jsfiddle.net/JamesMGreene/2b6Lc/

Haven’t tried it, though. Does not hurt experimenting.

Another strategy would be to use a desktop app on your server to convert HTML to RTF and pass that to the Web app. After all, style tags can be parsed, and it is then not too difficult to apply styles runs to a styled TextArea. The only issue being that most Linux servers simply don’t have the UI installed and therefore cannot run desktop apps. Maybe you want to ask your host.

On Windows Server, it should not be an issue. Unless I am mistaken, desktop apps run just fine.

Michel,

I was thinking of going the same route, using an html style control and then converting the html to rtf. The trick to to find a converter that does the conversion so the look is comparable.

I found a few php converters last night, but haven’t been able to test any yet. Since I’m using MBS DynaPDF, I was going to use MBS PHP as it’s easier to get the result back than with javascript.

I’d be happy with any solution.

Welcome to the world of being a 3rd party vendor. Can’t tell you how many times I’ve heard, “I’d buy it if it only did .”

I confirm that. Get it a lot :slight_smile:

and maybe you guys ask Xojo Inc. to make StyledText class work better on console applications…

uhhh caution! remembers me back to a vb6/asp project… result was: converting rtf2html back and forth doesn’t work for texts with lots of formating (e.g. lists, different colors, paragraphs etc.). RTF is dead I would recommend not to try it… esp. not in web apps

Well, you never know what a client wants. I’ve definitely heard a lot of crazy stuff from them. Whether I take the project or not depends on how crazy.

But I do agree that RTF is a supremely jacked up format that is hard to implement and even harder to make it compatible across all word processors. MS Word alone adds an amazing amount of crap to RTF which, of course, is what everyone wants to be compatible with.

My only reason for wanting an RTF Styled Control in Web Apps is because DynaPDF is adding support for placing styled text with RTF… If I could pass HTML, that would be just as good for my needs. :slight_smile:

Talking about MS Word… so it does even with HTML… have you ever tried to copy & paste content between word and HTML Input mask in IE? It’s a blown f* mix of CSS and HTML Code… and text size increases by factor 100 for just 3 lines of descriptive text.

@Hal: Doesn’t DynaPDF export Text-Only aswell? But I guess you need the formated text…

@Christian Schmitz you should add HTML input to DynaPDF so web users can pair HTML Edit and DynaPDF :wink:

Right. I need styled text. I thought about the back and forth conversion issues. I was thinking of using Tim’s HTML Edit, storing the html and only converting to RTF to make the pdf. Once the PDF is created, I’ll just toss the RTF…

I guess this is not easy… and it leads back to another general question: how to deal with formated content? same question for decades. I am always in favor not to put everything together (e.g. in a database). let the media decide how a given text will be presented. Split huge text blocks in smaller units etc.

this won’t work… or it would just work for basic format options… like bold or italic text…

AFAIR DynaPDF doesn’t do html to pdf because this is what I would have needed for using DynaPDF.

HTML Edit was intentionally designed to be basic (I selected Quill for it’s simplicity,) so I think it could work.

Do you use wkhtmltopdf?

Maybe I should have mentioned that my goal isn’t to create an entire pdf from a styled control, but essentially use something like Tim’s HTML Edit as a replacement of the Xojo WebTextAreas since it doesn’t support styles within the WebTextArea.

What I just added was converting StyledText object to commands for DynaPDF.
I don’t do RTF there. Just take the StyledText class as a vehicle to pass the style information to my plugins.

Where you got StyledText from is not the problem for my DynaPDF plugin.
Now I know my RTF parser is not perfect. It can read/write the RTF dialect used with TextArea on Mac/Win.
If you want styled text, maybe find your now way and convert it yourself to StyledText object to pass it to DynaPDF.
OR directly convert to the formatting commands needed by WriteFText.

That’s a good point Christian. I was bypassing the StyledText object in my head. It’s really RTF —> StyledText —> DynaPDF.

So, does anyone know if there is a way to do this: HTML —> StyledText. In the docs for StyledText, http://documentation.xojo.com/index.php/StyledText it’s easy to pass RTF to StyledText via RTFData.

This thread discusses using a library: converting html code to styled text - General - Xojo Programming Forum like we were discussing at the top of this thread.

just made a trip back to 2001 and searched my VB6 code. I’ll provide it as public domain and as it is with no warranty. Feel free to use it but I would be happy if you would name me as source:

EDIT removed the code will add it as file because it was cropped… gimme second