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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Writing a table to a text file.

Status
Not open for further replies.

calista

Programmer
Joined
Jan 24, 2001
Messages
545
Location
US
I would like to be able write a dynamically generated table to a .txt file so it can be printed. I am aware of the CFFILE, tag, but I'm not sure how to use it. Any suggestions? Or, am I doing this the hard way? (wouldn't be the first time!) Calista :-X
Jedi Knight,
Champion of the Force
 
Could you be a little more specific? Is your dynamically-generated table an HTML table or a database table?
 
It's an HTML table. What I'm trying to do is develop and application that can generate written reports. Calista :-X
Jedi Knight,
Champion of the Force
 
which version of CF are you running? On Version 5, it should be fairly easy -- use the CFSaveContent tag:

<cfsavecontent variable=&quot;SavedTable&quot;>

Create your table here.....


</cfsavecontent>

<cffile action=&quot;Write&quot; File=&quot;c:\SavedReports\SavedReport.htm&quot; output=&quot;#SavedTable#&quot;>

If you are running a 4.x version, you can use CFSchedule to grab the report and save it, or you can sort of do the same thing above using CFHttp to get the file and use the cfhttp.filecontent variable to output it to a cffile.

HTH,
Tim P.
 
so you'd wanna remove all the html table tags, and replace them with tabs and newlines so the txt file output looks &quot;report like&quot;?
 
Do you want to essentially write the HTML table to a file? If so, that has nothing to do with HTML. If you want to write to a file, you must use CFFILE to write your output. You CAN write HTML to the file, if you want to, but I don't think that's what you want to do.

We write to text files all the time. It's really quite simple, but if you want it to appear as a table, you will have to figure out the format yourself.

So, ask me some specific questions so I can understand where you are having trouble.
 
CFDude, I AM running 5.0, so thanks for the tip. That works great!

sevex, well, I suppose, but would want to print the table borders and all.

Complicating the issue is the fact that I'm trying to use a .jpeg as a background for the table. Looks great on the screen, doesn't come through on the hard copy (should have clarified sooner what I meant by &quot;print&quot;!) Calista :-X
Jedi Knight,
Champion of the Force
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top