customize excel output file April 25, 2020, 11:17:59 AM hi,is there a way to customize the excel output file like column size, bold header etc. ?and where can that be done ?tx, brienen Quote Selected
Re: customize excel output file Reply #1 – April 25, 2020, 09:48:18 PM @brienen please use an excel editor to edit the exported excel file, if you still want to edit it from code I can point you to where you can find the code that handles that. You can find it in /helpers/Functions.php on line 55 to 69. Quote Selected
Re: customize excel output file Reply #2 – April 27, 2020, 11:43:11 AM Tx Willvin,Sorry, but I was looking for the xls output and not the csv output.Anyway I found it where to change , in the libs dir the file XLSXWriter.php contains the settings for the xls output:In the writeSheetHeader function line 223: $col_widths = isset($col_options['widths']) ? (array)$col_options['widths'] : array();change to an array with the different column widths : $col_widths = isset($col_options['widths']) ? (array)$col_options['widths'] : array(10,20,25,25,25,11,25,25,25,11,25,9,50,10);line 225: $freeze_rows = isset($col_options['freeze_rows']) ? intval($col_options['freeze_rows']) : true;change the first row to frozen : trueline 236, add one line with the style settings for the header : $style = array( 'font'=>'Tahoma','font-size'=>10,'font-style'=>'bold','fill'=>'#eee','halign'=>'center','border'=>'left,right,top,bottom');The docs of this class are very well explained and supported here :https://github.com/mk-j/PHP_XLSXWriter/blob/master/xlsxwriter.class.php Quote Selected
Re: customize excel output file Reply #3 – May 04, 2020, 11:57:57 AM I added some lines in the XLSXWriter.php file , when you have more than one excel output file and ofcourse the columns have diferent sizes, so used the switch case, to switch depending on the $sheet_name variable.Below the changes in the writeSheetHeader function : switch ($sheet_name) { case 'Tareas': $col_widths = isset($col_options['widths']) ? (array)$col_options['widths'] : array(10,20,25,25,25,11,25,25,25,11,25,9,50,10); break; case 'Ingresos': $col_widths = isset($col_options['widths']) ? (array)$col_options['widths'] : array(15,10,13,17,12,11,25,22,15,50); break; case 'Salidas': $col_widths = isset($col_options['widths']) ? (array)$col_options['widths'] : array(14,10,13,13,25,25,12,28,22,11,13,13,50); break; } Quote Selected