Jump to content

noxmldesign - error with \n characters in str


Recommended Posts

By: Enrico Goosen - enricogoosen

noxmldesign - error with n characters in str

2003-05-14 05:15

Hi,

I'm generating a JasperDesign at runtime (no XML).

I'm getting the following error when I pass a String into the textField element that contains (n) characters.

/home/enrico/SubReportDesign1.java:116: unclosed string literal

value = (java.lang.String)("Ferrari

^

/home/enrico/SubReportDesign1.java:118: unclosed string literal

");

^

/home/enrico/SubReportDesign1.java:119: ')' expected

break;

^

/home/enrico/SubReportDesign1.java:181: unclosed string literal

value = (java.lang.String)("Ferrari

^

/home/enrico/SubReportDesign1.java:183: unclosed string literal

");

^

/home/enrico/SubReportDesign1.java:184: ')' expected

break;

^

/home/enrico/SubReportDesign1.java:246: unclosed string literal

value = (java.lang.String)("Ferrari

^

/home/enrico/SubReportDesign1.java:248: unclosed string literal

");

^

/home/enrico/SubReportDesign1.java:249: ')' expected

break;

^

9 errors

dori.jasper.engine.JRException: Errors were encountered when compiling report expressions class file:

See error messages above.

 

Any ideas how I can fix this?

 

 

 

 

By: Teodor Danciu - teodord

RE: noxmldesign - error with n characters in str

2003-05-14 05:30

 

Hi,

 

You have to replace 'n' character with the "n" sequence in the String values you put inside

the text field expressions.

Because the expressions are used to create

a Java source file at report compile time.

 

I hope this helps.

Teodor

 

 

 

 

 

By: Enrico Goosen - enricogoosen

RE: noxmldesign - error with n characters in

2003-05-14 23:30

Hi Teodor,

 

I'm sorry, I don't understand. Can you be more specific?

Here's my code:

JRDesignTextField tf = new JRDesignTextField();

tf.setX(x);

tf.setY(y+20);

tf.setWidth(columnSize);

tf.setHeight(columnHeight);

tf.setTextAlignment(JRTextElement.TEXT_ALIGN_LEFT);

tf.setFont(normalFont);

tf.setStretchWithOverflow(true);

JRDesignExpression expression = new JRDesignExpression();

expression.setValueClass(java.lang.String.class);

//eg. String val = "Blah blah blah.nBlah blah blah.n";

expression.setText("""+val+""");

tf.setExpression(expression);

band.addElement(tf);

 

 

 

 

By: Teodor Danciu - teodord

RE: noxmldesign - error with n characters in

2003-05-17 05:19

 

Hi,

 

Well, you see? You have already introduced escape

character to make it for the quotes arround the text,

in the text field expression.

But what about the quotes inside the text? And what

about the newline characters there?

We have to escap them in the same manner.

Because the text you supply there will be used in the

source code of a real java class. And this class file

will not compile otherwise.

 

I still don't see why you cannot pass the text field

content at runtime using parameters and you put

it in the text fields at design time.

 

I hope this helps.

Teodor

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...