Retain Text Formatting From Web Page

A

al_johnson111

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?
 
E

Evertjan.

wrote on 01 dec 2006 in comp.lang.javascript:
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]
 
A

ASM

Evertjan. a écrit :
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.cloneNode(true));

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

see :
http://stephane.moriaux.perso.wanadoo.fr/truc/innerHTML_danger
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,023
Latest member
websitedesig25

Latest Threads

Top