Chris__T
Posts: 339
|
Posted: 07/12/2010, 2:34 PM |
|
I'd like to take certain fields from a record (name, address, etc) and have this data setup to print for an envelope.
Is there a way to do this in CCS? Or do I have to export to Word?
|
|
|
lboeldt
Posts: 53
|
Posted: 07/12/2010, 10:54 PM |
|
The following HTML code will generate a printable envelope format. You can work this into your CSS page.
You'll have to set the paper size of your printer to envelope #10 to print correctly.
<html>
<head>
<style>
@page { size: 9.5in 4.125in }
#content {
width: 892px;
height: 392px;
border: none;
Padding: 24px;
font-size: 12pt;
font-family: arial;
/* for firefox, safari, chrome, etc. */
-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
/* for ie */
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
}
</style>
</head>
<body>
<div id="content">
FROM NAME<br/>
FROM ADDRESS<br/>
FROM CITY, STATE ZIP<br/>
<br/><br/><br/><br/><br/>
<p style="margin-left: 420px;">
TO NAME<br/>
TO ADDRESS<br/>
TO CITY, STATE ZIP<br/>
</p>
</div>
</body>
</html>
|
|
|
Chris__T
Posts: 339
|
Posted: 07/13/2010, 1:49 PM |
|
wow Awesome!
How do I get my database fields into the TO NAME, TO ADDRESS, TO CITY,STATE ZIP areas? Do Database fields work outside of a form?
|
|
|
datadoit
|
Posted: 07/13/2010, 2:01 PM |
|
Use custom code in the page's BeforeShow event to pull values from the
database. Sample here:
http://docs.codecharge.com/studio40/html/ProgrammingTec...Values.html?toc
|
|
|
Chris__T
Posts: 339
|
Posted: 07/13/2010, 2:32 PM |
|
I've tried the Multiple and Single samples and I keep getting an error around this line:
Microsoft VBScript runtime error '800a01f4' Variable is undefined: 'DBMYSQL_PERMIT2000' /Permit3/letters/envelope1_events.asp, line 57
MYSQL_PERMIT2000 is my database connection, so I just substituted where it had Connection1 in the samples.
DBConnection1 = DBMYSQL_PERMIT2000
|
|
|
Chris__T
Posts: 339
|
Posted: 07/13/2010, 2:41 PM |
|
ContactName.Value = CCDLookUp("Contact_Name","permit","Permit_ID=" & DBMYSQL_PERMIT2000.ToSQL(CCGetFromGet("Permit_ID","0"),ccsInteger), DBMYSQL_PERMIT2000)
Is my code. I'm trying the single variable to just get the TO NAME (called ContactName)
But since the page is just html, and there is no form (record, etc) to link to the database, maybe that's why I'm getting the database error...
|
|
|
lboeldt
Posts: 53
|
Posted: 07/13/2010, 11:23 PM |
|
I made a mini CCS project that uses the envelope template above. I created a blank page named "envelope" and generated code. Then I opened the page's HTML in CSS and pasted in the template code from above.
I cleared out the place holders for the to address (between the <p></p> tags).
Then I inserted a grid with the desired fields from the address table between the <p></p> tags.
I set the grid to filter on the ID field. ( envelope.asp?id=1 )
After the grid was generated I cleaned out the TABLE, TR, TH and TD tags but kept the <!-- BEGIN/END --> tags intact. I then layed out the fields according to the template above.
Here's the code http://media.boeldt.net/ccs/envelope.zip. The first thing you need to do after opening the project is re-set the location of the MSAccess database in the connection "conn".
Let me know if this helps.
|
|
|
Chris__T
Posts: 339
|
Posted: 07/14/2010, 7:53 AM |
|
ah, a grid. I was thinking along that lines, but never tried that.
I will try your implementation and see how it works. Thank you!
|
|
|
Chris__T
Posts: 339
|
Posted: 07/14/2010, 11:34 AM |
|
It looks like it worked! Thanks lboeldt!
I've just got to deal with some layout issues...it was printing the FROM stuff in the TO area, and it looks like i might have to adjust some spacing/margin items. But other than that, it is working!
|
|
|
|