Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Building a Word document without using Word

Status
Not open for further replies.

EdwardMartinIII

Technical User
Sep 17, 2002
1,655
US
Is there a way to build a Word document (such as with PHP?) without actually using Word?

Here's what I'm trying to do:

We run a CRM called Sugar, and it's my understanding that Sugar's all PHP under the hood, which is fine. I can sorta use PHP to build HTML.

We also produce documents via Word templates. Someone checks a few boxes, fills in a few fields, and then clicks [Submit] and the data is emailed to me. I take it and plug it into a Word template by updating all the fields.

What I'm experimenting with is this: Is there a way, in a PHP environment, to present those folks with the same data-collecting forms page, and have some automated PHP script build the documents from various text components, and email the DOCUMENT to me.

Some things that might complicate the matter:

1. The documents contain long and complicated multilevel lists. I'm okay if there's a programmatic way of generating those, though.

2. The documents contain images. I'm okay if there's a programmatic way of including links, though.

Thoughts? Ideas? Suggestions?

Right now, my method is... acceptable... but being able to further automate this, and get it all under one tool would be awesomeness in a box normally labeled "not as awesome as some things."

Thanks!


[monkey] Edward [monkey]

"Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!" -- inventor of the cat door
 
Hi Edward,

Does it really need to be Word documents?
What good is data if you cannot evaluate it where it belongs, i.e. in databases.

Perhaps you would do just fine with gathering the data in XML form and later transform these XML using XSLFO.
Check it out:

Might be just your magic wand!
:)

[navy]"We had to turn off that service to comply with the CDA Bill."[/navy]
- The Bastard Operator From Hell
 
Yeah, when I last talked with my boss about it, we needed to be able to generate PDF and Word docs, in case someone wanted a draft doc, but wanted to be able to make changes to it.

I didn't mention PDF earlier because I can convert Word >> PDF easy-peasy.

It's that "has to be Word" part that gets me.


[monkey] Edward [monkey]

"Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!" -- inventor of the cat door
 
...although this is pretty cool, by the way!

[monkey] Edward [monkey]

"Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!" -- inventor of the cat door
 
A few questions
You're trying to get Sugar to produce the document?
Can it be RTF?
Would you be willing to implement a non PHP method that was still hands-off?
Are you using Outlook for your email client?
 
You're trying to get Sugar to produce the document?"

I'm still kinda new to the use of Sugar. If I understand correctly, it has the capability of running PHP, and if I understand correctly, it was hoped that this meant a PHP tool could be developed to produce documents.

"Can it be RTF?"

I suppose if an RTF document can include multilevel lists and images (off the top of my head, these things seem to be the biggest hassle), there's no reason it can't be an RTF. An RTF could also be opened in Word, and presumably wouldn't change much. Could an RTF be used to produce a PDF, or would an RTF solution first need to push the document into Word?

"Would you be willing to implement a non PHP method that was still hands-off?"

Yeah, we're open to ideas. I admit my inexperience with Sugar and some of the other technologies could very easily contribute to a myopia on my part. 8)

"Are you using Outlook for your email client?"

Yes. That would be preferred.


[monkey] Edward [monkey]

"Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!" -- inventor of the cat door
 
First question was mere curiosity. I got nowhere to follow up on that one :)

I'm not entirely certain of the limites of RTF. I will assume images are off limits to RTF.

so now for the last two.

You can have the form email trigger a VBA script which certainly CAN create a new word document (and even export to PDF easily enough in Office 2007)

A post in this forum: concerning exactly that could take you down that path. Understandably, most people will want to see that you've researched the code some and have tried to put something together. A good starting point, I think, would be to use the macro recording inside of word as you do your updates. That code can be used from Outlook triggered on the receipt of an email.

Maybe you can save the data from the form in a standard format and use it in a mail merge in word? Hard to say without seeing either the template or the form data.

Anyway, that's all I have time to offer before stepping into class. Good luck!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top