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

comments in jrxml are erased by iReport


alexeysem

Recommended Posts

Hi,

I have a very short question. On saving a jrxml document in iReport it does reformats the xml source code. That would be okay if it didn't also remove all comments. This is rather annoying as I 1. cannot leave any comments for the further supporters of the very non-trivial report I'm developing 2. cannot comment elements I don't need while debugging.

So, is it possible to disable source reformatting in iReport, or fine-tune it to keep the comments? I hope it is...

Thanks in advance.

 

Link to comment
Share on other sites

  • 4 weeks later...
  • Replies 18
  • Created
  • Last Reply

Top Posters In This Topic

Hi,

As you might have noticed, every time you do something in iReport's visual editor and then switch to the jrxml source, it looks like it fully reformats the code.

Actually, as they say, it doesn't simply reformat, it simply exports the internal representation of the report.

So, what iReport works with is only that internal representation, and surprisingly there's no place in it for preserving the original formatting or at least the comments.

To sum it up: currently there's no way to keep the comments.

I personally treat this as a miserable failure, as the whole JRXML language seems to be very well focused on being readable and understandable, especially compared to e.g. BIRT reports, which quickly become huge and monstrous. I guess they just didn't have time or spare hands to implement this feature.

Hope this helps,

A. 

Link to comment
Share on other sites

  • 6 months later...

See my answer few comments above:

"To sum it up: currently there's no way to keep the comments."

And just don't waste your time on this issue...

If you need comments in the beginning of the end of the file, you could just keep them in a separate file (e.g. "file.jrxml.comm") and expand your building tool to merge them before a check-in.

Note that you'll go straight to the hell after your death if you follow this advice :)
 

Link to comment
Share on other sites

Hi,

    In JR 3.7.x there are a element called "callouts". You can reach these in IR under the Pallet Window. These "callouts" works like sticky notes in the IR interface and in the generate XML it can be readed like this:

<property name="ireport.callouts" value="##Fri Nov 12 23:12:35 GMT-03:00 2010\ncallouts.1.text=Hello World!, I'm a callout...\ncallouts.1.bounds=294,80,181,73"/>

Grettings from Argentina!

PS: I have attached a screenshot.

Link to comment
Share on other sites

  • 4 months later...

hi!

               When are we going to have a comment facility in Jasper reports? Its really bothering issue comments get deleted. I am new to iReport and when I made something as a comment , to my surprise it got lost. I thought as if I hade done something wrong. But when I searched in then came to know about comments being not supported in ireports. I hope we will get this requirement  fixed very soon.

 

Link to comment
Share on other sites

  • 1 year later...
  • 5 months later...

Considering the issue tracker ticket was created 8 years ago, I'm assuming this will never be fixed. So, a recap of ideas/hacks here and then a couple more I've tested:

  • Comment the SQL query
  • Add a callout element from the Palette in the Tools category. As stated above, these are sticky notes and do not show up in the report
  • Add a separate file for comments and then use a build tool to merge them (then go to hell after death)
  • For parameters and fields, there is a "Description" property you could use to comment
  • For variables, if you use an expression, you can include Java comments (//) in the expression but they must be on a different line than the expression being semicolons are illegal. It appears iReport uses the newline character to separate comment from expression code.
  • For other elements, you can experiment with "Print When Expression" to sneak comments in. Again, they must be on their own line. If the element is always visible, then you can write your comment and then simply type "true" on the next line.

Unfortunately none of these methods let you debug by commenting out elements in the XML directly, but it's something anyway.

Link to comment
Share on other sites

  • 3 months later...
I haven't seen this suggestion, but it's one I use from time to time. If you really must keep comments in the file, create a static text field and enter your comments there. Then set the dimensions of this field to 0,0,0,0 so that it doesn't display.
Link to comment
Share on other sites

  • 1 year later...
  • 7 months later...
  • 2 years later...
  • 3 years later...

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