• Resolved Stoton

    (@stoton1)


    Hi, I have looked through the documentation but cant find any way to set the cell background color of an XLS file (from what I understand CSV files cannot have colors applied when saving with php).

    Is there any filter available to modify the cell background color of a XLS file when the plugin creates the file? That can be added to the Custom PHP input area of the plugin?

    Thanks for your time.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author algol.plus

    (@algolplus)

    hi

    You should use hook woe_xls_print_footer
    There’re some examples at page https://docs.algolplus.com/algol_order_export/format-output/

    thanks, Alex

    Thread Starter Stoton

    (@stoton1)

    Thanks very much @algolplus

    That filter did the trick, I have it working now.

    Here’s an example in case it can help someone else.

    add_action( 'woe_xls_print_footer', function ( $objXls, $formatter ) {
    
        $custom_format = array(
            'font' => array(
                'bold' => true,
            ),
            'alignment' => array(
                'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_LEFT,
            ),
            'borders' => array(
                'allborders' => array(
                  'style' => PHPExcel_Style_Border::BORDER_THIN,
                  'color' => array( 'rgb' => 'BBBBBB' ),
                )
            ),
            'fill' => array(
                'type' => PHPExcel_Style_Fill::FILL_SOLID,
                'color' => array('rgb' => 'F28A8C' ),
            ),
        );
    
        $formatter->objPHPExcel->getActiveSheet()->getStyle('B3:B7')->applyFromArray( $custom_format );
    
    } ,10, 2); 
    Plugin Author algol.plus

    (@algolplus)

    You’re very welcome.
    Thank you for the code.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Set cell background color’ is closed to new replies.