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

diptypatil

Members
  • Posts

    26
  • Joined

  • Last visited

diptypatil's Achievements

Contributor

Contributor (5/14)

  • First Post Rare
  • Collaborator Rare
  • Conversation Starter Rare
  • Week One Done
  • One Month Later

Recent Badges

0

Reputation

  1. Hi , You can use it like this : JRDesignTextField textFieldEven = new JRDesignTextField(); textFieldEven.isBold(); textFieldEven.setPdfFontName("Times-Bold"); Its working for me,you can try it. Regards, Dipty
  2. Hi , Below is my code , here i would like to make the text BOLD i have set the property as TRUE but it is not getting bold. Can u please suggest. public void addColumnTraderData (CSAReportColumnData[] cols) throws JRException { JRDesignBand detail = new JRDesignBand(); //detail.setHeight(template.getRowHeight()); detail.setSplitAllowed(false); JRDesignVariable variableRate = new JRDesignVariable(); variableRate.setName("colRate"); variableRate.setValueClass(java.lang.String.class); JRDesignExpression exprVar = new JRDesignExpression(); exprVar.setText(""Rate""); exprVar.setValueClass(java.lang.String.class); variableRate.setExpression(exprVar); //design.addVariable(variable); this.addVariable(variableRate); JRDesignVariable variableBlank = new JRDesignVariable(); variableBlank.setName("colBlank"); variableBlank.setValueClass(java.lang.String.class); exprVar = new JRDesignExpression(); exprVar.setText("" ""); exprVar.setValueClass(java.lang.String.class); variableBlank.setExpression(exprVar); //design.addVariable(variable); this.addVariable(variableBlank); for( int i=0; i<cols.length; i++) { JRDesignVariable variable = new JRDesignVariable(); variable.setName("colVal"+i); variable.setValueClass(java.lang.String.class); exprVar = new JRDesignExpression(); exprVar.setText("""+ getColumnName(i)+ """); exprVar.setValueClass(java.lang.String.class); variable.setExpression(exprVar); //design.addVariable(variable); this.addVariable(variable); JRDesignExpression expr = new JRDesignExpression(); //expr.setName(cols.getName()); expr.setValueClassName(cols.getType()); JRDesignExpressionChunk exprChunk = new JRDesignExpressionChunk(); exprChunk.setText(cols.getName()); exprChunk.setType(JRBaseExpressionChunk.TYPE_FIELD); expr.addChunk(exprChunk); /* Even Rows */ JRDesignTextField textFieldEven = new JRDesignTextField(); textFieldEven.setExpression(expr); if( cols.getPattern() != null && cols.getPattern().length() > 0 ) { textFieldEven.setPattern(cols.getPattern()); } textFieldEven.setBackcolor(getColor(template.getBgColorEvenRows())); textFieldEven.setForecolor(getColor(template.getTextColorEvenRows())); textFieldEven.setMode(JRDesignStaticText.MODE_OPAQUE); textFieldEven.setPositionType(JRDesignStaticText.POSITION_TYPE_FIX_RELATIVE_TO_TOP); textFieldEven.setVerticalAlignment(cols.getVerticalAlignement()); //textFieldEven.setTextAlignment(cols.getHorizontalAlignement()); textFieldEven.setHorizontalAlignment(getAlignment(columnAlignments));//0002 textFieldEven.setWidth(dataColumnWidth); textFieldEven.setStretchWithOverflow(true);//0001 //groups the report elements to stretch them to fit the tallest object . textFieldEven.setStretchType(JRElement.STRETCH_TYPE_RELATIVE_TO_TALLEST_OBJECT); //textFieldEven.setHeight(template.getRowHeight()); //Adding Padding textFieldEven.setLeftPadding(5); textFieldEven.setRightPadding(2); textFieldEven.setX(sumWidth(dataColumnWidth,i)); textFieldEven.setBlankWhenNull(true); textFieldEven.setBold(true); JRDesignExpression isEvenExpr = new JRDesignExpression(); //isEvenExpr.setText("new Boolean(($V{COLUMN_COUNT}).intValue() % 2 == 0)"); isEvenExpr.setText("new Boolean(($F{"+cols.getName()+"}).equals($V{colVal"+i+"}) ||($F{"+cols.getName()+"}).equals($V{colRate}) ||($F{"+cols.getName()+"}).equals($V{colBlank}) )"); isEvenExpr.setValueClassName("java.lang.Boolean"); textFieldEven.setPrintWhenExpression(isEvenExpr); /*JRDesignConditionalStyle a = new JRDesignConditionalStyle(); a.setBackcolor(getColor("#FF00FF")); a.setConditionExpression(isEvenExpr); textFieldEven.setStyle(a);*/ detail.addElement(textFieldEven); addDesignField(cols.getName(), cols.getType()); } setDetail(detail); }
  3. I added the 2 tags <variable> and <summary> in the attached JRXML and since then i am getting classCastException. I am not sure what part or what stuff is causing this error. I am using public class PDFDataSource implements JRDataSource to fill my PDF. If any one has any suggestions that would be great. Thanx in advance.
  4. Hi Lucian, To my previous post i would like to add , As we can use new Boolean($F{AMOUNT}.intValue() > 10000) how can we do String comparision.? Please could u help us this is urgent. thanks dipty
  5. Hi Lucian, To my previous post i would like to add , As we can use new Boolean($F{AMOUNT}.intValue() > 10000) how can we do String comparision.? Please could u help us this is urgent. thanks dipty
  6. Hi , Thanks a lot . This is what i have done : JRDesignStyle style = new JRDesignStyle(); JRDesignConditionalStyle a = new JRDesignConditionalStyle(); a.setBackcolor(MyJasperReport.getColor("#666666")); style.addConditionalStyle(a); Can u tell us how do we use if condition and compare the column value i.e if(col1 == "Account Type"){ the above condition JRDesignConditionalStyle i will put here. } But how do write the If loop. Thanks Dipty.
  7. Hi , Thanks a lot . This is what i have done : JRDesignStyle style = new JRDesignStyle(); JRDesignConditionalStyle a = new JRDesignConditionalStyle(); a.setBackcolor(MyJasperReport.getColor("#666666")); style.addConditionalStyle(a); Can u tell us how do we use if condition and compare the column value i.e if(col1 == "Account Type"){ the above condition JRDesignConditionalStyle i will put here. } But how do write the If loop. Thanks Dipty.
  8. Hi All , I would like to chnage the font of some text based on som econdition like : if (col1 == "Account Type"){ then do something } I am using JasperDesign class and not .jrxml file . This very urgent can u pls suggest .
  9. HI Thanks for the reply , actually iam using JasperDesign API and not an .jrxml file to generate report. My requirement is that i have to create report 1 using once xml and which will be the first page of the PDF and the second once will be the output on report 2 using second XML. Can u suggest me how to do .. as thses two reports do not depend on each other. The problem is iam not using .jrxml ... aim using Jasperdessign API in JAVA class. Thanks Dipty.
  10. HI ALL , Can someone tell me how to generate subreports using JRSubreport,JRSubreportParameter,JRSubreportReturnValue ? I am not using .jrxml file , using JasperDesign API
  11. HI ALL , Can someone tell me how to generate subreports using JRSubreport,JRSubreportParameter,JRSubreportReturnValue ? I am not using .jrxml file , using JasperDesign API
  12. Hi All , Can anyone suggest met how to use JasperDesign API to generate Sub reports. Its urgent... Thanks Dipty
  13. Hi ALL, I want to Generate a PDF report using two XML files. The fist page will be the first XML files followed by the Second report using 2nd XML file . But when the client views the report he will see it as one PDF file. I am not using JRXML iam using the XML file along with JasperDesing API. Can u please Suggest ? as it is urgent. Dipty Post edited by: diptypatil, at: 2008/04/18 04:24
  14. 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
  15. Hi , I am using $V{PAGE_NUMBER} to display the page numbers. I am generating report for PDF , Excel, CSV, but the page numbers are comming in PDF and CSV but in Excel it is not coming , the method which i call to display the footer is : public void addFooter() throws JRException { int height = template.getRowHeight(); 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); // } JRDesignExpression pageExpr = new JRDesignExpression(); 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); pageExpr = new JRDesignExpression(); pageExpr.setText("$V{PAGE_NUMBER}"); pageExpr.setValueClass(Integer.class); System.out.println("Page:"+("$V{PAGE_NUMBER}")); textField.setExpression(pageExpr); 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); } Please suggest ???? Regards, Dipty
×
×
  • Create New...