Jump to content
We've recently updated our Privacy Statement, available here ×
  • How to customize font and size of exported Excel print header/footer text contents


    vchiem
    • Features: Exporters, Reports Version: v6.4.0 Product: JasperReports® Library

    Issue:

    The following property is available to store text content of Excel sheet headers and/or footers:

    net.sf.jasperreports.export.xls.sheet.header.*

    net.sf.jasperreports.export.xls.sheet.footer.*

    where * can be either center, left, right. 

    They will appear on the Excel pages upon print preview as plain text.

    How do we customize the font and size of the text that is stored when using these properties. 

     


    Solution:

    There is a nice trick to include the custom font and size in the xml attribute as follows (footer example) :

        <property name="net.sf.jasperreports.export.xls.sheet.footer.center">
            <![CDATA[&"Simsun,bold"&16Page &P of &N]]>
        </property>

    This can be added directly in the Source tab of the JRXML template or indirectly added as a property of the report 

    (Right click on the report name in the outline pane -> Advanced tab -> Edit Properties) 

    The above example will look like this when print previewing in Excel :

     

    footercenter.jpg.2f0750281bae73a459043466caaa5308.jpg

    Tip: If the header or footer is not showing in the Print Preview, check your page margins. 

    Related Articles:

    https://stackoverflow.com/questions/39656257/how-to-set-excel-header-font-and-style-in-print-preview/39669535


    User Feedback

    Recommended Comments

    There are no comments to display.



    Guest
    This is now closed for further comments

×
×
  • Create New...