• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: WOText Conversion to HTML On The Fly
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: WOText Conversion to HTML On The Fly


  • Subject: Re: WOText Conversion to HTML On The Fly
  • From: "Jonathan Fleming" <email@hidden>
  • Date: Tue, 01 Jul 2003 14:57:50 +0100

From: Marek Wawrzyczny <email@hidden>
To: Hsu <email@hidden>
CC: Dan Faber <email@hidden>, email@hidden
Subject: Re: WOText Conversion to HTML On The Fly
Date: Mon, 30 Jun 2003 15:40:34 +1000

I think the problem is far more complex than that, we ran into it ourselves.

Situation:
==========
A user copies a bunch of formatted text from a MS Word document. Pastes it into a form on the website.


Problem:
========
MS Word puts invisible formatting characters into the text, the clipboard preserves these characters.


Symptoms:
=========
the website suddenly displays these weird characters, usually as '?'. Get one irritated customer on the phone.


Solution:
=========
Well in our application we attacked this from two areas.

One , we asked the users to paste the text into a plain text file first and then onto the form. That at removed the chars. Won't please the customers too much.

Two, I believe we attempted to remove non ASCI chars on input (on form submit). This is also a good place to do any other formatting, <P>, <BR> and so on. That way there's no need to do any conversions on data display.

all the above is spot-on, but this last paragraph... will the user be able to use this method to copy a formated document say from a word.doc or a .rtf document, paste it in and maintain the formatting they applied? (probably not unless they made it html in the first place - the very format the user does not understand.)


Are there any other ways around this problem. At the moment I am being sent their formatted word documents by email for me to convert manually because they don't know how to convert them or use the converted saved as... files, and if they understand that much and can view the source code they freeze at the sight of the source code feeling it's all too technical.

I think I may have to go with a third party program that has all the same sort of formating buttons on the text box input as the user might be used to in a word processing program like Word.
Any ideas - unless there is a WO solution?


Regards
Jonathan :^/


On Monday, Jun 30, 2003, at 15:00 Australia/Sydney, Hsu wrote:

Couldn't you just bind to a WOString with escapeHTML set to "NO" ?

Karl

On Sunday, June 29, 2003, at 08:25  PM, Dan Faber wrote:

I do a lot of presenting text from Strings. I paste the string (or  text
from a word processing document) into a WOTextBox and then can
immediately show the text as HTML. In my case, I am currently doing
some processing of the text before going to HTML, in this case taking
xml text and creating java objects which then present their text on  the
web page.

By far the easiest way I have found to do this is:
1. create another component ("Message component" or MC) and place it  in
the webobjects builder page where you want the HTML text to appear as  a
"custom web object", the last icon on the bar to the right.
2. strip the MC of the HTML tags, and put in "append to response"  code,
which adds the text to the response. Here is an example:

import com.webobjects.foundation.*;
import com.webobjects.appserver.*;
import com.webobjects.eocontrol.*;
import com.webobjects.eoaccess.*;

public class DisplayNote extends WOComponent {
         protected WOComponent returnPage;

     public DisplayNote(WOContext context) {
         super(context);
     }

     public void appendToResponse (WOResponse aResponse, WOContext
aContext) {

         //we need to add the note text at the bottom
         TPStringToHTML stringConverter = new TPStringToHTML();
         if (parent() instanceof EditMessageText) {
              textToDisplay = ((EditMessageText)parent()).inputText();
	}
//use other checks here to reuse this component for other parent
components...



aResponse.appendContentData(stringConverter.convertTextToHTML(currStri ng
));
         aResponse.appendContentString("<br>");
     }

  }

TPStringToHTML is simply a formatter I wrote to convert all the '\r'
characters to <br> tags. It takes a string as input, and outputs  NSData
with the changes made.

This seems to be working real well for me, and I am using it in  several
places. Hope this helps.



--

I am going to pose a question. Can you answer?
Please ask your question.
I have already asked.
I have already answered.
What did you answer?
What did you ask?
I asked nothing.
I answered nothing.

Homepage:
http://homepage.mac.com/khsu/index.html
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.




Marek Wawrzyczny

software engineer
-------------------------->
ish group pty ltd
7 Darghan St Glebe 2037 Australia
phone +61 2 9660 1400 fax +61 2 9660 7400
http www.ish.com.au | email email@hidden
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.

_________________________________________________________________
Stay in touch with absent friends - get MSN Messenger http://www.msn.co.uk/messenger
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: WOText Conversion to HTML On The Fly
      • From: email@hidden (Anjo Krank)
  • Prev by Date: Re: Deploying on Windows
  • Next by Date: Re: WOText Conversion to HTML On The Fly
  • Previous by thread: Client sub project Problem
  • Next by thread: Re: WOText Conversion to HTML On The Fly
  • Index(es):
    • Date
    • Thread