Hey there, Awesome Customers!

Just a heads up: We'll be taking a breather to celebrate International Workers' Day (May 1st and 2nd - Wednesday and Thursday) and Orthodox Easter from Good Friday (May 3rd) through Easter Monday (May 6th). So, from May 1st to May 6th, our team will be off enjoying some well-deserved downtime.

During this time, our customer support will be running on a smaller crew, but don't worry! We'll still be around to help with any urgent matters, though it might take us a bit longer than usual to get back to you.

We'll be back in action at full throttle on May 7th (Tuesday), ready to tackle your questions and requests with gusto!

In the meantime, you can explore our documentation for Amelia and wpDataTables. You'll find loads of helpful resources, including articles and handy video tutorials on YouTube (Amelia's YouTube Channel and wpDataTables' YouTube Channel). These gems might just have the answers you're looking for while we're kicking back.

Thanks a bunch for your understanding and support!

Catch you on the flip side!

Warm regards,

TMS

Okay
  Public Ticket #1064369
</br> Dont work in the report, i need a /n
Closed

Comments

  •  2
    zeiwander started the conversation

    Hello.

    I have a table, with various values and see correctly, for example:

    Love,

    Dark,

    Other

    In the sql data, I have 

    Love,<br />Dark,<br />Other<br />

    But, when i charge the report, with ${themes}, the data are:

    Love,Dark,Other.

    I need that te report respect the </br> and put a /n in the line, the result should be:

    Love,

    Dark,

    Other

    Is possible?

  • [deleted] replied

    Hi zeiwander,
    Thank you for the purchase.

    Can you please send me a link of your table so I can take a look and can you please describe me your issue in more details because it is not so clear to me. Thanks.

  •  2
    zeiwander replied

    Hello.

    The table is in a local server.

    The problem is these:

    In phpmyadmin, I have a table with data, with values separates by <br/>.

    For example, the field, her name is "themes conversation", from the table "themes people"

    Love,<br />Dark,<br />Other,<br />Because,<br />Philp,<br />Valentin,<br />Data,<br />Remove,<br />Back order<br />

    When I put these field in wpdatatablets, are put correctly, and see each word in a phrase, these is the result:

    Love,

    Dark,

    Other,

    Because,

    Philp,

    Valentin,

    Data,

    Remove,

    Back order

    The problem are in the report builder, when i created the .doc with the report, the values from these field that are named ${theme_conversation), but the result in the report in .doc are these:

    Love,Dark,Other,,Because,Philp,Valentin,Data,Remove,,Back order

    I need that the result on the report are the same how the wpdatatable, the result that need are:

    Love,

    Dark,

    Other,

    Because,

    Philp,

    Valentin,

    Data,

    Remove,

    Back order

    do you know how to resolve these problem?

    Thanks

  •  4
    weihs5 replied

    I have this same request, please post a public solution if you find one.

  • [deleted] replied

    Hi weihs5,

    Sorry for delayed replay. We had national holiday. Can you send me a dump of that table from the database, query from that you have crated a table and tamplate of the report so I can create this on my localhost and see what is the issue.


  •  4
    weihs5 replied

    Column D specifically in the .xlsx, my goal is to get the <br>'s to either disappear or actually break the lines.

  •  2
    zeiwander replied

    Hello Milos


    I send the data the next monday, because i have the data in the office.


    Thanks for all!

  •  2
    zeiwander replied

    Hello Milos.


    I send and email to [email protected] with the data that you need, thanks for all

  • [deleted] replied

    Hi zeiwander,

    I found solution to remove <br> tags from the report. In file ../wp-content/plugins/reportbuilder/source/class.abstract.builder.php find function called getCellOutput and in that function find:

    case 'string':
    $return_val .=
        htmlentities(
            $this->_wpDataTable
                ->getColumn( $columnKey )
                ->returnCellValue( $cellValue )
        );
        break;

    and replace it with:

    case 'string':
    $cellValue = strip_tags( $cellValue );
    $return_val .=
        htmlentities(
            $this->_wpDataTable
                ->getColumn( $columnKey )
                ->returnCellValue( $cellValue )
        );
        break;


  •  2
    zeiwander replied

    Hi Milos.


    My code is a bit different:


        protected function getCellOutput( $columnKey, $cellValue ){
            $return_val = $this->_wpDataTable
                                ->getColumn( $columnKey )
                                ->getTextBefore();
            switch( $this->_wpDataTable->getColumn( $columnKey )->getType() ){
                case 'link':
                case 'image':
                case 'string':
                case 'email':
                    $return_val .=
                        stripslashes(
                            strip_tags(
                                $this->_wpDataTable
                                ->getColumn( $columnKey )
                                ->returnCellValue( $cellValue )
                            )
                        );
                    break;
                case 'int':
                case 'float':
                case 'formula':
                    // Remove thousands separator for data pulled from front-end
                    if( $this->_filteredData != null && is_string( $cellValue ) ){
                        $cellValue = self::unformatNumber( $cellValue );
                    }
                default:
                    $return_val .= $this->_wpDataTable
                        ->getColumn( $columnKey )
                        ->returnCellValue( $cellValue );
            }
            $return_val .= $this->_wpDataTable
                                ->getColumn( $columnKey )
                                ->getTextAfter();
            if( $return_val === '' ){ $return_val = ' '; }
            return apply_filters( 'reportbuilder_before_render_cell_output', $return_val, $this->_wpDataTable->getColumn( $columnKey )->getType() );

        }




    That need to change, i dont want remove the br, i need that in the zone that exist a br, i put a jum line (how if you put a /n).

    How the example that i send in the email


  • [deleted] replied

    Hi zeiwander,

     Maybe you can try to add this line after case 'email': line and try does it work:

    $cellValue = str_replace("<br>"," \n ", $cellValue); 
  •  2
    zeiwander replied

    Hello.

    I put the data, but dont work.

    $cellValue = str_replace("<br>"," \n ", $cellValue); 


    The replace is correct, for example if i put:

    $cellValue = str_replace("<br>"," test ", $cellValue); 

    The result are 

    Love, test Dark, test Other, test Because,

    But when i put 

    $cellValue = str_replace("<br>"," \n ", $cellValue); 

    The result are the same, no put a new line.

  • [deleted] replied

    Hi zeiwander,

    Can you try to replace this:

    $return_val .=
        stripslashes(
            strip_tags(
                $this->_wpDataTable
                    ->getColumn( $columnKey )
                    ->returnCellValue( $cellValue )
            )
        );
    break;

    with this and see does it work then:

    $cellValue = str_replace("<br>"," \n ", $cellValue);
    $return_val .=
                $this->_wpDataTable
                    ->getColumn( $columnKey )
                    ->returnCellValue( $cellValue );
        break;


  •  2
    zeiwander replied

    Hi Milos

    I replace, but dont working, put a blank space , but not a new line:

    case 'link':
                case 'image':
                case 'string':
                case 'email':
                    $cellValue = str_replace("<br>"," \n ", $cellValue);
    $return_val .=
    $this->_wpDataTable
    ->getColumn( $columnKey )
    ->returnCellValue( $cellValue );
    break;

    The result before the modify:

    Casa,Mar,Palacio

    The result after the modify:

    Casa,    Mar,    Palacio

    In the table from wpdatable, the data from the field when inspect with control+u, is :

    <td style class =" Marcos">

    "Casa, "

    <br>

    "Mar, "

    <br>

    "Palacio"

    </td>

    In the field from wpdatable are fine, but in the reportbuilder dont

    Thanks

  • [deleted] replied

    Hi zeiwander,

    It is working for me on your table example for column Confirmed_Load_Port (See attachment). What version of Report Builder do you have installed?

    This issue is probably it not related with report builder than with Word version or something like that because it is not reading /n or <br> as a new line break.  

  •  2
    zeiwander replied

    Hello.


    I dont understand, it is not my data...my data send you in a email.


    These data are from the person weihs5  that asked in the same thread that me......my data are that i send in the email, with field "personajes", etc


    I see that the different are that her BR are text, not a html tag, in my data are html tag.


    Its not and error from word, my version from report are 1.0.1

    Please, see the data that i send to an email, not the data from weihs5 , that is not my error, and not mixing problems


    Thanks


  • [deleted] replied

    Hi zeiwander,

    As I see you didn't send me the dump from the database. You sent me just a PDF file from that I can't create a wpDataTable. The issue in you case and weihs5  is the same. <br> tags are not respected in the Report. Report builder is taking the data of the cell and then using PHPWord library try to create a Report. We tried to replace <br> tags with \n and this doesn't help.

    What do you mean is solution for this if \n or <br> tag is not respected in the Word as a line break? How can Word recognize that String has a line break if it is not respecting \n? Can you send me a dump of the the table called vistabuscador so I can try with your data, but I think that the problem is not in the data itself than because Word is not recognizing /n.  

  •  2
    zeiwander replied

    Thanks!!


    I have a update the version 1.0.1 and 1.0.2 and work!.


    I have another problem, that in the version 1.0.1 dont have...


    In the text, The report cut the text, for example in the <td> from wpdatatable:



    Male,Young,Protagonist, 
    Male,Young,Protagonist, 
    Male,Young,Protagonist, 
    Male,Young,Protagonist, 
    These is the data from the person that work in these data


    These are the result in the report

    Male,Young,Protagonist, 
    Male,Young,Protagonist, 
    Male,Young,Protagonist, 
    Male,Young,Protagonist, 
    These is the data from the pe


    Thanks!!!

  • [deleted] replied

    Hi zeiwander,

    I didn't understand what is the issue now. Two examples that you have sent me are same as I see.

  •  2
    zeiwander replied

    Hi


    Thanks for all, if you see the data, in these zone:

    "These is the data from the person that work in these data"

    In the report the data is cut, and the data are:

    "These is the data from the pe"


    In the 1.0.1 was work fine, i updated the report builder to 1.0.2 and the br work fine, but these are and new error, and the error is that the reportbuilder cut long phrases.


    Thanks


  • [deleted] replied

    Hi zeiwander,

    Can you please send me the dump of the database as I ask you before and the template of the report? Or the template is the same as the template from the email that you have sent me before?

    Also can you tell me what is the column of the table where the text is cuto ff?

  •  2
    zeiwander replied

    Thanks.


    I send you tomorrow the data.


    Other problem that in the new version, there are 2 options that need and is dissapear in the new version:


    Version 1.0.1 wpdatatables have "limit table layout" and "word wrap", and in the 1.0.2 not have these options.


    thanks


  • [deleted] replied

    Hi zeiwander,

    Version 1.0.1 wpdatatables have "limit table layout" and "word wrap", and in the 1.0.2 not have these options.
    These options are not related with version of the Report Builder than with version of wpDataTables. Word Wrap was actually always functional only when "Limit table layout" was turned on, so we decided to hide it in case this checkbox isn't ticked. Can you please check?

  •  2
    zeiwander replied

    Hello.

    Thanks for all, the problem are fixed with your indications!

    I fixed all the problems, one of the problem was in the sentence:

    $cellValue = str_replace("<br>"," \n ", $cellValue); 

    The sentence not working in microsoft office, but i se that the plugin work to phpworld.

    If change the sentence for these:

    $cellValue = str_replace("<br>","\n<w:br/>", $cellValue);

    Work in microsoft office and open office ;)

    Thanks for all!

  • [deleted] replied

    Hi zeiwander,

    I am glad that you have found solution by your own It was interesting issue and could help for some future tickets. We'd greatly appreciate it if you could take a minute and leave a review on CodeCanyon on this link. Thanks! 

  •  2
    zeiwander replied

    Thanks Milos.


    If i can ask a final question, is possible to the plugin convert to .doc to pdf.


    For example, in my table when download the reports, i have a .zip with 3 .doc.


    Is possible that the plugin give me a zip with 3 .pdf?


    Thanks for all, is a great plugin and a better people that work in these plugin!


    I give a great review in CodeCanyon ;)

  • [deleted] replied

    Hi zeiwander,

    Unfortunately for now it's not possible to generate .pdf files as reports but we have plans to implement .pdf reports in one of the future reports. Thanks for your kind words. 

  •  2
    zeiwander replied

    Thanks for all, for me is all OK in these ticket ;)

  •  2
    zeiwander replied

    Hello again.


    A question, i have a problem, in the report are data are ok when use these:

    $cellValue = str_replace("<br>","\n<w:br/>", $cellValue);

    But, in the export options from wpdatatable (excell, csv,pdf), i have the same problem that i had in the report, that dont put a line in the BR, and all the data are in the same line.


    In that line of code and archive, I have to replace the code from the plugin to put these correct code?

    $cellValue = str_replace("<br>","\n<w:br/>", $cellValue);


    Thanks!

  • [deleted] replied

    Hi zeiwander,

    Unfortunately this is not possible in Table Tools (Excel, CSV, PDF). We are using datatables library for creating tables and datatables is using some other libraries for Table tools exporting features that we can't affect as we can on Report Builder.

  •  2
    zeiwander replied

    Hello.


    The problem that in the wpdatatable is visible correctly, but in the excel, pdf and csv dont.


    Put two images, I need only that the result are the same in the wpdatatable and the excell/pdf/csv.


    Thanks

  • [deleted] replied

    Hi zeiwander,

    That is happening just when you Export the wpDataTable to Excel, CSV or PDF? 

  •  2
    zeiwander replied

    Yes, just when the export, the problem exist in the report, but its solved with these replace, that change in the .doc the br from a line:

    $cellValue = str_replace("<br>","\n<w:br/>", $cellValue);

    But in the Excel, CSV or PDF, I dont know in these line of code i can change put before convert the table in Excel, CSV or PDF, change the valures <br> from other values, from example \n<w:br/> or other character, for example ","

  • [deleted] replied

    Hi zeiwander,

    .doc file is related with Report Builder and these other features (Excel, CSV, PDF) that are above the table are native datatables features and these are not related with Report Builder. As I already said because these features are native datatables features unfortunately they can't be fixed and <br> will not affect in these features. 

    You can find these features on this link to see that they are built*in in datatables and they are not related with wpDataTables code.

  •  2
    zeiwander replied

    Thanks!


    I fully complete the application, a last question.


    is possible to change the orientation from the pdf export?


    Change the portrait to landscape.


    Thanks!

  • [deleted] replied

    Hi zeiwander,

    Yes it is possible. 

    In file../wp-content/plugins/wpdatatables/source/class.wpdatatable.php you can find

    'orientation' => 'portrait',
    

    and replace it with

    'orientation' => 'landscape',
  •  2
    zeiwander replied

    Thanks Milos

    Its correct, i have the orientation changed!