sth Posted January 20, 2010 Share Posted January 20, 2010 We're generating reports in CSV format from JasperServer, but have a few recipients who need Windows line breaks as the record delimiter. Since this is only a minority, we'd like to embed this change in the jrxml templates for these reports instead of making this change globally on the server. I've found the property and have been able to change the record delimiter by adding the following property setting into the jrxml:<property name="net.sf.jasperreports.export.csv.record.delimiter" value="\r\n"/>The problem is that no matter how we've tried to specify the value, it always uses the literal value. Leaving it out we get the default \n delimiter, but given the above line instead of using an ascii 13 and an ascii 10 we get a very literal "\r\n", like this:"...end of record1\r\nstart of record2..."I can't figure out how to indicate the use of non-printing characters. I've tried doubling and even quadrupling the backslash along with anything else I could think of, but if we provide this property it uses exactly the characters provided.Does anyone know the syntax we need to use to provide non-printing characters to this property? Either that, or is this possibly a known issue fixed in a later version? (We're currently running JS 3.0)Any insight would be greatly appreciated. Link to comment Share on other sites More sharing options...
lucianc Posted January 29, 2010 Share Posted January 29, 2010 You should use XML entities for the characters.Regards,LucianCode:<property name="net.sf.jasperreports.export.csv.record.delimiter" value=" "/> Link to comment Share on other sites More sharing options...
sth Posted February 1, 2010 Author Share Posted February 1, 2010 Thank you, Lucian. That does exactly what we were trying to do. Link to comment Share on other sites More sharing options...
carloh Posted May 18, 2015 Share Posted May 18, 2015 Hi LucianI have tried your solutions above with no success. Just to check, when I click on a cube it gives me certain counts. When I click on the total it open a new window which gives me an option to do an Excel export (csv) which needs to be semi-colon delimited. Am I looking in the right place?Thanks Carlo Link to comment Share on other sites More sharing options...
dkman123 Posted May 28, 2015 Share Posted May 28, 2015 The way that I do it (and I'm not sure that it's the best way, but it works) is:Close the file in Jaspersoft StudioOpen it with Notepad++ (or your editor of choice)Between <jasperReport .../> and <queryString ...> you can add <property .../> lines. Here you want to add: <property name="net.sf.jasperreports.export.csv.record.delimiter" value=" "/>As Lucian explained you can't use n because it will put the literal string. You need to use XML entities.Save the file.Re-open it in Jaspersoft Studio (you can use recent files)Preview and export, your csv should have CRLF at the end of the record (in Notepad++ verify with View - Show Symbol - Show End of Line)Personally I also use these properties: <property name="net.sf.jasperreports.print.keep.full.text" value="true"/> <property name="net.sf.jasperreports.export.csv.field.delimiter" value="|"/>The first one allows you to use small fields in your design and the full data will export without getting truncated.The second one uses pipe delimiters instead of commas. Link to comment Share on other sites More sharing options...
LuttermJ Posted February 13, 2018 Share Posted February 13, 2018 After many frustrating hours, trying to solve the exact same problem ... I have a "simple" solution:Open the "properties" for your project (<abc>.jrxml)Select Jaspersoft StudioSelect ExportersSelect CSV ExporterChoose whether you want to make this change globally (i.e. Workspace), or only for the "Project", or only for the "File"In the "Record Delimiter" field enter "rn" (without quotes)I found that when entering "nr", as recommended by Jaspersoft ... then the .CSV file contains <LF><CR>, which is not properly interpreted/displayed by Windows ... causing the very long line without apparent breaks.Jon Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now