cancel
Showing results for 
Search instead for 
Did you mean: 

Print thru XSL or XML

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

dhinakar,

Did solution for your previous problem works?

If so, please close thread

And if the previous solution works, then the same technique may be applied to current one: CSS stylesheet that uses print profile. See <a href="http://www.w3.org/TR/css-print/">W3C Print Profile doc</a>, section 8.4.

VS

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi,

Have you looked into the CSS commands "page-break-after" and "page-break-before"?

Regards,

Satyajit.

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

Dera VS

I put Your <thead> and <tfoot> Coding in my CSS in HTML part.

But browser couldn't print the header part repeateadly

you said in your mail it will automatically print the header when it goes to next page.

i am waiting for your reply

Regards

Dhinakar

Former Member
0 Kudos

Dear VS

i put your <thead> and <tfoot> coding in my Css in HTML part.

But browser couldn't print the header part repeateadly.

you said that it will automatically print the header when it goes to next page.

Regards

Dhinakar

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

Former Member
0 Kudos

dhinakar,

What browser are you using? IE?

Please try the same with Mozilla / Firefox.

Probably it is necessary to add some IE-specific workarounds...

VS

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

Former Member
0 Kudos

Dera Satyajit/VS

did you get my XML format and xsl

i didn't get the answer from you.

Still i am struggling

Regards

Dhinakar

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

Former Member
0 Kudos

Dear SatyaJit

Still i didn't get the solution to remove the address bar

(via coding) in my printed sheet and also i want to

print my own way of pageNo(top) and Date Time(Bottom)

Help me in this regards

Regards

Dhinakar

Former Member
0 Kudos

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.

Former Member
0 Kudos

Dear Satyajit

can we do the page set up via coding not manually

As you said custom Print headers and footers.

how we implement in XSL in javaScript.

send me the coding

just i want to remove the address bar details in my printed sheet via Script only

pls help me

regards

Dhinakar

Former Member
0 Kudos

Hi,

The page header and footer are browser specific settings (File->Page Setup).

I am sorry to say this, but you cannot change these settings through code. Only option is to do it manually.

I tried out a few options in your xsl, but sadly it didn't work.

Regards,

Satyajit.

Answers (0)