Connecting Tech Pros Worldwide Forums | Help | Site Map

Retain Text Formatting From Web Page

al_johnson111@yahoo.com
Guest
 
Posts: n/a
#1: Dec 1 '06
Apologies for the almost duplicate post but thought this was much
clearer description of the issue than what I originally posted.

I'm trying to do simple integration with a third-party
web application. The app has an 'Action' button on all pages that
can be associate with a JS function. Our application is very
proficient
at parsing text provided it is in some reasonably standard structure.

Is what we are trying to do is have a JS function that can be called
from
any page in their system that will provide a reasonable representation
of the text on the screen. I need something close to
document.body.innerText; the problem with this function is that it
strips spacing from tables so we can't get consistent layout.

The consistent layout I am looking for would be the same as if you did
the following on any page:
1) Select all
2) Copy
3) Paste to notepad

Is there a function or process that will retrieve all text and retain
formatting?


Evertjan.
Guest
 
Posts: n/a
#2: Dec 1 '06

re: Retain Text Formatting From Web Page


wrote on 01 dec 2006 in comp.lang.javascript:
Quote:
Apologies for the almost duplicate post but thought this was much
clearer description of the issue than what I originally posted.
>
I'm trying to do simple integration with a third-party
web application. The app has an 'Action' button on all pages that
can be associate with a JS function. Our application is very
proficient
at parsing text provided it is in some reasonably standard structure.
>
Is what we are trying to do is have a JS function that can be called
from
any page in their system that will provide a reasonable representation
of the text on the screen. I need something close to
document.body.innerText; the problem with this function is that it
strips spacing from tables so we can't get consistent layout.
>
The consistent layout I am looking for would be the same as if you did
the following on any page:
1) Select all
2) Copy
3) Paste to notepad
>
Is there a function or process that will retrieve all text and retain
formatting?
..innerHTML

and then paste it into a new <div>

[.innerText is IE only, it seems]


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
ASM
Guest
 
Posts: n/a
#3: Dec 1 '06

re: Retain Text Formatting From Web Page


Evertjan. a écrit :
Quote:
Quote:
>Is there a function or process that will retrieve all text and retain
>formatting?
>
.innerHTML
>
and then paste it into a new <div>
>
[.innerText is IE only, it seems]
Prefer (if IE compliant ?) :
document.body.appendChild(popup.document.body.clon eNode(true));

copi = popupWindow.document.getElementById('aDiv').cloneN ode(true));
document.getElementById('bDiv').appendChild(copi);

see :
http://stephane.moriaux.perso.wanado...nerHTML_danger


--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Closed Thread