To fetch CRLF in report via band's placeholder

Hi,

I have noticed one thing when I fetch record dynamically in report via docx template, that if the database column have a record with CRLF (enter key) , the band’s place holder will return the record in word wrap format and not exactly like whats there in database table.
Look below these two formats , the first one is the actual field value in table field. and the second one is what I am getting in report downloaded.

A "two-headed" approach on all transactions is encouraged, however, a pre-binding peer-review is advised on accounts with any of the following:

- Renewal rate reductions > 10%
- Insureds with > 10% of fee income billed to United States clients in any of the last 3 years
- 	Non-standard risks (unusual territory, unusual conditions, outside of strategic appetite, high acquisition costs (> 25%), aggregate deductible structures, significant changes to business model, etc.)
- Rate relative to Endurance's benchmark rate <80%
- 	Non-fronting facultative reinsurance arrangements (inwards)
- 	Single Projects (annual or multi-year)
- 	Independent Financial Advisers 
- 	Surveyors with Valuation Fees exceeding 20%

Such peer review shall be documented and noted in the file.

A "two-headed" approach on all transactions is encouraged, however, a pre-binding peer-review is advised on accounts with any of the following: - Renewal rate reductions > 10% - Insureds with > 10% of fee income billed to United States clients in any of the last 3 years - Non-standard risks (unusual territory, unusual conditions, outside of strategic appetite, high acquisition costs (> 25%), aggregate deductible structures, significant changes to business model, etc.) - Rate relative to Endurance's benchmark rate <80% - Non-fronting facultative reinsurance arrangements (inwards) - Single Projects (annual or multi-year) - Independent Financial Advisers - Surveyors with Valuation Fees exceeding 20% Such peer review shall be documented and noted in the file.

Hi,
Unfortunately, we cannot reproduce the problem. Could you please provide more details?
Which DBMS do you use?
Could you share the template of the report or the whole report? It could be exported on the Reports->Reports screen.

Hi,

I am using SQL server 2014.
See below image has CRLF which is actual data I want to fetch in report.
But when you see the second image, thats the data I am getting from report print, its killing all the CRLF. Any way to preserve those CRLF while print report?
I hope you understood the challenge I am facing.

crlf

cfdr

Hi,
Still cannot reproduce.

Is the screenshot with CRLF taken from DBMS manager? Are you sure the text is stored in DB correctly?
Which template and output type do you use? Do you use OpenOffice integration?
Which type of Band is used to extract the data (JPQL, SQL, Entity etc)?

Hi,

Here are the comments underlined.

Is the screenshot with CRLF taken from DBMS manager?

  • Yes, its taken from SQL server database’s column.

Are you sure the text is stored in DB correctly?
-Yes its stored exactly the way its there in screenshot with CRLF.

Which template and output type do you use?

  • I am using DOCX template and with same output type.

Do you use OpenOffice integration?

  • Yes, I use OpenOffice for XLSX to PDF conversion but here in this case I am using DOCX template.

Which type of Band is used to extract the data (JPQL, SQL, Entity etc)?

  • SQL is being used to extract the data.

Hi,
Do you use MS Office? We have discovered that new lines might be missed when the report is opened in MS Word.

  1. Try to open the printed report in LibreOffice.
  2. Try to print the report in PDF. Adjust DOCX->PDF conversion using OpenOffice integration (set reporting.openoffice.docx.useOfficeForDocumentConversion = true), as docx4j converter also loses new lines.

Thank you.

Yes I use MS office.
So, do you mean I have to convert output into pdf from docx?
Any other solution without conversion?

Thanks,
Saurabh

There is a YouTrack ticket for this issue. And probably we will fix it in one of the next 6.8 releases.

We can suggest the following workaround.

  1. To get the data use Groovy dataset. See the code below.

  2. Get the value of the property which contains new lines (“Description” in the sample)

  3. And replace “\n” with “<br>”.

     package com.company.sample.core
    
     import com.company.sample.entity.Test
     import com.haulmont.cuba.core.Persistence
     import com.haulmont.cuba.core.Transaction
     import com.haulmont.cuba.core.global.AppBeans
    
     Persistence persistence = AppBeans.get(Persistence.class)
     Transaction tx = persistence.createTransaction()
     Test loadedEntity = null
     try {
         Test entity = (Test) params['entity']
         loadedEntity = persistence.entityManager.find(Test.class, entity.id)
     } finally {
         tx.end();
     }
     return [['name': loadedEntity.name, 'description': loadedEntity.description.replace('\n', '<br>')]]
    

I think you missed one step. i.e., to format the text into html.

image

But I have another question, that even after doing this, it working perfectly fine but only problem is it changes the font in the report irrespective of band’s placeholder.