on 05-13-2006 6:54 AM
Hi all
i am struggling to take the print in webdynpro SO for,
i have tried the following code using your valuable help
Pls Guide me futher more.Nobody giving correct solution so for i.e Step by Step from the beginning itself
pls help us in this regarding
****The following code is the XSL Template
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<html>
<head>
<title></title>
<script language ="javascript">
function prin()
{
document.frm.jd.src="C:/emp.jpg";
javascript:print();
}
</script>
</head>
<body>
<form name="frm">
*********************Header Part Start
<table bgcolor="" cellpadding="10">
<tr><th align="left"><font color="#A52A2A">Name</font></th>
<th align="left"><font color="#A52A2A">Address1</font></th>
<th align="left"><font color="#A52A2A">Address2</font></th>
<th align="left"><font color="#A52A2A">State</font></th>
<th align="left"><font color="#A52A2A">Phone</font></th></tr>
<hr/>
********Header Part End
<xsl:for-each select="Dhina/Customer-Details">
***************Details Part Start
<tr>
<td><font color="blue"><xsl:value-of select="CusName"/></font></td>
<td><font color="blue"><xsl:value-of select="CusAdd1"/></font></td>
<td><font color="blue"><xsl:value-of select="CusAdd2"/></font></td>
<td><font color="blue"><xsl:value-of select="CusState"/></font></td>
<td><font color="blue"><xsl:value-of select="phoneno"/></font></td>
</tr>
***************Details Part End
</xsl:for-each >
</table>
<img src="C:/PRINT13.ICO" name="jd" onclick="prin)"></img>
</form>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
First Page as usual Header part will print
I want to print the Header part details in the next page when the no of pages goes to more than one when we click the print button from The IFRAME UI Element.
Under the Header part, Details part should print like in MSword or Crystal report
************The following part in XML
<?xml version='1.0' ?><?xml-stylesheet type='text/xsl' href='Sample.xsl' ?><Dhina><Customer-Details><CusName>Dhina</CusName><CusAdd1>Add1</CusAdd1><CusAdd2>Add2</CusAdd2><CusState>TamilNadu</CusState><phoneno>99999</phoneno></Customer-Details><Customer-Details><CusName>Karan</CusName><CusAdd1>Add3</CusAdd1><CusAdd2>Add4</CusAdd2><CusState>TamilNadu</CusState><phoneno>11111</phoneno></Customer-Details><Customer-Details><CusName>Karthi Keyan</CusName><CusAdd1>Add5</CusAdd1><CusAdd2>Add6</CusAdd2><CusState>Karnataka</CusState><phoneno>22222</phoneno></Customer-Details></Dhina>
*************End
Pls Guide us how to control the Header and footer part in the IFrame and also can we control the
Page skip thru XSL
We have attached the Report Screen also
Pls reply as soon as possible
Regards
Dhinakar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear VS
The previous Answer was very helpful for me and also i rewarded to you.
The same i want the following criteria with the coding.
Guide us how to control the Header and footer part in the IFrame and also can we control the
Page skip thru XSL
i saw your URl i.e W3C Print Profile doc.
but i didn't get exact coding to control the header and footer and page Skip.
Pls reply as soon as possible
Regards
Dhinakar
dhinakar,
The were section starting with @page in stylesheet. This is what you need. See http://www.xml.com/pub/a/2005/01/19/print.html for samples.
However, currently only Mozilla seems to have support for this.
For IE please try "Print Templates":
http://www.webreference.com/js/column89/
http://www.webreference.com/js/column91/
http://www.webreference.com/js/column92/
http://www.webreference.com/js/column93/
http://www.webreference.com/js/column94/
http://www.webreference.com/js/column95/
Also I don not understand what you mean with "page skip"...
VS
Dear Vs
***********
As you said in your Previous mail like the below coding
to avoid the Print button in the printed sheet.
its working perfectly.
<style type="text/css" media="print">
a { display: none; }
</style>
************
i want the coding like above what you mentioned exactly.
I want to print the repeated header and footer like in Word or Crystal report.i.e
header Part Like " Name " "Sex" " Phone No"
-
details Part Like Kumar M 111
VS M 222
Dhina M 666
Kala F 777
-
Next Page Again I have to the show the header part
and after that t have to print details as usual.
header Part Like " Name " "Sex" " Phone No"
-
Page Break Also i wanted.Suppose say for example
A4 size to print 50 lines.After 50 lines i have to go
Another page with header and footer like in the word or
RTF format in VB.
Did you get my point.now
PLs help me in this regard
dhinakar,
Seems that your task even simpler
At least, table header / footer is repeated without CSS.
For this try to Create table like:
<table>
<thead>
<tr>
<th>Header1</th>
<th>Header2</th>
</tr>
</thead>
<tbody>
<tr>
<td>data1</td>
<td>data2</td>
</tr>
</tbody>
<tfoot>
<tr>
<th>Footer1</th>
<th>Footer2</th>
</tr>
</tfoot>
</table>
AFAIK, browsers repeat THEAD / TFOOT on every page when printing tables.
VS
Dera VS
Page Break Also i wanted.Suppose say for example
A4 size to print 50 lines.After 50 lines i have to go
Another page with header and footer like in the word or
RTF format in VB.
Did you get my point.
I.e How to catch the Endingpart in First Page.
You said that
AFAIK, browsers repeat THEAD / TFOOT on every page when printing tables.
where we call the THEAD / TFOOT.how we know the page should end in the first page and immediatly we have to show the header part in the next page and after that we show the details part......
Pls Explain the above part in details.
How to call the Thead/Tfoot in HTML or in CSS.
Pls Send the Coding from the Beginning.
Help me.
Regards
Dhinakar
dhinakar,
Sadly, I do not remeber all this CSS jazz for page breaks (thanks to WD, btw
Here is your original code with THEAD/TFOOT:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<html>
<head>
<title></title>
<script language ="javascript">
function prin()
{
document.frm.jd.src="C:/emp.jpg";
javascript:print();
}
</script>
</head>
<body>
<form name="frm">
*********************Header Part Start
<table bgcolor="" cellpadding="10">
<b><thead></b>
<tr style="border-bottom: 2px solid gray"><th align="left"><font color="#A52A2A">Name</font></th>
<th align="left"><font color="#A52A2A">Address1</font></th>
<th align="left"><font color="#A52A2A">Address2</font></th>
<th align="left"><font color="#A52A2A">State</font></th>
<th align="left"><font color="#A52A2A">Phone</font></th></tr>
<b></thead></b>
<b><tbody></b>
<xsl:for-each select="Dhina/Customer-Details">
<tr>
<td><font color="blue"><xsl:value-of select="CusName"/></font></td>
<td><font color="blue"><xsl:value-of select="CusAdd1"/></font></td>
<td><font color="blue"><xsl:value-of select="CusAdd2"/></font></td>
<td><font color="blue"><xsl:value-of select="CusState"/></font></td>
<td><font color="blue"><xsl:value-of select="phoneno"/></font></td>
</tr>
</xsl:for-each >
<b></tbody></b>
<b><tfoot></b>
<tr><td colspan="5">YOUR FOOTNOTE HERE</td></tr>
<b></tfoot></b>
</table>
<img src="C:/PRINT13.ICO" name="jd" onclick="prin)"></img>
</form>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
P.S. you may also consider WD Adobe Interactive Forms (i.e. PDF instead of HTML) for fine-grain control over printer-friendly documents.
VS
Dear VS
i clearly under stood YOur coding
i wrote all the following code
with in <thead> or with in <tfoot>
no probs so for
***************************************
<thead>
<tr style="border-bottom: 2px solid gray"><th align="left"><font color="#A52A2A">Name</font></th><th align="left"><font color="#A52A2A">Address1</font></th><th align="left"><font color="#A52A2A">Address2</font></th><th align="left"><font color="#A52A2A">State</font></th><th align="left"><font color="#A52A2A">Phone</font></th></tr>
</thead>
***************************************
****
Note
*****
But My Q is?
i am asking the below part only? ok
how to call the <thead> and <tfoot> again in HTML or CSS
this is only very important.
where we call the THEAD / TFOOT.how we know the page should end in the first page and immediatly we have to show the header part in the next page and after that we show the details part......
Pls Explain the above part in details.
How to call the Thead/Tfoot in HTML or in CSS.
Pls help me
So for i am stuggling how to call again <thead> or <tfoot>
and also page break
Regards
Dhinakar
Hi,
If you want the <thead> and <tfoot> to repeat at every new page, then your xsl should give you a html like
<div>
<table>
<thead/>
<tbody>
<tr><td/></tr>
</tbody>
<tfoot/>
</table>
</div>
<div>
<table>
<thead/>
<tbody>
<tr><td/></tr>
</tbody>
<tfoot/>
</table>
</div>
...
Then you can add a style attribute like
<style type="text/css">
div{
page-break-before : always
}
</style>
Regards,
Satyajit.
Dear Chatyajit
We put your code in our Html part like
******************************Start
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<html>
<head>
<title></title>
<style type="text/css" media="print"> a </style>
<style type="text/css">
div{
page-break-before : always
}
</style>
</head>
<div>
<table bgcolor="" RULES="GROUPS" cellpadding="10" >
<thead>
<tr><th align="left"><font color="#A52A2A">Name</font></th>
<th align="left"><font color="#A52A2A">Address1</font></th>
<th align="left"><font color="#A52A2A">Address2</font></th>
<th align="left"><font color="#A52A2A">State</font></th>
<th align="left"><font color="#A52A2A">Phone</font></th></tr>
<hr/>
</thead>
<tbody>
<xsl:for-each select="Dhina/Customer-Details">
<tr>
<td><font color="blue"><xsl:value-of select="CusName"/></font></td>
<td><font color="blue"><xsl:value-of select="CusAdd1"/></font></td>
<td><font color="blue"><xsl:value-of select="CusAdd2"/></font></td>
<td><font color="blue"><xsl:value-of select="CusState"/></font></td>
<td><font color="blue"><xsl:value-of select="phoneno"/></font></td>
</tr>
</xsl:for-each >
</tbody>
<tfoot>
<tr><td colspan="5">YOUR FOOTNOTE HERE</td></tr>
</tfoot>
</table>
</div>
<a href="javascript:print()"> print </a>
</html>
</xsl:template>
</xsl:stylesheet>
*******************************End
Again here Browser couldn't print the header and footer when it goes to next page
guide us what's wrong the above said code
Regards
Dhinakar
Hi,
Actually it's working but you have only one div. You need to repeat the div tags. Inside each div you need to have this structure:
<table>
<thead/>
<tbody>
<tr><td/></tr>
</tbody>
<tfoot/>
</table>
So you will need to modify your xsl file. Can you share a sample xml file that you are using. I can give you the xsl.
Regards,
Satyajit.
Dear Satyajit
*********************My Xml Start
<?xml version='1.0' ?><?xml-stylesheet type='text/xsl' href='Sample.xsl' ?><Dhina><Customer-Details><CusName>Dhina</CusName><CusAdd1>Add1</CusAdd1><CusAdd2>Add2</CusAdd2><CusState>TamilNadu</CusState><phoneno>99999</phoneno></Customer-Details><Customer-Details><CusName>Karan</CusName><CusAdd1>Add3</CusAdd1><CusAdd2>Add4</CusAdd2><CusState>TamilNadu</CusState><phoneno>11111</phoneno></Customer-Details><Customer-Details><CusName>Karthi Keyan</CusName><CusAdd1>Add5</CusAdd1><CusAdd2>Add6</CusAdd2><CusState>Karnataka</CusState><phoneno>22222</phoneno></Customer-Details><Customer-Details><CusName>Karthi Keyan</CusName><CusAdd1>Add5</CusAdd1><CusAdd2>Add6</CusAdd2><CusState>Karnataka</CusState><phoneno>22222</phoneno></Customer-Details><Customer-Details><CusName>Karthi Keyan</CusName><CusAdd1>Add5</CusAdd1><CusAdd2>Add6</CusAdd2><CusState>Karnataka</CusState><phoneno>22222</phoneno></Customer-Details><Customer-Details><CusName>Karthi Keyan</CusName><CusAdd1>Add5</CusAdd1><CusAdd2>Add6</CusAdd2><CusState>Karnataka</CusState><phoneno>22222</phoneno></Customer-Details><Customer-Details><CusName>Karthi Keyan</CusName><CusAdd1>Add5</CusAdd1><CusAdd2>Add6</CusAdd2><CusState>Karnataka</CusState><phoneno>22222</phoneno></Customer-Details><Customer-Details><CusName>Karthi Keyan</CusName><CusAdd1>Add5</CusAdd1><CusAdd2>Add6</CusAdd2><CusState>Karnataka</CusState><phoneno>22222</phoneno></Customer-Details><Customer-Details><CusName>Karthi Keyan</CusName><CusAdd1>Add5</CusAdd1><CusAdd2>Add6</CusAdd2><CusState>Karnataka</CusState><phoneno>22222</phoneno></Customer-Details><Customer-Details><CusName>Karthi Keyan</CusName><CusAdd1>Add5</CusAdd1><CusAdd2>Add6</CusAdd2><CusState>Karnataka</CusState><phoneno>22222</phoneno></Customer-Details><Customer-Details><CusName>Karthi Keyan</CusName><CusAdd1>Add5</CusAdd1><CusAdd2>Add6</CusAdd2><CusState>Karnataka</CusState><phoneno>22222</phoneno></Customer-Details><Customer-Details><CusName>Karthi Keyan</CusName><CusAdd1>Add5</CusAdd1><CusAdd2>Add6</CusAdd2><CusState>Karnataka</CusState><phoneno>22222</phoneno></Customer-Details><Customer-Details><CusName>Karthi Keyan</CusName><CusAdd1>Add5</CusAdd1><CusAdd2>Add6</CusAdd2><CusState>Karnataka</CusState><phoneno>22222</phoneno></Customer-Details><Customer-Details><CusName>Karthi Keyan</CusName><CusAdd1>Add5</CusAdd1><CusAdd2>Add6</CusAdd2><CusState>Karnataka</CusState><phoneno>22222</phoneno></Customer-Details><Customer-Details><CusName>Karthi Keyan</CusName><CusAdd1>Add5</CusAdd1><CusAdd2>Add6</CusAdd2><CusState>Karnataka</CusState><phoneno>22222</phoneno></Customer-Details><Customer-Details><CusName>Karthi Keyan</CusName><CusAdd1>Add5</CusAdd1><CusAdd2>Add6</CusAdd2><CusState>Karnataka</CusState><phoneno>22222</phoneno></Customer-Details><Customer-Details><CusName>Karthi Keyan</CusName><CusAdd1>Add5</CusAdd1><CusAdd2>Add6</CusAdd2><CusState>Karnataka</CusState><phoneno>22222</phoneno></Customer-Details><Customer-Details><CusName>Karthi Keyan</CusName><CusAdd1>Add5</CusAdd1><CusAdd2>Add6</CusAdd2><CusState>Karnataka</CusState><phoneno>22222</phoneno></Customer-Details><Customer-Details><CusName>Karthi Keyan</CusName><CusAdd1>Add5</CusAdd1><CusAdd2>Add6</CusAdd2><CusState>Karnataka</CusState><phoneno>22222</phoneno></Customer-Details><Customer-Details><CusName>Karthi Keyan</CusName><CusAdd1>Add5</CusAdd1><CusAdd2>Add6</CusAdd2><CusState>Karnataka</CusState><phoneno>22222</phoneno></Customer-Details><Customer-Details><CusName>Karthi Keyan</CusName><CusAdd1>Add5</CusAdd1><CusAdd2>Add6</CusAdd2><CusState>Karnataka</CusState><phoneno>22222</phoneno></Customer-Details><Customer-Details><CusName>Karthi Keyan</CusName><CusAdd1>Add5</CusAdd1><CusAdd2>Add6</CusAdd2><CusState>Karnataka</CusState><phoneno>22222</phoneno></Customer-Details></Dhina>
*********************End
i have send already XSL part
*********************
This xml source is created from webdynpro,
Depending on Select Query(SQL) the source may vary.
why and where we need to repeat the <div> in my HTML part
Regards
Dhinakar
Hi,
Try this xsl out. It might have some problems but the basic thing should work. I have put in some colours :). Remove them if you don't like.
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<html>
<head>
<title></title>
<script language ="javascript">
function prin()
{
document.frm.jd.src="C:/emp.jpg";
javascript:print();
}
</script>
<style type="text/css" media="print">
div.tableContainer {overflow: visible; }
table>tbody {overflow: visible; }
td {height: 14pt;}
thead td {font-size: 11pt; }
tfoot td {
text-align: center;
font-size: 9pt;
border-bottom: solid 1px slategray;
}
thead {display: table-header-group; }
tfoot {display: table-footer-group; }
thead th, thead td {position: static; }
</style>
</head>
<body>
<form name="frm">
<div id="container">
<div class="tableContainer" id="data">
<table bgcolor="" cellpadding="10">
<thead>
<tr style="border-bottom: 2px solid gray"><th align="left"><font color="#A52A2A">Name</font></th>
<th align="left"><font color="#A52A2A">Address1</font></th>
<th align="left"><font color="#A52A2A">Address2</font></th>
<th align="left"><font color="#A52A2A">State</font></th>
<th align="left"><font color="#A52A2A">Phone</font></th></tr>
</thead>
<tbody>
<xsl:for-each select="Dhina/Customer-Details">
<tr>
<td><font color="blue"><xsl:value-of select="CusName"/></font></td>
<td><font color="blue"><xsl:value-of select="CusAdd1"/></font></td>
<td><font color="blue"><xsl:value-of select="CusAdd2"/></font></td>
<td><font color="blue"><xsl:value-of select="CusState"/></font></td>
<td><font color="blue"><xsl:value-of select="phoneno"/></font></td>
</tr>
</xsl:for-each >
</tbody>
<tfoot>
<tr><td colspan="5">YOUR FOOTNOTE HERE</td></tr>
</tfoot>
</table>
</div>
</div>
<img src="C:/PRINT13.ICO" name="jd" onclick="prin();"></img>
</form>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Hope this thing works and I get an iPod for this
Regards,
Satyajit.
Dear SatyaJit
Thanks for your valuable help.
Its working Fine.i put the point to you.
But i have small problem.
i.e Browser prints the address bar even i remove the address bar manually like
"file://C:\Documents% 20 and % 20 Settings\Administrator\Dekstop\test.html"
i want to remove the the above part in my printed sheet in our own coding style.
is it possible?
and also i want to print my own way of pageNo(top) and Date Time(Bottom)
did you get my point?
pls help me
Regards
Dhinakar
Hi,
<i>also i want to print my own way of pageNo(top) and Date Time(Bottom)?</i>
Hmmm...you can do it ofcourse, but this would need printer support.
<i>i put the point to you</i>
I don't see the point
<i>i want to remove the the above part in my printed sheet in our own coding style.is it possible?</i>
I need to look into this. I am not too sure.
Regards,
Satyajit.
Dear SatyaJit
Now you check it
i put the point to you.
Still i have small problem.
i.e Browser prints the address bar even i remove the address bar manually like
"file://C:\Documents% 20 and % 20 Settings\Administrator\Dekstop\test.html"
i want to remove the the above part in my printed sheet in our own coding style.
is it possible?
and also i want to print my own way of pageNo(top) and Date Time(Bottom)
did you get my point?
pls help me
Regards
Dhinakar
Hi,
To implement what you want, you will need to design a "Print Template".
I haven't worked with print templates but I know that if you want to redirect custom print headers and footers, you will need print templates.
This template can be designed in javascript.
That's all I can tell you about this.
Regards,
Satyajit.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.