Inserting images in odt template header

Hi guys!..

I’m trying to customize the standard tryton invoice template by adding a logo in the header area… in the template the image is rendered properly… however when I get the processed report the image is missing… interestingly when I try with the general ledger template the report comes with the logo inserted with no problem… the difference that I could find is that the general ledger template inserts the image in a table already present in the header and the invoice insert the image directly into the header without an intermediate node… I tried inserting a table in the header of the invoice template but that didn’t solved the problem… I was also looking at the relatorio source code but I was unable to find an explanation to my problem…

here the relevant sections in the styles.xml file in the template odt (includes the image):

   <master-styles>
    <master-page style:name="Standard" style:page-layout-name="Mpm1">
            <header>
                    <p text:style-name="MP1">
                            <frame draw:style-name="Mfr1" draw:name="Frame1" text:anchor-type="paragraph" svg:x="0.6319in" svg:y="-0.1299in" svg:width="0.7in" draw:z-index="5">
                                    <text-box fo:min-height="0.7in">
                                            <p text:style-name="MP2"></p>
                                    </text-box>
                            </frame>
                            <placeholder text:placeholder-type="text">&lt;if test="invoice.company.header"&gt;</placeholder>
                    </p>
                    <p text:style-name="MP1">
                            <placeholder text:placeholder-type="text">&lt;for each="line in invoice.company.header.split('\n')"&gt;</placeholder>
                    </p>
                    <p text:style-name="MP1">
                            <placeholder text:placeholder-type="text">&lt;line&gt;</placeholder>
                    </p>
                    <p text:style-name="MP1">
                            <placeholder text:placeholder-type="text">&lt;/for&gt;</placeholder>
                    </p>
                    <p text:style-name="MP3">
                            <placeholder text:placeholder-type="text">&lt;/if&gt;</placeholder>
                    </p>
                    <p text:style-name="MP4">
                            <placeholder text:placeholder-type="text">&lt;invoice.company.rec_name&gt;</placeholder>
                    </p>
            </header>
            <footer>
                    <p text:style-name="MP3">
                            <placeholder text:placeholder-type="text">&lt;if test="invoice.company.footer"&gt;</placeholder>
                    </p>
                    <p text:style-name="MP3">
                            <placeholder text:placeholder-type="text">&lt;for each="line in invoice.company.footer.split('\n')"&gt;</placeholder>
                    </p>
                    <p text:style-name="MP3">
                            <placeholder text:placeholder-type="text">&lt;line&gt;</placeholder>
                    </p>
                    <p text:style-name="MP3">
                            <placeholder text:placeholder-type="text">&lt;/for&gt;</placeholder>
                    </p>
                    <p text:style-name="MP3">
                            <placeholder text:placeholder-type="text">&lt;/if&gt;</placeholder>
                    </p>
            </footer>
    </master-page>

And here the same section in the processed report…

<master-styles>
        <master-page style:name="Standard" style:page-layout-name="Mpm1">
                <header>
                        <p text:style-name="MP1">1ra linea del encabezado</p>
                        <p text:style-name="MP1">2 linea del encabezado</p>
                        <p text:style-name="MP1">3 linea del encabezado</p>
                        <p text:style-name="MP2">MyCompany</p>
                </header>
                <footer>
                        <p text:style-name="MP3">1 linea de pie de pagina</p>
                        <p text:style-name="MP3">2 linea de pie de pagina</p>
                        <p text:style-name="MP3">ultima linea</p>
                </footer>
        </master-page>
</master-styles>

I searched for similar problems in the web but I only found something related to the use of fodt instead of odt that is not my case… any clues on how to solve this?

This is because you put the "if test=“invoice.company.header” inside the same <p/> as the <frame/>. Relatorio always removes the content next to directives because when their are compiled in Genshi they are put on the parent <p/>.
You must put the image on its own <p/>.

Thank you Cédric!.. that solved the problem,

BR,
Francisco,

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.