Ajil Mohan
Ajil Mohan

Reputation: 7389

How to set column width dynamicaly in dynamic jasper excel report?

I am developing excel report using DynamicJasper API. I am able to generate the report from the given datasource, but the columns in the report still appeared very narrow. I searched to get a solution for this, in many place people answer with setUseFullPageWidth(true); in DynamicReportBuilder . I tried this, but it does not resolve my issue.

Upvotes: 3

Views: 1641

Answers (1)

martinnovoty
martinnovoty

Reputation: 893

Use: setWidth(Integer)

    AbstractColumn[] startColsParams = {
            ColumnBuilder.getNew().setColumnProperty(new ColumnProperty(KEY_AA_ID, String.class.getName()))
                .setWidth(new Integer(40)).setTitle("AA").setStyle(style).build(),
            ColumnBuilder.getNew().setColumnProperty(new ColumnProperty(KEY_BB_ID, String.class.getName()))
                .setWidth(new Integer(160)).setTitle("BB").setStyle(style).build(),             
    };

Upvotes: 1

Related Questions