I have this script on php and i need to create table automatcally from that
foreach ( $GetJobResult->Components->Component as $component_index => $component ) {
$quote_title = ($component_index + 1) . ') ' . $component->Title . "-Machine :\r\n";
if (isset ( $component->Paper->Family )) {
if (isset ( $component->Paper->Type ) && isset ( $component->Paper->Color )) {
if ($component->Ink->FrontColors == '0') {
$quote_impression = "sans impression\r\n";
}
$getPaperInfoResult = $ws->getPaperInfo ( $component->Paper->Family, $component->Paper->Type );
foreach ( $getPaperInfoResult->PapFamType as $paper_index => $paperinfo ) {
if (($paperinfo->Ccoul == $component->Paper->Color) && ($paperinfo->Gramm == $component->Paper->Weight)) {
$quote_support = $paperinfo->Lfam . ' - ' . $paperinfo->Lcoul . ' - ' . $paperinfo->Gramm . ' g/m2' . "\n";
$quote_impression = $component->Ink->FrontColors . ' Couleur(s) ( ' . $component->Ink->FrontColorDesc . ') au recto / ' . $component->Ink->BackColors . ' Couleur(s)' . ' ( ' . $component->Ink->BackColorDesc . ' ) ' . "\n";
break;
}
// $quote_desc[]= $getPaperInfoResult->PapFamType [$component_index + 1]->Lfam . ' - ' . $getPaperInfoResult->PapFamType [$component_index + 1]->Lcoul . ' - ' . $getPaperInfoResult->PapFamType [$component_index + 1]->Gramm . ' g/m2' . "\n";
}
}
$row++; $col++;
$tbl = $p->add_table_cell($tbl, $col, $row, $quote_title, $opttitrecontact);
$imp_text_element1.=$quote_title."-Support : ".$quote_support."-Impression : ".$quote_impression;
}
}
It's done table in each cell the data and skip the one cell on put the data so i need just table contains the data how can i do that.
I see a possible problem, by the way you increase the variables for
That means, for each additional content, you increase the row and the cell. I would expect, the row should only increased as soon you need a new row.
I guess you want not only add one cell for each run in you foreach-loop: $tbl = $p->add_table_cell($tbl, $col, $row, $quote_title, $opttitrecontact); Maybe you want to add more cells, if so, you should add multiple add_table_cell() calls with the data you want to place.
However as Twisty already mentioned, you might describe your problem more precise. Also, the support team from PDFlib might give you further help.