I have a requirement where I have to combine Cells when Same data flows in.
I wanted to combine Cells for "proj_name" and also "snd_ba_name". I have tried some code but nothing seems to work.
Can some one please help on this
XML for this report is
<?xml version="1.0" encoding="UTF-8"?>
<message>
<body>
<asset>
<entity>
<id>page3</id>
<entity-record>
<id>bad7ce40-66d2-11e7-9a1f-f5876ea6a532#-</id>
<field>
<id>sending_cc2</id>
<value>GCO BISO Mumbai</value>
</field>
<field>
<id>total_euro</id>
<value>0.00</value>
</field>
<field>
<id>proj_name</id>
<value>ABC</value>
</field>
<field>
<id>sum_inr</id>
<value>-47500.08</value>
</field>
<field>
<id>rec_cc</id>
<value>01471A00</value>
</field>
<field>
<id>snd_ba_name</id>
<value>A</value>
</field>
<field>
<id>fsi_code</id>
<value>F1770259000</value>
</field>
<field>
<id>sending_cc</id>
<value>9478110804</value>
</field>
<field>
<id>total_inr</id>
<value>0.00</value>
</field>
<field>
<id>sum_eur</id>
<value>-670.62</value>
</field>
</entity-record>
<entity-record>
<id>bad7ce41-66d2-11e7-9a1f-f5876ea6a532#-</id>
<field>
<id>sending_cc2</id>
<value>GCO BISO Mumbai</value>
</field>
<field>
<id>total_euro</id>
<value>0.00</value>
</field>
<field>
<id>proj_name</id>
<value>ABC</value>
</field>
<field>
<id>sum_inr</id>
<value>-11028.25</value>
</field>
<field>
<id>rec_cc</id>
<value>01470C00</value>
</field>
<field>
<id>snd_ba_name</id>
<value>A</value>
</field>
<field>
<id>fsi_code</id>
<value>F1770259000</value>
</field>
<field>
<id>sending_cc</id>
<value>9478110804</value>
</field>
<field>
<id>total_inr</id>
<value>0.00</value>
</field>
<field>
<id>sum_eur</id>
<value>-155.70</value>
</field>
</entity-record>
<entity-record>
<id>bad7ce42-66d2-11e7-9a1f-f5876ea6a532#-</id>
<field>
<id>sending_cc2</id>
<value>TaxOps-Bangalore-NOC</value>
</field>
<field>
<id>total_euro</id>
<value>0.00</value>
</field>
<field>
<id>proj_name</id>
<value>ABC</value>
</field>
<field>
<id>sum_inr</id>
<value>139417.72</value>
</field>
<field>
<id>rec_cc</id>
<value>01470H00</value>
</field>
<field>
<id>snd_ba_name</id>
<value>Tax Operations</value>
</field>
<field>
<id>fsi_code</id>
<value>F1770259000</value>
</field>
<field>
<id>sending_cc</id>
<value>9478754400</value>
</field>
<field>
<id>total_inr</id>
<value>0.00</value>
</field>
<field>
<id>sum_eur</id>
<value>1968.35</value>
</field>
</entity-record>
<entity-record>
<id>bad7ce43-66d2-11e7-9a1f-f5876ea6a532#-</id>
<field>
<id>sending_cc2</id>
<value>GCO BISO Mumbai</value>
</field>
<field>
<id>total_euro</id>
<value>0.00</value>
</field>
<field>
<id>proj_name</id>
<value>ABC</value>
</field>
<field>
<id>rec_cc</id>
<value>01470F00</value>
</field>
<field>
<id>snd_ba_name</id>
<value>B</value>
</field>
<field>
<id>fsi_code</id>
<value>F1770259000</value>
</field>
<field>
<id>sending_cc</id>
<value>9478110804</value>
</field>
<field>
<id>total_inr</id>
<value>0.00</value>
</field>
<field>
<id>sum_eur</id>
<value>-112.37</value>
</field>
</entity-record>
<entity-record>
<id>bad7ce44-66d2-11e7-9a1f-f5876ea6a532#-</id>
<field>
<id>sending_cc2</id>
<value>TaxOps-Bangalore-NOC</value>
</field>
<field>
<id>total_euro</id>
<value>0.00</value>
</field>
<field>
<id>proj_name</id>
<value>DEF </value>
</field>
<field>
<id>sum_inr</id>
<value>6971.10</value>
</field>
<field>
<id>rec_cc</id>
<value>01490B00</value>
</field>
<field>
<id>snd_ba_name</id>
<value>C</value>
</field>
<field>
<id>fsi_code</id>
<value>F1770259000</value>
</field>
<field>
<id>sending_cc</id>
<value>9478754400</value>
</field>
<field>
<id>total_inr</id>
<value>0.00</value>
</field>
<field>
<id>sum_eur</id>
<value>98.42</value>
</field>
</entity-record>
<entity-record>
<id>bad7ce45-66d2-11e7-9a1f-f5876ea6a532#-</id>
<field>
<id>sending_cc2</id>
<value>TaxOps-Bangalore-NOC</value>
</field>
<field>
<id>total_euro</id>
<value>0.00</value>
</field>
<field>
<id>proj_name</id>
<value>TSO-TAXOPS-C_9478754400</value>
</field>
<field>
<id>sum_inr</id>
<value>27883.69</value>
</field>
<field>
<id>rec_cc</id>
<value>01470E00</value>
</field>
<field>
<id>snd_ba_name</id>
<value>Tax Operations</value>
</field>
<field>
<id>fsi_code</id>
<value>F1770259000</value>
</field>
<field>
<id>sending_cc</id>
<value>9478754400</value>
</field>
<field>
<id>total_inr</id>
<value>0.00</value>
</field>
<field>
<id>sum_eur</id>
<value>393.67</value>
</field>
</entity-record>
</entity>
</asset>
</body>
</message>
XSLT Code I have tried is
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" indent="yes"/>
<xsl:key name="snd_ba_name" match="body/asset/entity[id[text()='page3']]/entity-record" use="field[id[text()='snd_ba_name']]/value" />
<xsl:key name="proj_name" match="body/asset/entity[id[text()='page3']]/entity-record" use="field[id[text()='proj_name']]/value" />
<xsl:variable name="smallcase" select="'abcdefghijklmnopqrstuvwxyz'"/>
<xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
<xsl:template match="message">
<html>
<head>
<title>Invoice Report</title>
<style type="text/css">body { font-family:sans-serif; position: relative; margin: 0px auto; padding: 0px; border: none; width: 900px; margin: 0% 0%; padding: 0%; } hr { border:1px solid; border-bottom:1px; width:100%; } .page_break{page-break-after: always;} input[type=text] { height:25px; text-indent: 0.5em; border:1px solid black; background-color:white; } input[type=checkbox] { /* Double-sized Checkboxes */ -ms-transform: scaleX(1.3)scaleY(1.3); /* IE */ -moz-transform: scaleX(1.3)scaleY(1.3); /* FF */ -webkit-transform: scaleX(1.3)scaleY(1.3); /* Safari and Chrome */ -o-transform: scaleX(1.3)scaleY(1.3); /* Opera */ } .sqr_block { border:1px solid black; background-color:white; height:28px; width:18px; margin-left:2px; margin-right:2px; } .tableArray1 { border: 1px solid black; border-collapse: collapse; } #BorderHidden{ border-bottom-style:hidden; border-top-style:hidden; border-right-style:hidden; border-left-style:hidden; } .break{ page-break-before: always;}</style>
</head>
<body>
<table cellpadding="0" cellspacing="0" border="1" width="100%">
<xsl:for-each select="body/asset/entity[id[text()='page3']]/entity-record[count(.|key('snd_ba_name',field[id[text()='snd_ba_name']]/value)[1])=1]">
<xsl:sort select="field[id[text()='snd_ba_name']]/value"/>
<tr>
<td rowspan="" width="15%" style="font-size:10px;" valign="top" align="left">
<xsl:attribute name="rowspan">
<xsl:value-of select="count(key('snd_ba_name',field[id[text()='snd_ba_name']]/value)[1]) + 1"/>
</xsl:attribute>
<xsl:value-of select="field[id[text()='snd_ba_name']]/value"/>
</td>
<td width="15%" style="font-size:10px;" valign="top" align="left">
<xsl:value-of select="field[id[text()='proj_name']]/value"/>
</td>
<td width="10%" style="font-size:10px;" valign="top" align="left">
<xsl:value-of select="field[id[text()='sending_cc']]/value"/>
</td>
<td width="10%" style="font-size:10px;" valign="top" align="left">
<xsl:value-of select="field[id[text()='sending_cc2']]/value"/>
</td>
<td width="10%" style="font-size:10px;" valign="top" align="left">
<xsl:value-of select="field[id[text()='rec_cc']]/value"/>
</td>
<td width="10%" style="font-size:10px;" valign="top" align="left">
<xsl:value-of select="field[id[text()='fsi_code']]/value"/>
</td>
<td width="15%" style="font-size:10px;" valign="top" align="right">
<xsl:value-of select="field[id[text()='sum_eur']]/value"/>
<!-- <xsl:value-of select="format-number(sum(current-group()/field[id[text()='sum_eur']]/value),'0.00')"/> -->
</td>
<td width="15%" style="font-size:10px;" valign="top" align="right">
<xsl:value-of select="field[id[text()='sum_inr']]/value"/>
<!-- <xsl:value-of select="format-number(sum(current-group()/field[id[text()='sum_inr']]/value),'0.00')"/> -->
</td>
</tr>
</xsl:for-each>
<xsl:variable name="TotalInvoiceERU" select="body/asset/entity[id[text()='page3']]/entity-record/field[id[text()='sum_eur']]/value"/>
<xsl:variable name="TotalInvoiceERU1" select="sum($TotalInvoiceERU)"/>
<xsl:variable name="TotalInvoiceINR" select="body/asset/entity[id[text()='page3']]/entity-record/field[id[text()='sum_inr']]/value"/>
<xsl:variable name="TotalInvoiceINR1" select="sum($TotalInvoiceINR)"/>
<tr>
<td colspan="6">
<b>Total Result</b>
</td>
<td height="20px" style="font-size:10px;" align="right">
<xsl:value-of select="format-number(($TotalInvoiceERU1),'0.00')"/>
</td>
<td height="20px" style="font-size:10px;" align="right">
<xsl:value-of select="format-number(($TotalInvoiceINR1),'0.00')"/>
</td>
</tr>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
My Output should look like :
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Invoice Report</title><style type="text/css">body { font-family:sans-serif; position: relative; margin: 0px auto; padding: 0px; border: none; width: 900px; margin: 0% 0%; padding: 0%; } hr { border:1px solid; border-bottom:1px; width:100%; } .page_break{page-break-after: always;} input[type=text] { height:25px; text-indent: 0.5em; border:1px solid black; background-color:white; } input[type=checkbox] { /* Double-sized Checkboxes */ -ms-transform: scaleX(1.3)scaleY(1.3); /* IE */ -moz-transform: scaleX(1.3)scaleY(1.3); /* FF */ -webkit-transform: scaleX(1.3)scaleY(1.3); /* Safari and Chrome */ -o-transform: scaleX(1.3)scaleY(1.3); /* Opera */ } .sqr_block { border:1px solid black; background-color:white; height:28px; width:18px; margin-left:2px; margin-right:2px; } .tableArray1 { border: 1px solid black; border-collapse: collapse; } #BorderHidden{ border-bottom-style:hidden; border-top-style:hidden; border-right-style:hidden; border-left-style:hidden; } .break{ page-break-before: always;}</style></head>
<body>
<table cellpadding="0" cellspacing="0" border="1" width="100%">
<tr>
<td width="15%" style="font-size:10px;" valign="top" align="left">Project Name</td>
<td width="15%" style="font-size:10px;" valign="top" align="left">Sending BA Name</td>
<td width="10%" style="font-size:10px;" valign="top" align="left">Sending CC</td>
<td width="10%" style="font-size:10px;" valign="top" align="left">Sending CC2</td>
<td width="10%" style="font-size:10px;" valign="top" align="left">REC CC</td>
<td width="10%" style="font-size:10px;" valign="top" align="left">FSI Code</td>
<td width="15%" style="font-size:10px;" valign="top" align="right">Amount in EUR</td>
<td width="15%" style="font-size:10px;" valign="top" align="right">Amount In INR</td>
</tr>
<tr>
<td rowspan="4" width="15%" style="font-size:10px;" valign="top" align="left">ABC</td>
<td rowspan="2"width="15%" style="font-size:10px;" valign="top" align="left">A</td>
<td width="10%" style="font-size:10px;" valign="top" align="left">9478090108</td>
<td width="10%" style="font-size:10px;" valign="top" align="left">ASU GTB-IN-PUNE-NOC</td>
<td width="10%" style="font-size:10px;" valign="top" align="left">0001855844</td>
<td width="10%" style="font-size:10px;" valign="top" align="left">F1770259000</td>
<td width="15%" style="font-size:10px;" valign="top" align="right">4105.19</td>
<td width="15%" style="font-size:10px;" valign="top" align="right">290768.89</td>
</tr>
<tr>
<td width="10%" style="font-size:10px;" valign="top" align="left">9478090108</td>
<td width="10%" style="font-size:10px;" valign="top" align="left">ASU GTB-IN-PUNE-NOC</td>
<td width="10%" style="font-size:10px;" valign="top" align="left">0001855844</td>
<td width="10%" style="font-size:10px;" valign="top" align="left">F1770259000</td>
<td width="15%" style="font-size:10px;" valign="top" align="right">4105.19</td>
<td width="15%" style="font-size:10px;" valign="top" align="right">290768.89</td>
</tr>
<tr>
<td rowspan="2" width="15%" style="font-size:10px;" valign="top" align="left">Tax Operations</td>
<td width="10%" style="font-size:10px;" valign="top" align="left">9478090108</td>
<td width="10%" style="font-size:10px;" valign="top" align="left">ASU GTB-IN-PUNE-NOC</td>
<td width="10%" style="font-size:10px;" valign="top" align="left">0001855844</td>
<td width="10%" style="font-size:10px;" valign="top" align="left">F1770259000</td>
<td width="15%" style="font-size:10px;" valign="top" align="right">4105.19</td>
<td width="15%" style="font-size:10px;" valign="top" align="right">290768.89</td>
</tr>
<tr>
<td width="10%" style="font-size:10px;" valign="top" align="left">9478090108</td>
<td width="10%" style="font-size:10px;" valign="top" align="left">ASU GTB-IN-PUNE-NOC</td>
<td width="10%" style="font-size:10px;" valign="top" align="left">0001855844</td>
<td width="10%" style="font-size:10px;" valign="top" align="left">F1770259000</td>
<td width="15%" style="font-size:10px;" valign="top" align="right">4105.19</td>
<td width="15%" style="font-size:10px;" valign="top" align="right">290768.89</td>
</tr>
<tr>
<td colspan="6"><b>Total Result</b></td>
<td height="20px" style="font-size:10px;" align="right"></td>
<td height="20px" style="font-size:10px;" align="right"></td>
</tr>
</table>
</body>
</html>
Related
i have 2 problemes with long tables in Qweb.
1/ if there is no place for all table on first page , Qweb print all the table on seconde page . but i want the first part of table on the first page and the seconde part on the seconde page (look to img1 and img2).
2/if the table is too long i have probleme with thead and tbody for all pages(
thead and tbody start from the same line so for all pages the first ligne is illisible ) except the first one (look to img3 and img4).
i added a comment to understand which table i'm talking about it (comment "This table" before table and "End table" after table).
Thanks
<odoo>
<data>
<record id="facture_cadre_format" model="report.paperformat">
<field name="name">European A4</field>
<field name="default" eval="True" />
<field name="format">A4</field>
<field name="page_height">0</field>
<field name="page_width">0</field>
<field name="orientation">Portrait</field>
<field name="margin_top">80</field>
<field name="margin_bottom">23</field>
<field name="margin_left">7</field>
<field name="margin_right">7</field>
<field name="header_line" eval="False" />
<field name="header_spacing">70</field>
<field name="dpi">90</field>
</record>
<report id="new_factures"
string="Facture (new)"
model="account.invoice"
report_type="qweb-pdf"
name="livraison_report.new_facture"
paperformat="facture_cadre_format"
/>
<template id="new_facture">
<t t-call="report.html_container">
<t t-call="facture_layout.facture_layout">
<div class="page">
<!-- Report page content -->
<style>
tbody {
font-size: 10px;
}
.police {
font-size: 10px;
}
.tableau {
page-break-inside: avoid;
}
</style>
<t t-foreach="docs" t-as="o">
<h2>
<span t-if="o.type == 'out_invoice' and (o.state == 'open' or o.state == 'paid')">Facture</span>
<span t-if="o.type == 'out_invoice' and o.state == 'proforma2'">PRO-FORMA</span>
<span t-if="o.type == 'out_invoice' and o.state == 'draft'">Draft Invoice</span>
<span t-if="o.type == 'out_invoice' and o.state == 'cancel'">Cancelled Invoice</span>
<span t-if="o.type == 'out_refund'">Refund</span>
<span t-if="o.type == 'in_refund'">Vendor Refund</span>
<span t-if="o.type == 'in_invoice'">Vendor Bill</span>
<span t-field="o.number"/>
</h2>
<div class="row mt32 mb32">
<div class="col-xs-2" t-if="o.name">
<strong>Description:</strong>
<p t-field="o.name"/>
</div>
<div class="col-xs-2" t-if="o.date_invoice">
<strong>Date de la facture:</strong>
<p t-field="o.date_invoice"/>
</div>
<div class="col-xs-2" t-if="o.date_due and o.type == 'out_invoice' and (o.state == 'open' or o.state == 'paid')">
<strong>Date d'échéance:</strong>
<p t-field="o.date_due"/>
</div>
<div class="col-xs-2" t-if="o.origin">
<strong>Origine:</strong>
<p t-field="o.origin"/>
</div>
<div class="col-xs-2" t-if="o.partner_id.ref">
<strong>BL:</strong>
<span t-esc="', '.join(map(lambda x: (x.name), o.picking_id))"/>
</div>
<div name="reference" class="col-xs-2" t-if="o.reference">
<strong>Reference:</strong>
<p t-field="o.reference"/>
</div>
</div>
<!-- _______________________________________________________This Table__________________________________________________________________ -->
<table class="table table-condensed table-bordered ">
<thead>
<tr style="background-color:#A9E2F3;">
<th>Description</th>
<th class="hidden">Source Document</th>
<th class="text-right">P.U</th>
<th class="text-right">PPA</th>
<th class="text-right">PPH</th>
<th class="text-right">Qté</th>
<th class="text-center">UM</th>
<th class="text-center">Mnt Brut</th>
<th class="text-right">RM(%)</th>
<th class="text-right">Tax Excluded Price</th>
</tr>
</thead>
<tbody>
<tr t-foreach="o.invoice_line_ids" t-as="l">
<td>
<span t-field="l.name"/>
<t t-if="(l.lot_formatted_note is not False)">
<div style="margin-left:25px;" t-field="l.lot_formatted_note" />
<br/>
</t>
</td>
<td class="hidden"><span t-field="l.origin"/></td>
<td class="text-right">
<span t-field="l.price_unit"/>
</td>
<td class="text-right">
<span t-field="l.ppa"/>
</td>
<td class="text-right">
<span t-field="l.prix_pharmacien"/>
</td>
<td class="text-right">
<span t-esc="'%.0f'%(l.quantity)"/>
</td>
<td class="text-center">
<span t-field="l.uom_id" groups="product.group_uom"/>
</td>
<td class="text-right">
<span t-field="l.price_subtotal_brut"/>
</td>
<td class="text-right">
<span t-field="l.discount"/>
</td>
<td class="text-right">
<span t-field="l.price_subtotal" t-options="{"widget": "monetary", "display_currency": o.currency_id}"/>
</td>
</tr>
</tbody>
</table>
<!-- _______________________________________________________End Table__________________________________________________________________ -->
<div class="row">
<div class="col-xs-4 pull-right">
<table class="table table-condensed table-bordered tableau">
<tr class="border-black" >
<td><strong>Montant BRUT</strong></td>
<td class="text-right">
<span t-field="o.amount_untaxed_brut" t-options="{"widget": "monetary", "display_currency": o.currency_id}"/>
</td>
</tr>
<tr class="border-black" >
<td><strong>Montant Remise</strong></td>
<td class="text-right">
<span t-field="o.amount_discount" t-options="{"widget": "monetary", "display_currency": o.currency_id}"/>
</td>
</tr>
<tr class="border-black">
<td><strong>Montant HT</strong></td>
<td class="text-right">
<span t-field="o.amount_untaxed" t-options="{"widget": "monetary", "display_currency": o.currency_id}"/>
</td>
</tr>
<t t-foreach="o._get_tax_amount_by_group()" t-as="amount_by_group">
<tr>
<td><span t-esc="amount_by_group[0] if len(o.tax_line_ids) > 1 else (o.tax_line_ids.tax_id.description or o.tax_line_ids.tax_id.name)"/></td>
<td class="text-right">
<span t-esc="amount_by_group[1]" t-options="{"widget": "monetary", "display_currency": o.currency_id}"/>
</td>
</tr>
</t>
<tr class="border-black">
<td><strong>Montant TTC</strong></td>
<td class="text-right">
<span t-field="o.amount_total" t-options="{"widget": "monetary", "display_currency": o.currency_id}"/>
</td>
</tr>
</table>
</div>
</div>
<p class="police">
<strong>ARRETEE LA PRESENTE FACTURE A LA SOMME DE:</strong>
<span t-field="o.amount_to_text"/>
</p>
<p t-if="o.comment">
<strong>Comment:</strong>
<span t-field="o.comment"/>
</p>
<p t-if="o.payment_term_id">
<span t-field="o.payment_term_id.note"/>
</p>
<p t-if="o.fiscal_position_id.note">
<strong>Fiscal Position Remark:</strong>
<span t-field="o.fiscal_position_id.note"/>
</p>
<table class="table table-condensed table-bordered tableau">
<thead>
<tr >
<th class="text-center"><strong>Commercial</strong></th>
<th class="text-center"><strong>Client</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td>
<br/>
<br/>
</td>
<td>
<br/>
<br/>
</td>
</tr>
</tbody>
</table>
</t>
</div>
</t>
</t>
</template>
</data>
</odoo>
Use <thead> tag for your requirement.
Hi try changing the values of some fields in this record,
<record id="facture_cadre_format" model="report.paperformat">
<field name="name">European A4</field>
<field name="default" eval="True" />
<field name="format">A4</field>
<field name="page_height">0</field>
<field name="page_width">0</field>
<field name="orientation">Portrait</field>
<field name="margin_top">80</field>
<field name="margin_bottom">23</field>
<field name="margin_left">7</field>
<field name="margin_right">7</field>
<field name="header_line" eval="False" />
<field name="header_spacing">70</field>
<field name="dpi">90</field>
</record>
I have faced the same issue and rectified by changing some values here.I don't correctly remember which one.Try changing values of page height and if it doesn't work try other fields.
I have used this code but not working returning empty PDF file in odoo 10
self.env['report'].sudo().get_pdf(self, 'equipment_management.report_gatepass')
.xml code:
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<report id="equipment_action"
model="calibration.details"
string="Gatepass "
report_type="qweb-pdf"
name="equipment_management.report_gatepass"
file="equipment_management.report_gatepass"
/>
<record id="paperformats" model="report.paperformat">
<field name="name">European A4 low margins</field>
<field name="default" eval="True" />
<field name="format">A4</field>
<field name="page_height">0</field>
<field name="page_width">0</field>
<field name="orientation">Portrait</field>
<field name="margin_top">20</field>
<field name="margin_bottom">20</field>
<field name="margin_left">20</field>
<field name="margin_right">20</field>
<field name="header_line" eval="False" />
<field name="header_spacing">10</field>
<field name="dpi">90</field>
</record>
<record id="equipment_management.equipment_action" model="ir.actions.report.xml">
<field name="paperformat_id" ref="equipment_management.paperformats" />
</record>
<template id="report_gatepass">
<t t-call="report.html_container">
<t t-set="counter" t-value="001"/>
<t t-foreach="docs" t-as="o">
<div class="page">
<style>
.box{
background: black;
max-width: 250px;
text-align:center;
color:white;}
</style>
<div class="row">
<table width="100%" cellpadding="0px" cellspacing="0px" style="border:1px solid black">
<tr style="border-bottom:1px solid black">
<td width="20%" valign="top" align="center" padding="15px">
<img t-att-src="'data:image/png;base64,%s' % res_company.logo" height="100px" width="90px" />
</td>
<td width= "80%">
<div style="font-size:18px;"><center><b><t t-if="res_company.name" t-esc="res_company.name"/></b></center></div>
<div style="font-size:12px;"><center><t t-if="res_company.rml_header1" t-esc="res_company.rml_header1"/></center></div>
<div style="font-size:12px"><center><t t-if="res_company.street" t-esc ="res_company.street"/> <t t-if="res_company.street2" t-esc ="res_company.street2"/> <t t-if="res_company.state_id" t-esc ="res_company.state_id.name"/> <t t-if="res_company.country_id" t-esc ="res_company.country_id.name"/></center></div>
<div style="font-size:12px"><center>Tel No.<t t-if="res_company.phone" t-esc ="res_company.phone"/>, Fax<t t-if="res_company.fax" t-esc ="res_company.fax"/>, Email <t t-if="res_company.email" t-esc ="res_company.email"/>, Website <t t-if="res_company.website" t-esc ="res_company.website"/></center></div>
</td>
</tr>
<tr>
<td colspan="2" width="100%" style="font-size:24px"><center><div class="box"><strong>GATEPASS</strong></div></center></td>
</tr>
<tr style="border-bottom:1px solid black">
<td colspan="2" width="100%" style="font-size:14px"><center><strong>(NIWE-Returnable Material)</strong></center></td>
</tr>
<tr style="border-bottom:1px solid black">
<td colspan="2">
<table width="100%" cellpadding="0px" cellspacing="0px">
<tr>
<td width="25%" style="font-size:14px;line-height:300%;"><center><strong>Reference No.:</strong></center></td>
<td width="25%" style="font-size:14px;line-height:300%;text-align:left;"><strong><t t-esc="o.name"/></strong></td>
<td width="25%" style="font-size:14px;line-height:300%;"><center><strong>Date:</strong></center></td>
<td width="25%" style="font-size:14px;line-height:300%;text-align:left"><strong><span t-field="o.date" t-field-options='{"format": "dd-MM-y"}'/></strong></td>
</tr>
</table>
</td>
</tr>
<tr style="border-bottom:1px solid black">
<td colspan="2">
<table width="100%" cellpadding="0px" cellspacing="0px" style="font-size:12px">
<tr style="border-bottom:1px solid black;height:50px;">
<td width="5%" style="text-align:center;border-right:1px solid black">1</td>
<td width="53%" style="padding-left:5px;border-right:1px solid black">Name and Designation of the Person taking the Material</td>
<td width="42%" style="padding-left:5px"><t t-if="o.responsible_person.name" t-esc="o.responsible_person.name"/></td>
</tr>
<tr style="border-bottom:1px solid black;height:60px;">
<td width="5%" style="text-align:center;border-right:1px solid black">2</td>
<td width="53%" style="padding-left:5px;border-right:1px solid black">Address of supplier taking material out of NIWE Campus(with phone No.)</td>
<td width="42%" style="padding-left:5px">
<div style="font-size:12px"><t t-if="o.responsible_person.street" t-esc ="o.responsible_person.street"/></div>
<div><t t-if="o.responsible_person.street2" t-esc ="o.responsible_person.street2"/></div>
<div><t t-if="o.responsible_person.state_id" t-esc ="o.responsible_person.state_id.name"/> </div>
<div><t t-if="o.responsible_person.country_id" t-esc ="o.responsible_person.country_id.name"/></div>
<div style="font-size:12px"><t t-if="o.responsible_person.phone" t-esc ="o.responsible_person.phone"/></div>
<div><t t-if="o.responsible_person.mobile" t-esc ="o.responsible_person.mobile"/></div>
</td>
</tr>
<tr style="border-bottom:1px solid black;height:60px;">
<td width="5%" style="text-align:center;border-right:1px solid black">3</td>
<td width="53%" style="padding-left:5px;border-right:1px solid black">Description of items with its serial Number and Quantity etc.,</td>
<td width="42%" style="padding-left:5px">
<div><b>Name:</b><t t-if="o.instrument.name" t-esc="o.instrument.name"/></div>
<div><b>Serial No:</b><t t-if="o.serial" t-esc="o.serial"/></div>
<div><b>Description:</b><t t-if="o.instrument.description" t-esc="o.instrument.description"/></div>
</td>
</tr>
<tr style="border-bottom:1px solid black;height:60px;">
<td width="5%" style="text-align:center;border-right:1px solid black">4</td>
<td width="53%" style="padding-left:5px;border-right:1px solid black">Purpose for which the Material(s) in/are being taken out</td>
<td width="42%" style="padding-left:5px"><t t-if="o.purpose" t-esc="o.purpose"/></td>
</tr>
<tr style="border-bottom:1px solid black;height:60px;">
<td width="5%" style="text-align:center;border-right:1px solid black">5</td>
<td width="53%" style="padding-left:5px;border-right:1px solid black">Probable date of return of Material if any</td>
<td width="42%" style="padding-left:5px"><t t-if="o.date_of_return"><span t-field="o.date_of_return" t-field-options='{"format": "dd-MM-y"}'/></t></td>
</tr>
<tr style="border-bottom:1px solid black;height:60px;">
<td width="5%" style="text-align:center;border-right:1px solid black">6</td>
<td width="53%" style="padding-left:5px;border-right:1px solid black">NIWE-officer responsible for inspection Returning the Material</td>
<td width="42%" style="padding-left:5px"><t t-if="o.officer.name" t-esc="o.officer.name"/></td>
</tr>
<tr style="height:60px;">
<td width="5%" style="text-align:center;border-right:1px solid black">7</td>
<td width="53%" style="padding-left:5px;border-right:1px solid black">Any other Informations</td>
<td width="42%" style="padding-left:5px"><t t-if="o.other_info" t-esc="o.other_info"/></td>
</tr>
</table>
</td>
</tr>
</table>
<table style="font-size:12px" width="100%">
<tr>
<br/><br/><br/><br/>
</tr>
<tr>
<td width="35%" style="text-align:left"><span><div>Signature of the person taking the</div>
<div>Material out NIWE Campus</div></span></td>
<td width="35%"><span><div>Signature of the Officer/Material</div><div style="text-align:center">Indenter</div></span></td>
<td width="30%" style="text-align:right">Signature of Head/Project Leader</td>
</tr>
</table>
<table style="font-size:12px" width="100%">
<tr>
<br/><br/><br/><br/>
</tr>
<tr>
<td width="50%" style="text-align:left">Authorized Signatory</td>
<td width="50%" style="text-align:right"><span>Signature of Security Officer/Security
<div>Guard on duty in NIWE</div></span></td>
</tr>
</table>
</div>
</div>
</t>
</t>
</template>
</data>
</openerp>
Correct syntax:
pdf = request.env['report'].sudo().get_pdf([sale_order_id], 'sale.report_saleorder', data=None)
By default the report format of Odoo reports are in PDF, I don't know why your specifically asking for pdf file while printing. The below given is a sample code for attaching PDF file of sale_order report as attachment to the order/quotation using .get_pdf.
Example:
#api.multi
def print_quotation(self):
for order in self:
result = self.env['report'].sudo().get_pdf([order.id], 'sale.report_saleorder')
return self.env['ir.attachment'].create({
'name': 'Sample',
'type': 'binary',
'datas': base64.encodestring(result),
'res_model': 'sale.order',
'res_id': order.id,
'mimetype': 'application/x-pdf'
})
Openerp has changed to Odoo. So please change the below section in your code if you are using Odoo 10.0:
<openerp>
<data>
</data>
</openerp>
to
<odoo>
<data>
</data>
</odoo>
Hope this may help you !
Here is a snippet of the XML file:
<?xml version="1.0" encoding="utf-8"?>
<AssignmentHistory Version="171804">
<W20170828>
<StudentItems>
<Item>
<Name Counsel="13" NextCounsel="0" Completed="1">Name 1</Name>
<Type>Bible Reading (Main)</Type>
<Description>Bible Reading</Description>
</Item>
<Item>
<Name Counsel="50" NextCounsel="0" Completed="1">Name 2</Name>
<Type>#1 Student (Main)</Type>
<Description>Initial Call</Description>
</Item>
<Item>
<Name>Name A</Name>
<Type>Assistant</Type>
<Description>Initial Call</Description>
</Item>
<Item>
<Name Counsel="50" NextCounsel="0" Completed="1">Name 3</Name>
<Type>#2 Student (Main)</Type>
<Description>Return Visit</Description>
</Item>
<Item>
<Name>Name B</Name>
<Type>Assistant</Type>
<Description>Return Visit</Description>
</Item>
<Item>
<Name Counsel="33" NextCounsel="0" Completed="1">Name 4</Name>
<Type>#3 Student (Main)</Type>
<Description>Bible Study</Description>
</Item>
<Item>
<Name>Name C</Name>
<Type>Assistant</Type>
<Description>Bible Study</Description>
</Item>
</StudentItems>
</W20170828>
</AssignmentHistory>
Here is the XSL script:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msa="http://www.publictalksoftware.co.uk/msa">
<xsl:output method="html" indent="yes" version="4.01"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
doctype-public="//W3C//DTD XHTML 1.0 Transitional//EN"/>
<xsl:variable name="PubDB" select="document('MSA_PublisherDatabase.XML')"/>
<xsl:variable name="History" select="document('AssignHistory.XML')"/>
<xsl:template match="/">
<html>
<head>
<title>Students - Full History Report</title>
<!--<link rel="stylesheet" type="text/css" href="Custom Publisher Report.css"/>-->
</head>
<body>
<table style="width: 100%; border: 1px solid #000000; border-collapse: collapse;">
<xsl:apply-templates select="$PubDB/msa:PublisherDatabase/msa:Publishers/msa:Publisher">
<xsl:sort select="msa:Name" data-type="text" order="ascending"/>
</xsl:apply-templates>
</table>
</body>
</html>
</xsl:template>
<xsl:template match="msa:Publisher">
<tr>
<td colspan="5" style="border: 1px solid #000000">
<xsl:value-of select="msa:Name"/>
</td>
</tr>
<xsl:apply-templates select="$History/AssignmentHistory/*/StudentItems/Item[Name=current()/msa:Name]"/>
<tr>
<td colspan="5" style="border-top-style: solid; border-top-width: 1px; border-bottom-style: solid; border-bottom-width: 1px;">
<xsl:text> </xsl:text>
</td>
</tr>
</xsl:template>
<xsl:template match="Item">
<xsl:if test="position()=1">
<tr>
<td style="border: 1px solid #000000">
<xsl:text>Date</xsl:text>
</td>
<td style="border: 1px solid #000000">
<xsl:text>Item</xsl:text>
</td>
<td style="border: 1px solid #000000">
<xsl:text>Study Point</xsl:text>
</td>
<td style="border: 1px solid #000000">
<xsl:text>Next Study Point</xsl:text>
</td>
<td style="border: 1px solid #000000">
<xsl:text>Completed</xsl:text>
</td>
</tr>
</xsl:if>
<tr>
<td style="border: 1px solid #000000">
<xsl:value-of select="name(../..)"/>
</td>
<td style="border: 1px solid #000000">
<xsl:value-of select="Type"/>
</td>
<td style="border: 1px solid #000000">
<xsl:value-of select="Name/#Counsel"/>
</td>
<td style="border: 1px solid #000000">
<xsl:value-of select="Name/#NextCounsel"/>
</td>
<td style="border: 1px solid #000000">
<xsl:value-of select="Name/#Completed"/>
</td>
</tr>
</xsl:template>
</xsl:stylesheet>
It works fine. But I want to exclude from the results in the apply-templates call:
<xsl:apply-templates select="$History/AssignmentHistory/*/StudentItems/Item[Name=current()/msa:Name]"/>
... any Item that has a value of Assistant for the Type element.
Update
At the moment I have changed it to use a xsl:if clause but it would be more elegant for the apply-templates call to directly omit these elements where possible:
Date
Item
Study Point
Next Study Point
Completed
<xsl:if test="Type != 'Assistant'">
<tr>
<td class="CellNormal CellBorder">
<xsl:value-of select="name(../..)"/>
</td>
<td class="CellNormal CellBorder">
<xsl:value-of select="Type"/>
</td>
<td class="CellNormal CellBorder">
<xsl:value-of select="Name/#Counsel"/>
</td>
<td class="CellNormal CellBorder">
<xsl:value-of select="Name/#NextCounsel"/>
</td>
<td class="CellNormal CellBorder">
<xsl:value-of select="Name/#Completed"/>
</td>
</tr>
</xsl:if>
I'm using VML code to show background in an HTML mail. I have 3 tables in a single table cell and they are standing right next to each other, but when I test my e-mail in Outlook tables are no longer next to each other and it aligns my three tables vertically like every table is in a line.
Here's my code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<table bgcolor="#ffffff" width="600" border="0" cellpadding="0" cellspacing="0"
align="center" class="normal" style=
"mso-table-lspace: 0pt;mso-table-rspace: 0pt;border-collapse: collapse;">
<tr>
<td background="http://i.imgur.com/YJOX1PC.png" style="background-image:url('http://i.imgur.com/YJOX1PC.png');" bgcolor="#7bceeb" width="600" height="700" valign="top">
<!--[if gte mso 9]>
<v:rect strokecolor='none' style='width:600px;height:700px;'>
<v:fill color='#363636' src='http://i.imgur.com/YJOX1PC.png' type='tile'></v:fill>
</v:rect>
<v:shape id='NameHere' style='position:absolute;width:600px;height:700px;'></v:shape>
<![endif]-->
<div><table width="580" border="0" cellpadding="0"
cellspacing="0" align="center" class=
"spaced2" >
<tr>
<td valign="top" style="border:none;"><table class="aligntable" border="0" cellpadding=
"0" cellspacing="0" align="left"
style=
"mso-table-lspace: 0pt;mso-table-rspace: 0pt;border-collapse: collapse;"><tr>
<td height="20"> </td></tr>
<tr>
<td width="180" align="center"><img border="0" src=
"" width="180" height="180" /></td>
</tr>
<tr>
<td width="180" valign="middle" align="center"
style=
"mso-table-lspace: 0pt;mso-table-rspace: 0pt;border-collapse: collapse;color: #0b5ed7;font-family: Verdana,Arial,Helvetica,sans-serif;font-size: 16px;font-weight: normal;padding: 0;margin: 0;text-align: left;line-height: 150%;letter-spacing: 0px;">
<center>
TEST
</center></td>
</tr>
<tr>
<td height="20" width="180"></td>
</tr>
<tr>
<td width="180" height="255" valign="top"
align="left" style=
"mso-table-lspace: 0pt;mso-table-rspace: 0pt;border-collapse: collapse;color: #000000;font-family: Verdana,Arial,Helvetica,sans-serif;font-size: 12px;font-weight: normal;text-decoration: none;outline: none;line-height: 120%;">TEST </td>
</tr>
<tr>
<td align="center" valign="top" width="180"><img src=
""
border="0"
/></a></td>
</tr>
<tr>
<td height="20" width="180"></td>
</tr>
</table>
<table width="20" align="left" border="0">
<tr>
<td></td>
</tr>
</table>
<table class="aligntable2" border="0" cellpadding=
"0" cellspacing="0" align="left"
style=
"display:block; mso-table-lspace: 0pt;mso-table-rspace: 0pt;border-collapse: collapse;"><tr><td height="20"></td></tr>
<tr>
<td width="180" align="center"> <img border="0" src=
"" width="180" height="180" /></td>
</tr>
<tr>
<td width="180" valign="middle" align="center"
style=
"mso-table-lspace: 0pt;mso-table-rspace: 0pt;border-collapse: collapse;color: #0b5ed7;font-family: Verdana,Arial,Helvetica,sans-serif;font-size: 16px;font-weight: normal;padding: 0;margin: 0;text-align: left;line-height: 150%;letter-spacing: 0px;">
<center>
TEST
</center></td>
</tr>
<tr>
<td height="20" width="180"></td>
</tr>
<tr>
<td width="180" height="255" valign="top"
align="left" style=
"mso-table-lspace: 0pt;mso-table-rspace: 0pt;border-collapse: collapse;color: #000000;font-family: Verdana,Arial,Helvetica,sans-serif;font-size: 12px;font-weight: normal;text-decoration: none;outline: none;line-height: 120%;"> TEST</td>
</tr>
<tr>
<td align="center" width="180"><a target="_blank" style=
"FONT-SIZE: 16px; COLOR: #0e5fd8; -webkit-text-size-adjust:none; FONT-FAMILY: Verdana, Arial; text-decoration:none; line-height:16px;"
href=
"http://www.philips.at/c-p/NTRX100_12/?origin=3_at_de_spoilyourself2__ot_dec__hero_img&elqtrack=true"> <img src=
""
border="0" /></a></td>
</tr>
<tr>
<td height="20" width="180"></td>
</tr>
</table>
<table class="aligntable3" border="0" cellpadding=
"0" cellspacing="0" align="right"
style=
"mso-table-lspace: 0pt;mso-table-rspace: 0pt;border-collapse: collapse;"><tr><td height="20"></td></tr>
<tr>
<td width="180" align="center"><img border="0" src=
"" width="180" height="180" /></td>
</tr>
<tr>
<td width="180" valign="middle" align="center"
style=
"mso-table-lspace: 0pt;mso-table-rspace: 0pt;border-collapse: collapse;color: #0b5ed7;font-family: Verdana,Arial,Helvetica,sans-serif;font-size: 16px;font-weight: normal;padding: 0;margin: 0;text-align: left;line-height: 150%;letter-spacing: 0px;">
<center>
TEST
</center></td>
</tr>
<tr>
<td height="20" width="180"></td>
</tr>
<tr>
<td width="180" height="255" valign="top"
align="left" style=
"mso-table-lspace: 0pt;mso-table-rspace: 0pt;border-collapse: collapse;color: #000000;font-family: Verdana,Arial,Helvetica,sans-serif;font-size: 12px;font-weight: normal;text-decoration: none;outline: none;line-height: 120%;">TEST </td>
</tr>
<tr>
<td align="center" width="180"> <img src=
"" alt=
width="50"
border="0"/></a></td>
</tr>
<tr>
<td height="20" width="180"></td>
</tr>
</table></td>
</tr>
</table>
<!--END TD -->
</div>
<!--[if gte mso 9]>
</v:textbox>
</v:rect>
<![endif]-->
</td>
</tr>
</table>
</body>
</html>
Hey I just ran into this issue as well and figured out a fix.
What's happening here is that after the </table> and before the <table>, Outlook VML adds a Word paragraph marker which forces the tables to display stacked rather than inline with each other.
Between the </table><table> put this piece of conditional code
<!--[if mso]></td><td><![endif]-->
Your code would look like this
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<table bgcolor="#ffffff" width="600" border="0" cellpadding="0" cellspacing="0"
align="center" class="normal" style=
"mso-table-lspace: 0pt;mso-table-rspace: 0pt;border-collapse: collapse;">
<tr>
<td background="http://i.imgur.com/YJOX1PC.png" style="background-image:url('http://i.imgur.com/YJOX1PC.png');" bgcolor="#7bceeb" width="600" height="700" valign="top">
<!--[if gte mso 9]>
<v:rect strokecolor='none' style='width:600px;height:700px;'>
<v:fill color='#363636' src='http://i.imgur.com/YJOX1PC.png' type='tile'></v:fill>
</v:rect>
<v:shape id='NameHere' style='position:absolute;width:600px;height:700px;'></v:shape>
<![endif]-->
<div><table width="580" border="0" cellpadding="0"
cellspacing="0" align="center" class=
"spaced2" >
<tr>
<td valign="top" style="border:none;"><table class="aligntable" border="0" cellpadding=
"0" cellspacing="0" align="left"
style=
"mso-table-lspace: 0pt;mso-table-rspace: 0pt;border-collapse: collapse;"><tr>
<td height="20"> </td></tr>
<tr>
<td width="180" align="center"><img border="0" src=
"" width="180" height="180" /></td>
</tr>
<tr>
<td width="180" valign="middle" align="center"
style=
"mso-table-lspace: 0pt;mso-table-rspace: 0pt;border-collapse: collapse;color: #0b5ed7;font-family: Verdana,Arial,Helvetica,sans-serif;font-size: 16px;font-weight: normal;padding: 0;margin: 0;text-align: left;line-height: 150%;letter-spacing: 0px;">
<center>
TEST
</center></td>
</tr>
<tr>
<td height="20" width="180"></td>
</tr>
<tr>
<td width="180" height="255" valign="top"
align="left" style=
"mso-table-lspace: 0pt;mso-table-rspace: 0pt;border-collapse: collapse;color: #000000;font-family: Verdana,Arial,Helvetica,sans-serif;font-size: 12px;font-weight: normal;text-decoration: none;outline: none;line-height: 120%;">TEST </td>
</tr>
<tr>
<td align="center" valign="top" width="180"><img src=
""
border="0"
/></a></td>
</tr>
<tr>
<td height="20" width="180"></td>
</tr>
</table>
<table width="20" align="left" border="0">
<tr>
<td></td>
</tr>
</table>
<!--[if mso]></td><td><![endif]-->
<table class="aligntable2" border="0" cellpadding=
"0" cellspacing="0" align="left"
style=
"display:block; mso-table-lspace: 0pt;mso-table-rspace: 0pt;border-collapse: collapse;"><tr><td height="20"></td></tr>
<tr>
<td width="180" align="center"> <img border="0" src=
"" width="180" height="180" /></td>
</tr>
<tr>
<td width="180" valign="middle" align="center"
style=
"mso-table-lspace: 0pt;mso-table-rspace: 0pt;border-collapse: collapse;color: #0b5ed7;font-family: Verdana,Arial,Helvetica,sans-serif;font-size: 16px;font-weight: normal;padding: 0;margin: 0;text-align: left;line-height: 150%;letter-spacing: 0px;">
<center>
TEST
</center></td>
</tr>
<tr>
<td height="20" width="180"></td>
</tr>
<tr>
<td width="180" height="255" valign="top"
align="left" style=
"mso-table-lspace: 0pt;mso-table-rspace: 0pt;border-collapse: collapse;color: #000000;font-family: Verdana,Arial,Helvetica,sans-serif;font-size: 12px;font-weight: normal;text-decoration: none;outline: none;line-height: 120%;"> TEST</td>
</tr>
<tr>
<td align="center" width="180"><a target="_blank" style=
"FONT-SIZE: 16px; COLOR: #0e5fd8; -webkit-text-size-adjust:none; FONT-FAMILY: Verdana, Arial; text-decoration:none; line-height:16px;"
href=
"http://www.philips.at/c-p/NTRX100_12/?origin=3_at_de_spoilyourself2__ot_dec__hero_img&elqtrack=true"> <img src=
""
border="0" /></a></td>
</tr>
<tr>
<td height="20" width="180"></td>
</tr>
</table>
<!--[if mso]></td><td><![endif]-->
<table class="aligntable3" border="0" cellpadding=
"0" cellspacing="0" align="right"
style=
"mso-table-lspace: 0pt;mso-table-rspace: 0pt;border-collapse: collapse;"><tr><td height="20"></td></tr>
<tr>
<td width="180" align="center"><img border="0" src=
"" width="180" height="180" /></td>
</tr>
<tr>
<td width="180" valign="middle" align="center"
style=
"mso-table-lspace: 0pt;mso-table-rspace: 0pt;border-collapse: collapse;color: #0b5ed7;font-family: Verdana,Arial,Helvetica,sans-serif;font-size: 16px;font-weight: normal;padding: 0;margin: 0;text-align: left;line-height: 150%;letter-spacing: 0px;">
<center>
TEST
</center></td>
</tr>
<tr>
<td height="20" width="180"></td>
</tr>
<tr>
<td width="180" height="255" valign="top"
align="left" style=
"mso-table-lspace: 0pt;mso-table-rspace: 0pt;border-collapse: collapse;color: #000000;font-family: Verdana,Arial,Helvetica,sans-serif;font-size: 12px;font-weight: normal;text-decoration: none;outline: none;line-height: 120%;">TEST </td>
</tr>
<tr>
<td align="center" width="180"> <img src=
"" alt=
width="50"
border="0"/></a></td>
</tr>
<tr>
<td height="20" width="180"></td>
</tr>
</table></td>
</tr>
</table>
<!--END TD -->
</div>
<!--[if gte mso 9]>
</v:textbox>
</v:rect>
<![endif]-->
</td>
</tr>
</table>
</body>
</html>
I have problem with setting fixed number of rows in my table.
I created table with similar code with this one:
<xsl:for-each select="DBData/tabulka1/Row[position() < 14]">
<tr>
<td><xsl:value-of select="ODESILATEL"/></td>
<td><xsl:value-of select="PREDMET"/></td>
<td align="right" class="sOkrajem"></td>
</tr>
</xsl:for-each>
And I need to fix number of rows to 15, even if I get a few records.
To example, if I get only 13 rows from database, so the two left rows will be empty, but will be there. For better understand, here is image:
http://imageshack.us/photo/my-images/692/tabulkar.png/
If will be neccesary, I can edit my SQL code.
Thanks for all advice. And sorry for representation of my problem.
edit. more extensive example of my code:
I have problem with setting fixed number of rows in my table.
I created table with similar code with this one:
<xsl:for-each select="DBData/tabulka1/Row[position() < 14]">
<tr>
<td><xsl:value-of select="ODESILATEL"/></td>
<td><xsl:value-of select="PREDMET"/></td>
<td align="right" class="sOkrajem"></td>
</tr>
</xsl:for-each>
And I need to fix number of rows to 15, even if I get a few records.
To example, if I get only 13 rows from database, so the two left rows will be empty, but will be there. For better understand, here is image:
http://imageshack.us/photo/my-images/692/tabulkar.png/
If will be neccesary, I can edit my SQL code.
Thanks for all advice. And sorry for representation of my problem.
edit. more extensive example of my latest use of code:
<?xml version="1.0" encoding="windows-1250"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="RolesPath" select="'%RolesPath%'"/>
<xsl:decimal-format decimal-separator=","
grouping-separator=" "/>
<xsl:include href="%RolesPath%\_foot.xsl" />
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cs" lang="cs">
<head>
<meta name="lang" content="cs" />
<meta http-equiv="Content-Type" content="text/xml; charset=windows-1250" />
<meta name="copyright" content="© 2009-2010 Flores" />
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body class ="teloBezObrazku">
<table width="95%" class="tabulka">
<th colspan="3" class="nadpis">Vzkazy</th>
<xsl:variable name="numRows" select="15" />
<xsl:variable name="rows" select="DBData/tabulka1/Row" />
<xsl:apply-templates select="$rows[position() <= $numRows]" />
<xsl:call-template name="AddRows">
<xsl:with-param name="numRows" select="$numRows - count($rows)" />
</xsl:call-template>
</table>
<span style="position: absolute; bottom: 10;">
Otevřít vše...<b class="cara">|</b>
Nový...
</span>
<xsl:call-template name="footer">
<xsl:with-param name="RolesPath" select="'%RolesPath%'"/>
</xsl:call-template>
</foot>
</html>
</xsl:template>
<!-- Separate templates -->
<xsl:template name="TableRow" match="tabulka1/Row">
<tr>
<td>
<xsl:value-of select="self::Row/ODESILATEL"/>
</td>
<td>
<xsl:value-of select="self::Row/PREDMET"/>
</td>
<td align="right" class="sOkrajem"></td>
</tr>
</xsl:template>
<xsl:template name="AddRows">
<xsl:param name="numRows" />
<xsl:if test="$numRows > 0">
<xsl:call-template name="TableRow" />
<xsl:call-template name="AddRows">
<xsl:with-param name="numRows" select="$numRows - 1" />
</xsl:call-template>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
edit. First line probably getting error.
<xsl:template name="tabulka1 | tabulka1/Row" mode="row">
<tr onmouseover="className='seda'" onmouseout="className='bila'" title="{OBSAH}" style="cursor:hand" xmlns="http://www.w3.org/1999/xhtml">
<a href="abrasite:A4NHDUKJESG4PJAVPQJFMAE2PS,0,DoShow;{ID}">
<xsl:choose>
<xsl:when test = "PRECTENO='N'">
<td align="left" class="sOkrajem"><b><xsl:value-of select="self::Row/ODESILATEL"/></b></td>
<td align="left" class="sOkrajem"><b><xsl:value-of select="self::Row/PREDMET"/></b></td>
<td align="right" class="sOkrajem">
<b><xsl:value-of select="self::Row/DATUM"/> <xsl:value-of select="self::Row/HODINY"/><xsl:value-of select="self::Row/MINUTY"/></b>
</td>
</xsl:when>
<xsl:otherwise>
<td align="left" class="sOkrajem"><xsl:value-of select="self::Row/ODESILATEL"/></td>
<td align="left" class="sOkrajem"><xsl:value-of select="self::Row/PREDMET"/></td>
<td align="right" class="sOkrajem">
<xsl:value-of select="self::Row/DATUM"/> <xsl:value-of select="self::Row/HODINY"/><xsl:value-of select="self::Row/MINUTY"/>
</td>
</xsl:otherwise>
</xsl:choose>
</a>
</tr>
</xsl:template>
You should be able to accomplish it like this (I've omitted the footer parts, which I don't have access to):
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="RolesPath" select="'%RolesPath%'"/>
<xsl:decimal-format decimal-separator=","
grouping-separator=" "/>
<xsl:variable name="numRows" select="15" />
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cs" lang="cs">
<head>
<meta name="lang" content="cs" />
<meta http-equiv="Content-Type" content="text/xml; charset=windows-1250" />
<meta name="copyright" content="© 2009-2010 Flores" />
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body class ="teloBezObrazku">
<xsl:apply-templates select="DBData/tabulka1" />
<xsl:apply-templates select="DBData/tabulka2" />
<span style="position: absolute; bottom: 10;">
Otevřít vše...<b class="cara">|</b>
Nový...
</span>
</body>
</html>
</xsl:template>
<xsl:template name="TableRows">
<xsl:variable name="rows" select="Row" />
<xsl:apply-templates select="$rows[position() <= $numRows]" mode="row" />
<xsl:call-template name="AddRows">
<xsl:with-param name="numRows" select="$numRows - count($rows)" />
</xsl:call-template>
</xsl:template>
<xsl:template name="AddRows">
<xsl:param name="numRows" />
<xsl:if test="$numRows > 0">
<xsl:apply-templates select="." mode="row" />
<xsl:call-template name="AddRows">
<xsl:with-param name="numRows" select="$numRows - 1" />
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template match="tabulka1">
<table width="95%" class="tabulka" xmlns="http://www.w3.org/1999/xhtml">
<tr>
<th colspan="3" class="nadpis">Vzkazy</th>
</tr>
<xsl:call-template name="TableRows" />
</table>
</xsl:template>
<xsl:template match="tabulka1 | tabulka1/Row" mode="row">
<tr xmlns="http://www.w3.org/1999/xhtml">
<td>
<xsl:value-of select="self::Row/ODESILATEL"/>
</td>
<td>
<xsl:value-of select="self::Row/PREDMET"/>
</td>
<td align="right" class="sOkrajem"></td>
</tr>
</xsl:template>
<xsl:template match="tabulka2">
<table width="95%" class="tabulka" xmlns="http://www.w3.org/1999/xhtml">
<tr>
<th colspan="2" class="nadpis">Other Table</th>
</tr>
<xsl:call-template name="TableRows" />
</table>
</xsl:template>
<xsl:template match="tabulka2 | tabulka2/Row" mode="row">
<tr xmlns="http://www.w3.org/1999/xhtml">
<td>
<xsl:value-of select="self::Row/ODESILATEL2"/>
</td>
<td>
<xsl:value-of select="self::Row/PREDMET2"/>
</td>
</tr>
</xsl:template>
</xsl:stylesheet>
When run on this input XML:
<DBData>
<tabulka1>
<Row>
<ODESILATEL>Hello</ODESILATEL>
<PREDMET>1</PREDMET>
</Row>
<Row>
<ODESILATEL>Ciao</ODESILATEL>
<PREDMET>2</PREDMET>
</Row>
<Row>
<ODESILATEL>Hi</ODESILATEL>
<PREDMET>3</PREDMET>
</Row>
<Row>
<ODESILATEL>Bonjour</ODESILATEL>
<PREDMET>4</PREDMET>
</Row>
</tabulka1>
<tabulka2>
<Row>
<ODESILATEL2>Konnnichiwa</ODESILATEL2>
<PREDMET>1</PREDMET>
</Row>
<Row>
<ODESILATEL2>Wazzap</ODESILATEL2>
<PREDMET>2</PREDMET>
</Row>
<Row>
<ODESILATEL2>Buenos dias</ODESILATEL2>
<PREDMET>3</PREDMET>
</Row>
</tabulka2>
</DBData>
The result is:
<html xml:lang="cs" lang="cs" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="lang" content="cs" />
<meta http-equiv="Content-Type" content="text/xml; charset=windows-1250" />
<meta name="copyright" content="© 2009-2010 Flores" />
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body class="teloBezObrazku">
<table width="95%" class="tabulka">
<tr>
<th colspan="3" class="nadpis">Vzkazy</th>
</tr>
<tr>
<td>Hello</td>
<td>1</td>
<td align="right" class="sOkrajem" />
</tr>
<tr>
<td>Ciao</td>
<td>2</td>
<td align="right" class="sOkrajem" />
</tr>
<tr>
<td>Hi</td>
<td>3</td>
<td align="right" class="sOkrajem" />
</tr>
<tr>
<td>Bonjour</td>
<td>4</td>
<td align="right" class="sOkrajem" />
</tr>
<tr>
<td></td>
<td></td>
<td align="right" class="sOkrajem" />
</tr>
<tr>
<td></td>
<td></td>
<td align="right" class="sOkrajem" />
</tr>
<tr>
<td></td>
<td></td>
<td align="right" class="sOkrajem" />
</tr>
<tr>
<td></td>
<td></td>
<td align="right" class="sOkrajem" />
</tr>
<tr>
<td></td>
<td></td>
<td align="right" class="sOkrajem" />
</tr>
<tr>
<td></td>
<td></td>
<td align="right" class="sOkrajem" />
</tr>
<tr>
<td></td>
<td></td>
<td align="right" class="sOkrajem" />
</tr>
<tr>
<td></td>
<td></td>
<td align="right" class="sOkrajem" />
</tr>
<tr>
<td></td>
<td></td>
<td align="right" class="sOkrajem" />
</tr>
<tr>
<td></td>
<td></td>
<td align="right" class="sOkrajem" />
</tr>
<tr>
<td></td>
<td></td>
<td align="right" class="sOkrajem" />
</tr>
</table>
<table width="95%" class="tabulka">
<tr>
<th colspan="2" class="nadpis">Other Table</th>
</tr>
<tr>
<td>Konnnichiwa</td>
<td></td>
</tr>
<tr>
<td>Wazzap</td>
<td></td>
</tr>
<tr>
<td>Buenos dias</td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</table>
<span style="position: absolute; bottom: 10;">
Otevřít vše...<b class="cara">|</b>
Nový...
</span>
</body>
</html>