inspireddesign Posted July 4, 2009 Share Posted July 4, 2009 Hello all, I have the following Functions that create cells in an RTF document which works (somewhat). Currently the cells that are created are ADDING to the previous call (which is fine) but when I close the line (close_line() function) it should clear ALL previous results and start fresh with the new line. Does someone have any ideas? Thanks for any help you can provide, here's the code: <?php function create_cell($msg, $sizeCell, $cellColorId = NULL) { static $total_size = 0; ### Calculate the size of the cell $cellSize = (10800*($sizeCell/100)) + $total_size; $total_size = $cellSize; ### Put the background color of the cell if ($cellColorId){$cell .= "\\clcfpatraw".$cellColorId."\\clshdngraw10000\n";} ### Assemble the cells of the table (the sum of the sizes of the cells should not exceed 21,600) $cell .= "\\cellx".$cellSize."\n"; $cell .= "\\pard \\intbl "; $cell .= $msg." \\cell\n"; return $cell; } function open_line(){ ### Mount the table within the document $cell .= "\\trowd\\trgaph35\\trautofit1\\trpaddfr3\\trpaddfl3\\trpaddft3\\trpaddfb3\\trpaddr55\\trpaddl55\\trpaddb15\\trpaddt35\n"; return $cell; } function close_line(){ ### Go to the next line $cell .= "\\pard \\intbl \\row\\pard\n"; return $cell; } ?> Here's are the calls: <?php $output .= open_line(); $output .= create_cell('First Cell Msg', "50", "8" ); $output .= create_cell('Second Cell Msg', "50", "8" ); $output .= close_line(); $output .= open_line(); $output .= create_cell('Next Line - First Cell Msg', "50", "8" ); $output .= create_cell('Next Line - Second Cell Msg', "50", "8" ); $output .= close_line(); echo $output; ?> Link to comment https://forums.phpfreaks.com/topic/164761-solved-function-help/ Share on other sites More sharing options...
inspireddesign Posted July 4, 2009 Author Share Posted July 4, 2009 This has been solved. Link to comment https://forums.phpfreaks.com/topic/164761-solved-function-help/#findComment-868875 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.