CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> General/Other

 Generating DOC/RTF/PDF

Print topic Send  topic

Author Message
TonyReid


Posts: 159
Posted: 06/27/2007, 12:21 AM

Has anyone used codecharge with msoffice templates or similar?

In a month or so I am going to be doing an application that will add information to an existing word(or similar) document on the fly and then email it to another user.

The users will need to update the templates as and when.

Has anyone got any pointers or suggestions on this?... I must say - I'm a little bit lost with this one.

Thanks in advance,
Tony


ps. forgot to say that I'll probably be doing this in PHP.
_________________
-----------
PHP/indy Game Developer - http://www.AbsoluteBreeze.co.uk
View profile  Send private message
wkempees
Posted: 06/27/2007, 2:41 AM

We do something like this:

Create templates in RTF (you don't want the Word make up), store them on
filesystem.
We occasionally use Jarte to create the templates but nothing is keeping you
from having the user write their own templates through FckEditor in a CCS
created Form.
We have a table holding the references to the templates (id, description,
category_id, fullfilename,..).

As placeholders for the 'holes' we use @fieldname@, could be {fieldname} any
combination of least used specialcharacters.
We have either a SQL supplying the data as a data_set run as the user
selects the document to be processed and/or
we have a table defining the SQL per fieldname (id, templatefieldname,
sql_statement).
If the user is the creator of the template we supply a list of possible
template variables as well as the realm in which they operate.

When run, the selected document from the documentlibrary gets some general
data, does it's SQL Select and creates an output document in the filesystem,
at the end of the process the generated file is the presented to the user as
a RTF, which in turn starts up the users RTF editor (Word, OpenOffice,
WordPad the likes)

We do NOT:
.. Do calculations in the document (for instance an invoice, we do the
calculations in the SQL not in the document);
.. Use extensive graphical stuff like charts and the likes, we do cater for
basic images already in the template.

The basics of the above lies in replacing() the placeholders with the data.
So, open the infile, replace the placeholders and write the output.
Are you on PhP?

Walter

"TonyReid" <TonyReid@forum.codecharge> schreef in bericht
news:246821012b85dd@news.codecharge.com...
> Has anyone used codecharge with msoffice templates or similar?
>
> In a month or so I am going to be doing an application that will add
> information to an existing word(or similar) document on the fly and then
> email
> it to another user.
>
> The users will need to update the templates as and when.
>
> Has anyone got any pointers or suggestions on this?... I must say - I'm a
> little bit lost with this one.
>
> Thanks in advance,
> Tony
>
>
>
> _________________
> Using: CodeCharge Studio 3.0 - IIS, PHP and MSSQL
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.yessoftware.com/
>

TonyReid


Posts: 159
Posted: 06/27/2007, 3:08 AM

Thanks Walter... I have had just had little play with that :)

How do you handle paragraphs in the rtf format? for instance....

  
\par Template file  
\par   
\par }{\insrsid1785645 @bodytext@}{\insrsid25579  
\par }{\insrsid8747603  
\par Date: }{\insrsid1785645 @dated@}{\insrsid8747603   
\par }}

In the above I have two tags - @bodytext@ and @dated@ - a swap out is possible for single words/ lines - but when it comes to paragraphs it doesn't seem to like carriage returns etc.

Thanks again,
Tony

_________________
-----------
PHP/indy Game Developer - http://www.AbsoluteBreeze.co.uk
View profile  Send private message
wkempees
Posted: 06/27/2007, 3:42 AM

Nice, well you handle them by planning ahead.

Here's a snippet:
  
select cpt.omschrijving as 'Actie/Product'  
, date_format(tpt.startdatum,'%d-%m-%Y') as Startdatum  
, replace(tpt.notitie,char(10),'<br>')  as "Verslag"  
from traject_product tpt,  
       traject tjt,  
       contract ctt,  
       contract_product cpt  
where cpt.id = tpt.cpt_id  
and   tjt.id = tpt.tjt_id  
and   ctt.id = tjt.ctt_id  
and tpt.notitie is not NULL  
and   tjt.id = @parent_id@  
order by tpt.startdatum, tpt.id  

in which tpt.notitie is the blob / textarea field in my table
as you can see we replace the char(10) by a <br>
preparing it for html compatibility.

In the template we simply replace @notitie@ with "Verslag"
We do most 90 percent of all formatting in the SQL, to take it away from
the user defining the template.
As an extra suppose we have a datae field "startdate" and the user wants to
be able to
in one and the same template present the startdate as dd-mm-yy as well as
dd-MMM-yyyy
we simply offer them two template variables like startdate_short and
startdate_long.

Also in (invoice) calculations we provide all the nett amounts, the subs and
the totals in- and excluded VAT.
It is a lot of work but only once and a lot easier that to teach them how to
do calculations.
Also customers tend to accept the fields you offer them and not think about
what they miss.

Walter



TonyReid


Posts: 159
Posted: 06/27/2007, 3:52 AM

Thanks Walter,

That's a great help :)

I am actually looking forward to this project starting :)

Thanks again,
Tony

_________________
-----------
PHP/indy Game Developer - http://www.AbsoluteBreeze.co.uk
View profile  Send private message
wkempees
Posted: 06/27/2007, 3:58 AM

You're welcome.

PM available for you know...

Walter

"TonyReid" <TonyReid@forum.codecharge> schreef in bericht
news:24682416fce5a9@news.codecharge.com...
> Thanks Walter,
>
> That's a great help :)
>
> I am actually looking forward to this project starting :)
>
> Thanks again,
> Tony
>
> _________________
> Using: CodeCharge Studio 3.0 - IIS, PHP and MSSQL
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.yessoftware.com/
>

marcwolf


Posts: 361
Posted: 06/30/2007, 6:45 AM

One other possibility is MHT files. These are HTML files that are in a MIME format where all headers, pictures, etc are contained within one document.

The trick to using these is that ALL HTML attributes are prefixed with a 3D

i.e. style=3D"Color"

As such you can easily change and insert pure HTML into the document (Generated by CCS, or FCKeditor etc.

When you hace completed the work you can then rename it drom MHT to DOC and when IE recieves this it will load it up as a WORD document.

It also preserve page breaks, Header's and footer, and any WORD form fields like current date time.

I found this after a long battle with XML Word formatting, and this is SO much easier.

Take care..

Dave
_________________
' Coding Coding Coding
Keep Those Keyboards Coding.
Raw Code!!!!!!!
View profile  Send private message
Edd


Posts: 547
Posted: 07/02/2007, 7:14 PM

Dave,

You bloody genius - I have been having a crap time trying to build mailmerge documents for clients and having no chance of success with RTF and XML Word.

Many thanks - Edd
_________________
Accepting and instigating change are life's challenges.

http://www.syntech.com.au
View profile  Send private message
marcwolf


Posts: 361
Posted: 07/04/2007, 5:46 AM

*Blushes*

Thanks for the complements. Just glad to help a fellow Aussie (yes I'm Brisbane way)

MHT is a nice format as you can load it into Word, edit it as a Word document and then save it either as a DOC, RTF, or a MHT.

It's also great for taking existing Word documents and converting them into a programatically editable format.

I have yet to try importing an MHT file into something like ABCPdf to see how it converts the images. If it does then one has a way to lock the documents after generating.

Take care, and always happy to help where I can

Dave
_________________
' Coding Coding Coding
Keep Those Keyboards Coding.
Raw Code!!!!!!!
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.