KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Table row group background color not showing in cloudexport to pdf #2827

Open Andrew Guattery opened this topic on on Sep 20, 2022 - 3 comments

Andrew Guattery commented on Sep 20, 2022

Ok gang, I have a report that exports to pdf using CloudExport. The report exports just fine, except that the table row-group footer background color is not applied. The table head is the same dark gray. Can someone help me out here? This is the report.view.php for the grouping:

....        
"bottom"=>"<td colspan=\"6\"><b>Total for user {USRNAME}</b></td><td><b>pdholidayAmount</b></td><td></td><td><b>pdMealAmount</b></td><td><b>pdptoAmount</b></td><td><b>pdhrsAmount</b></td><td><b>totalhoursAmount</b></td>"
           ],
           ],
               "cssClass"=>array(
        "table"=>"table table-bordered",
        "tr"=>function($row){
            if($row["PTO"]=="*"){ return "yellowCss";}
            if($row["IsHoliday"]>= 8){ return "orangeCss";}
        },
        "th"=>function($columnName){
             if($columnName == "SEQ_NO_CLCK_IN" || $columnName == "SEQ_NO_CLCK_OUT"){ return 'nodisplay';}
        },
        "td"=>function($row,$columnName){
            if($columnName=="IsHoliday" && $row["IsHoliday"] != '0'){
            return "bold";
            } elseif($columnName=="PtoToPay" && $row["PtoToPay"] != '0'){
            return "bold";
            } else {return"";}
        },
        "tf"=>function($columnName){
            return "darker";
        }
    ),

It is the "bottom" that is not getting the proper css styling for the row.

Sebastian Morales commented on Sep 26, 2022

By default chrome headless doesn't print (to either paper or pdf) background color to save ink. Pls try to add this css rule to your report view page:

//MyReport.view.php
@media screen {
    * {
        -webkit-print-color-adjust: exact;
    }
}

@media print {
    * {
        -webkit-print-color-adjust: exact;
    }
} 
Andrew Guattery commented on Sep 26, 2022

Hi Sebastian, Yes I am aware of Chrome not printing background by default, and I already have the code you sent in my css file for this report. Just for a sanity-check I added it directly to the report view as you suggested but unfortunately there was no change. We'll be ok without, but it is odd that we cannot get headless over-ridden to print as desired.

Sebastian Morales commented on Sep 28, 2022

Andrew, pls try to apply css style background color directy to your Table's column and see how it goes:

https://www.koolreport.com/docs/koolphp/table/#table-settings-column-cssstyle

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
help needed

CloudExport