"shimmyshack" <ma********@gmail.comwrote in message
news:11**********************@31g2000cwt.googlegro ups.com...
| On 3 Mar, 16:25, "Eric Layman" <namyalcire[at no spam]gmail.com>
| wrote:
| "Steve" <no....@example.comwrote in message
| >
| news:CO*************@newsfe06.lga...
| >
| >
| >
| >
| >
| "Eric Layman" <namyalcire[at no spam]gmail.comwrote in message
| news:11*************@sp6iad.superfeed.net...
| | Hi,
| |
| | I have fields from textareas.
| |
| | With a click of a button, php is able to grab these fields and by
using
| | header(), convert the output to Ms Word doc.
| |
| | But the outcome of the word doc doesn't wrap the text in textarea.
| |
| | the result is one very veyr long string of text which stretch MS
word
| all
| | the way
| |
| | how to over come that?
| |
| | I've tried different wrap attributes.
| >
| hard to say without looking at the code you're using.
| >
| are you on a windows server? are you creating a com ms word doc object
and
| putting the text in that way? or, are you creating a standard text
file
| and
| calling it word (i.e. someDoc.doc or setting the header for the
browser as
| an ms word doc)?
| >
| if on windows, i'd go the com route and remove any soft-returns that
may
| be
| in the text. then, i'd use word's om to format the boundries, color,
font,
| etc. of the text as it should appear in word. what is word's om? the
| easiest
| way to get what you need is to open word, record a macro, type and
format
| some text the way you want it to look as if it were really your
output,
| stop
| recording your macro. from there, just edit the macro. you will see
the
| source code and see all the methods/properties you will need to know
and
| work with. problem solved.
| >
| if not on windows, i'd get a good conversion tool, and even think
about
| using xml/xslt as an abstraction layer. that combination will allow
you
| not
| only to convert to word but to pdf and others as well.
| >
| anyway, hth.
| >
| Thanks Steve.
| >
| Let me explain further:
| >
| I have a form which has textareas and allows user inputs which saves to
| mysql database.
| >
| The administrator is able to view these textarea inputs by clicking a
| button. This button will pull out these information and generate a word
| document.
| >
| Problem is that when word documents are generated, the text in these
word
| documents are stretchhhhhhhhhhhhhhhhhhhhhhhhhhhhhh till the very extreme
| right end.
| >
| These texts in the word doc are the data that is keyed in by end users
via
| the textarea.
| >
| It seems that the generated word doc is not able to capture the
linebreaks
| within the textarea.
| >
| Pls advise.
| >
| Thanks
| >
| Posted Via Usenet.com Premium Usenet Newsgroup Services
| ----------------------------------------------------------
| ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
| ----------------------------------------------------------
|
http://www.usenet.com
|
| you can simply exchange the \n style line breaks from the textarea to
| \r style line breaks or \r\n style.
|
| However to immediately create word docs with absolutely minimal
| memory, and no need to start up a COM instance of word, just create a
| word doc and style it as you wish the admin to see, then put some text
| in the place where the textarea text will be. Put something easy to
| spot like ************_______********
| then save as RTF, open in text edito and swap the
| ************______******** for {$TEXT}
| then start the whole page off using
| <?php $rtf = <<<RTF
| and end it with
| RTF;
|
| this then you save as rtfdoc.php
| and now you just take the textarea as $TEXT and set the header content
| type msword, and include rtfdoc.php and echo it
| if you serve the stream gzipped it will come out much smaller than an
| actual word doc.
| the whole thing works immediately and of course is rendered in word
| just the same as a doc.
| It works on linux server too, and can be opened in all version of
| word, openoffice wordpad whatever.
|
| just a thought for the future
that's a great thought...i suppose a replace is much easier to do and not
platform dependent.