tables to plain text

J

Jeff Thies

Common problem. Data that is tabular in nature and needs to be sent via
email. Typically that is an order.

That leaves several alternatives.

1) Just send it as HTML and forget plain text or multipart.

2) Custom convert this, which I am so tired of doing.

3) Pad each cells data to a fixed length and display that as a "table".
Trouble if data is longer than the fixed length as that should wrap to
the next line

4) Something like this

$row=~s/.*?<td>(.*?)</td>.*?<td>(.*?)</td>.*/$1:\n$2\n\n/g;

which would give results like this:

first cell:
second cell

first cell second row:
second cell second row

That's problematic for mutiple cell rows, but could probably be hacked out.


This is a common thing to do. There must be some other way of converting
html tables to plain text or perhaps it's not worth the trouble of
sending a complete multipart message. HTML email is terribly common.

Jeff
 
K

Kris

Jeff Thies said:
Common problem. Data that is tabular in nature and needs to be sent via
email. Typically that is an order.
[methods]

This is a common thing to do. There must be some other way of converting
html tables to plain text or perhaps it's not worth the trouble of
sending a complete multipart message. HTML email is terribly common.

Have a link in the e-mail to a page online that shows the data in a
table, or send the table as an attachment, like a Word, PDF or Excel
file.
 
T

The Doormouse

Jeff Thies said:
Common problem. Data that is tabular in nature and needs to be sent via
email. Typically that is an order.

Try saving as text from your browser.

I ahve to do soemthing similar - catch me when I have a minute!
Bye for now .... :)

The Doormouse
 
S

Spartanicus

Kris said:
or send the table as an attachment, like a Word, PDF or Excel
file.

If sending it as an attachment is appropriate then surely one should use
a non proprietary format like RTF.
 
K

Kris

Spartanicus said:
If sending it as an attachment is appropriate then surely one should use
a non proprietary format like RTF.

I am unsure if RTF has tabular support. Besides, *why* send it in a
non-proprietary format?

Of course you know that RTF is a Microsoft invention.
 
J

Jukka K. Korpela

Jeff Thies said:
There must be some other way of converting
html tables to plain text - -

It seems that on Windows, you can cut and paste a table from an HTML
document shown in a browser (IE) window into an Excel window, and Excel
recognizes it as a table (spreadsheet). Then you can use Excel's
"Save As" function to save it as plain text. Whether the appearance is
adequate depends on the data and on the requirements.
 

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

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top