Jump to content
We've recently updated our Privacy Statement, available here ×

Lucianc Please help me with the issue .......


diptypatil

Recommended Posts

HI lucianc ,

 

I have used $V{PAGE_NUMBER} to display the page number in my reports . Iam generating reports in PDF, Excel,CSV. in PDF and CSV the page numbers are displayed properly but in Excel its not displaying at all. Can you please help me as this issues is critical and iam not finding any solution.

 

The method to display the footer is :

 

public void addFooter() throws JRException {

int height = template.getRowHeight();

//Integer objectPage = new Integer(1);

JRDesignBand footer = new JRDesignBand();

String foot1= "Page";

if(generatedStamp==true) /* Genarated stamp or if there is some dynamic footer to display*/

{

height += template.getRowHeight()+20;

JRDesignStaticText textStatic = new JRDesignStaticText();

// if(format.equalsIgnoreCase("PDF"))

// {

 

textStatic.setText( foot1 );

textStatic.setBackcolor(new Color(255,255,255));

textStatic.setForecolor(new Color(51,51,51));

textStatic.setMode(JRDesignStaticText.MODE_TRANSPARENT);

textStatic.setPositionType(JRDesignStaticText.POSITION_TYPE_FLOAT);

textStatic.setVerticalAlignment(JRAlignment.VERTICAL_ALIGN_TOP);

textStatic.setHorizontalAlignment(JRAlignment.HORIZONTAL_ALIGN_CENTER);

textStatic.setWidth(adjustedPageWidth);

textStatic.setHeight(20);

textStatic.setFontSize(10);

footer.addElement(textStatic);

 

// }

JRDesignTextField textField = new JRDesignTextField();

textField.setBackcolor(new Color(255,255,255));

textField.setForecolor(new Color(51,51,51));

textField.setMode(JRDesignTextField.MODE_TRANSPARENT);

textField.setPositionType(JRDesignTextField.POSITION_TYPE_FLOAT);

textField.setVerticalAlignment(JRAlignment.VERTICAL_ALIGN_TOP);

textField.setHorizontalAlignment(JRAlignment.HORIZONTAL_ALIGN_CENTER);

textField.setWidth(adjustedPageWidth);

textField.setX(textStatic.getHorizontalAlignment()+14);

textField.setHeight(20);

textField.setStretchWithOverflow(true);

textField.setStretchType(JRElement.STRETCH_TYPE_RELATIVE_TO_TALLEST_OBJECT);

textField.setFontSize(10);

JRDesignExpression pageExpr = new JRDesignExpression();

pageExpr = new JRDesignExpression();

pageExpr.setText("$V{PAGE_NUMBER}");

pageExpr.setValueClassName("java.lang.Integer");

textField.setExpression(pageExpr);

 

System.out.println("Page:"+("$V{PAGE_NUMBER}"));

System.out.println("Text:"+pageExpr.getText());

System.out.println("ValueClass:"+pageExpr.getValueClass());

System.out.println("Expression:"+textField.getExpression());

 

JRDesignExpression expr = new JRDesignExpression();

expr.setValueClassName("java.lang.String");

expr.addParameterChunk("PARAM_FOOTER_TEXT");

addDesignParam( "PARAM_FOOTER_TEXT", "java.lang.String" );

JRDesignTextField text = new JRDesignTextField();

text.setExpression(expr);

text.setBackcolor(new Color(255,255,255));

text.setForecolor(new Color(51,51,51));

text.setMode(JRDesignTextField.MODE_TRANSPARENT);

text.setPositionType(JRDesignTextField.POSITION_TYPE_FIX_RELATIVE_TO_TOP);

text.setVerticalAlignment(JRAlignment.VERTICAL_ALIGN_TOP);

text.setHorizontalAlignment(JRAlignment.HORIZONTAL_ALIGN_LEFT);

text.setStretchWithOverflow(true);

text.setStretchType(JRElement.STRETCH_TYPE_RELATIVE_TO_TALLEST_OBJECT);

text.setWidth(adjustedPageWidth);

text.setY(textField.getHeight());

text.setFontSize(10);

text.setPadding(5);

footer.addElement(textField);

footer.addElement(text);

}

/* Report template footer text */

footer.setHeight(height);

this.setPageFooter(footer);

}

 

 

Regards

Dipty

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...