mohierf
February 3, 2012, 5:14am
#1
Hello,
I meet the same problem with Pdf export as it existed for Excel export (see previous post from SigerMatt …). I tried to understand how to remove the filter header line in the generated Pdf but no success … any help please ?
Best regards, Frédéric.
radyno
February 3, 2012, 1:06pm
#2
Hi,
Could you provide link to mentioned post?
mohierf
February 4, 2012, 1:02pm
#3
radyno
February 7, 2012, 7:56am
#4
Hi,
you have to add the same code into gridExcelGenerator.php:
...
$this->summaryWidth = $summaryWidth;
$this->columns = array_slice($this->columns, 0, 1);
...
mohierf
February 7, 2012, 9:14am
#5
Hi radyno,
add the same code in gridExcel Generator.php ? But my problem concerns the PDF generator … are you sure ?
My gridExcelGenerator.php file is already modified and I made the test to modify the gridPdfGenerator.php like this :
if ($i == 0) {
$this->summaryWidth = $summaryWidth;
// Added this line ...
$this->columns = array_slice($this->columns, 0, 1);
}
but this modification does not change anything …
An other idea ?
Best regards, Frédéric.
radyno
February 7, 2012, 10:15am
#6
You have to modify code in a another place:
private function headerParse($header) {
...
foreach ($columns as $row) {
...
if ($i == 0) {
$summaryWidth += $columnArr['width'];
$columnArr['excel_type'] = ...;
}
...
}
$this->summaryWidth = $summaryWidth;
// you have to add code here:
$this->columns = array_slice($this->columns, 0, 1);
}
mohierf
February 7, 2012, 5:14pm
#7
I can’t find the code template you are talking about in the headerParse function of gridPdfGenerator.php … hereunder a copy of my source code (last version downloaded last week).
Perharps we do not have the same version ?
Best regards, Frédéric
private function headerParse($header) {
if (isset($header->column)) {
$columnsRows = Array($header->column);
} else {
$columnsRows = $header->columns;
}
$i = 0;
foreach ($columnsRows as $columns) {
$summaryWidth = 0;
$k = 0;
foreach ($columns as $column) {
$columnArr = Array();
$columnArr['hidden'] = ($column->attributes()->hidden == 'true') ? true : false;
if ($columnArr['hidden'] == true) {
$this->hiddenCols[$k] = true;
$k++;
continue;
}
if ($this->strip_tags == true) {
$columnArr['text'] = strip_tags(trim((string) $column));
} else {
$columnArr['text'] = trim((string) $column);
}
$columnArr['width'] = trim((string) $column->attributes()->width);
$columnArr['type'] = trim((string) $column->attributes()->type);
$columnArr['align'] = trim((string) $column->attributes()->align);
$columnArr['colspan'] = trim((string) $column->attributes()->colspan);
$columnArr['rowspan'] = trim((string) $column->attributes()->rowspan);
$summaryWidth += $columnArr['width'];
$this->columns[$i][] = $columnArr;
if ($i == 0) {
$widths[] = $columnArr['width'];
}
if ($columnArr['colspan'] != '') {
$columnArr['width'] = 0;
}
$k++;
}
$this->columns[$i]['width'] = $summaryWidth;
if ($i == 0) {
$this->summaryWidth = $summaryWidth;
}
$i++;
}
for ($i = 0; $i < count($this->columns); $i++) {
$offset = 0;
for ($j = 0; $j < count($widths); $j++) {
if ($this->columns[$i][$j]['colspan'] != '') {
$w = $widths[$j];
for ($k = 1; $k < $this->columns[$i][$j]['colspan']; $k++) {
$w += $widths[$j + $k];
$this->columns[$i][$j + $k]['width'] = 0;
}
$this->columns[$i][$j]['width'] = $w;
$j += $this->columns[$i][$j]['colspan'] - 1;
} else {
$this->columns[$i][$j]['width'] = $widths[$j];
}
}
}
for ($i = 0; $i < count($this->columns); $i++) {
for ($j = 0; $j < count($widths); $j++) {
if ((isset($this->columns[$i][$j]))&&($this->columns[$i][$j]['rowspan'] != '')&&(!isset($this->columns[$i][$j]['rowspanPos']))) {
for ($k = 1; $k < $this->columns[$i][$j]['rowspan']; $k++) {
$this->columns[$i + $k][$j]['rowspanPos'] = $this->columns[$i][$j]['rowspan'] - $k;
$this->columns[$i + $k][$j]['rowspan'] = $this->columns[$i][$j]['rowspan'];
}
$this->columns[$i][$j]['rowspanPos'] = 'top';
}
}
}
$this->widths = $widths;
}
radyno
February 8, 2012, 8:13am
#8
Hi,
i think we have different versions.
So try to add this line in the end of method headerParse:
private function headerParse($header) {
if (isset($header->column)) {
$columnsRows = Array($header->column);
} else {
$columnsRows = $header->columns;
}
$i = 0;
foreach ($columnsRows as $columns) {
$summaryWidth = 0;
$k = 0;
foreach ($columns as $column) {
$columnArr = Array();
$columnArr['hidden'] = ($column->attributes()->hidden == 'true') ? true : false;
if ($columnArr['hidden'] == true) {
$this->hiddenCols[$k] = true;
$k++;
continue;
}
if ($this->strip_tags == true) {
$columnArr['text'] = strip_tags(trim((string) $column));
} else {
$columnArr['text'] = trim((string) $column);
}
$columnArr['width'] = trim((string) $column->attributes()->width);
$columnArr['type'] = trim((string) $column->attributes()->type);
$columnArr['align'] = trim((string) $column->attributes()->align);
$columnArr['colspan'] = trim((string) $column->attributes()->colspan);
$columnArr['rowspan'] = trim((string) $column->attributes()->rowspan);
$summaryWidth += $columnArr['width'];
$this->columns[$i][] = $columnArr;
if ($i == 0) {
$widths[] = $columnArr['width'];
}
if ($columnArr['colspan'] != '') {
$columnArr['width'] = 0;
}
$k++;
}
$this->columns[$i]['width'] = $summaryWidth;
if ($i == 0) {
$this->summaryWidth = $summaryWidth;
}
$i++;
}
for ($i = 0; $i < count($this->columns); $i++) {
$offset = 0;
for ($j = 0; $j < count($widths); $j++) {
if ($this->columns[$i][$j]['colspan'] != '') {
$w = $widths[$j];
for ($k = 1; $k < $this->columns[$i][$j]['colspan']; $k++) {
$w += $widths[$j + $k];
$this->columns[$i][$j + $k]['width'] = 0;
}
$this->columns[$i][$j]['width'] = $w;
$j += $this->columns[$i][$j]['colspan'] - 1;
} else {
$this->columns[$i][$j]['width'] = $widths[$j];
}
}
}
for ($i = 0; $i < count($this->columns); $i++) {
for ($j = 0; $j < count($widths); $j++) {
if ((isset($this->columns[$i][$j]))&&($this->columns[$i][$j]['rowspan'] != '')&&(!isset($this->columns[$i][$j]['rowspanPos']))) {
for ($k = 1; $k < $this->columns[$i][$j]['rowspan']; $k++) {
$this->columns[$i + $k][$j]['rowspanPos'] = $this->columns[$i][$j]['rowspan'] - $k;
$this->columns[$i + $k][$j]['rowspan'] = $this->columns[$i][$j]['rowspan'];
}
$this->columns[$i][$j]['rowspanPos'] = 'top';
}
}
}
$this->widths = $widths;
$this->columns = array_slice($this->columns, 0, 1);
}
mohierf
February 8, 2012, 9:08am
#9
Hi,
thank you. I can export without problems in the file header … but the result is still awful !
I have a problem with a column as you should see in the attached image …
Best regards, Frédéric.
radyno
February 9, 2012, 7:57am
#10
Please, turn on debug option in generate.php:
$debug = true;
After that try to export grid on more time, debug.xml file will be generated.
Could you provide it here?
mohierf
February 9, 2012, 8:50am
#11
Here is it … attached file.
Best regards, Frédéric.
mohierf
February 10, 2012, 2:58am
#12
Sorry … the attachment failed ! I copy the content hereunder :
<rows profile='color'><head><columns><column width='100' align='left' type='ed' sort='connector' color='' id='numeroSerie'><![CDATA[Numéro de série]]></column><column width='0' align='left' type='ro' sort='connector' color='' id='declaration'><![CDATA[Etat de supervision]]></column><column width='175' align='left' type='ro' sort='connector' color='' id='demarree'><![CDATA[Etat de mise sous tension]]></column><column width='0' align='left' type='co' sort='connector' color='' id='etatDemande'><![CDATA[Etat demandé]]><option value='ES'>ES</option></column><column width='134' align='left' type='coro' sort='connector' color='' id='etatTerrain'><![CDATA[Etat terrain]]><option value='ES'>En service</option><option value='SR'>Hors service incident</option><option value='HS'>Hors service gestion</option><option value='IS'>Installation en cours</option><option value='ND'>Non déterminé</option><option value='MP'>En cours de production</option><option value='TU'>Tests en usine</option></column><column width='0' align='left' type='ro' sort='connector' color='' id='dateMaJ'><![CDATA[Date de dernière mise à jour]]></column><column width='0' align='left' type='ro' sort='connector' color='' id='datePing'><![CDATA[Date de dernier ping]]></column><column width='0' align='left' type='ro' sort='connector' color='' id='adresse'><![CDATA[Adresse IP]]></column><column width='0' align='left' type='ro' sort='connector' color='' id='client'><![CDATA[Identifiant du client]]></column><column width='177' align='left' type='co' sort='connector' color='' id='parc'><![CDATA[Parc d'appartenance]]><option value=''></option><option value='ad_pole_emploi'>ad_pole_emploi</option><option value='ad_cpam'>ad_cpam</option><option value='ad_mission_loc'>ad_mission_loc</option><option value='ad_caf'>ad_caf</option><option value='ad_urssaf'>ad_urssaf</option><option value='ad_cidf'>ad_cidf</option><option value='ad_e2c'>ad_e2c</option><option value='ad_mdph'>ad_mdph</option><option value='ad_afpa'>ad_afpa</option><option value='ad_cio'>ad_cio</option><option value='ad_pe_vichy'>ad_pe_vichy</option><option value='ad_pe_mauriac'>ad_pe_mauriac</option><option value='ag_pe_mauriac'>ag_pe_mauriac</option><option value='ag_pe_vichy'>ag_pe_vichy</option><option value='ad_rochefort'>ad_rochefort</option><option value='ag_rochefort'>ag_rochefort</option><option value='ad_aigueperse'>ad_aigueperse</option><option value='ag_aigueperse'>ag_aigueperse</option><option value='ad_lastic'>ad_lastic</option><option value='ag_lastic'>ag_lastic</option><option value='ad_eglisolles'>ad_eglisolles</option><option value='ag_eglisolles'>ag_eglisolles</option><option value='ad_caf63'>ad_caf63</option><option value='ag_caf63'>ag_caf63</option></column><column width='0' align='left' type='ro' sort='connector' color='' id='groupe'><![CDATA[Groupe de borne]]></column><column width='141' align='left' type='ro' sort='connector' color='' id='site'><![CDATA[Site d'installation]]></column><column width='130' align='left' type='co' sort='connector' color='' id='vers_Site'><![CDATA[Lien vers la table des sites]]><option value='2'>CAF 63</option><option value='3'>Rochefort Montagne</option><option value='4'>CC Sioulet Chavanon</option><option value='5'>CC Nord Limagne</option><option value='6'>CC de Gentiane</option></column><column width='100' align='left' type='ro' sort='connector' color='' id='type'><![CDATA[Type de borne]]></column><column width='0' align='left' type='ro' sort='connector' color='' id='modele'><![CDATA[Modèle de borne]]></column><column width='0' align='left' type='ro' sort='connector' color='' id='codeProduit'><![CDATA[Code produit]]></column><column width='0' align='left' type='ro' sort='connector' color='' id='codeProduitIPM'><![CDATA[Code produit IPM]]></column><column width='0' align='left' type='ro' sort='connector' color='' id='application'><![CDATA[Application]]></column><column width='0' align='left' type='ro' sort='connector' color='' id='version'><![CDATA[Version]]></column><column width='0' align='left' type='ro' sort='connector' color='' id='versionIPMScripts'><![CDATA[Version IPM-Scripts]]></column><column width='0' align='left' type='ro' sort='connector' color='' id='versionIPMNavigateur'><![CDATA[Version IPM-Navigateur]]></column><column width='0' align='left' type='ro' sort='connector' color='' id='adressePrivee'><![CDATA[Adresse IP privée]]></column></columns>
<columns><column ><![CDATA[]]></column><column ><![CDATA[Borne supervisee.]]></column><column ><![CDATA[Hors tensionSous tension]]></column><column ><![CDATA[ES]]></column><column ><![CDATA[En serviceHors service incidentHors service gestionInstallation en coursNon déterminéEn cours de productionTests en usine]]></column><column ><![CDATA[]]></column><column ><![CDATA[]]></column><column ><![CDATA[]]></column><column ><![CDATA[]]></column><column ><![CDATA[ad_pole_emploiad_pole_emploiad_cpamad_mission_locad_cafad_urssafad_cidfad_e2cad_mdphad_afpaad_cioad_pe_vichyad_pe_mauriacag_pe_mauriacag_pe_vichyad_rochefortag_rochefortad_aigueperseag_aiguepersead_lasticag_lasticad_eglisollesag_eglisollesad_caf63ag_caf63]]></column><column ><![CDATA[]]></column><column ><![CDATA[]]></column><column ><![CDATA[CAF 63Rochefort MontagneCC Sioulet ChavanonCC Nord LimagneCC de Gentiane]]></column><column ><![CDATA[PVP-U-19]]></column><column ><![CDATA[SCVUtilisateur]]></column><column ><![CDATA[BU-19]]></column><column ><![CDATA[WEB6000PVP-FT-02]]></column><column ><![CDATA[]]></column><column ><![CDATA[]]></column><column ><![CDATA[]]></column><column ><![CDATA[]]></column><column ><![CDATA[]]></column></columns></head>
<row><cell><![CDATA[EGT-u-0111]]></cell><cell><![CDATA[Borne supervisee.]]></cell><cell><![CDATA[Sous tension]]></cell><cell><![CDATA[ES]]></cell><cell><![CDATA[Hors service incident]]></cell><cell><![CDATA[2012-02-08 13:44:18]]></cell><cell><![CDATA[2012-02-08 13:43:12]]></cell><cell><![CDATA[80.13.227.135]]></cell><cell><![CDATA[CRA]]></cell><cell><![CDATA[ad_aigueperse,ag_aigueperse]]></cell><cell><![CDATA[ ]]></cell><cell><![CDATA[CC Nord Limagne]]></cell><cell><![CDATA[CC Nord Limagne]]></cell><cell><![CDATA[PVP-U-19]]></cell><cell><![CDATA[SCVUtilisateur]]></cell><cell><![CDATA[BU-19]]></cell><cell><![CDATA[WEB6000PVP-FT-02]]></cell><cell><![CDATA[Portail PVP]]></cell><cell><![CDATA[3.7.2]]></cell><cell><![CDATA[ ]]></cell><cell><![CDATA[ ]]></cell><cell><![CDATA[10.0.0.1]]></cell></row>
<row><cell><![CDATA[EGT-u-0117]]></cell><cell><![CDATA[Borne supervisee.]]></cell><cell><![CDATA[Sous tension]]></cell><cell><![CDATA[ES]]></cell><cell><![CDATA[Hors service incident]]></cell><cell><![CDATA[2012-02-08 13:47:51]]></cell><cell><![CDATA[2012-02-08 13:47:50]]></cell><cell><![CDATA[80.13.202.99]]></cell><cell><![CDATA[CRA]]></cell><cell><![CDATA[ad_lastic,ag_lastic]]></cell><cell><![CDATA[ ]]></cell><cell><![CDATA[Sioulet Chavanon]]></cell><cell><![CDATA[CC Sioulet Chavanon]]></cell><cell><![CDATA[PVP-U-19]]></cell><cell><![CDATA[SCVUtilisateur]]></cell><cell><![CDATA[BU-19]]></cell><cell><![CDATA[WEB6000PVP-FT-02]]></cell><cell><![CDATA[Portail PVP]]></cell><cell><![CDATA[3.7.3]]></cell><cell><![CDATA[6.3.1]]></cell><cell><![CDATA[1.5.0.20465]]></cell><cell><![CDATA[10.0.0.1]]></cell></row>
<row><cell><![CDATA[EGT-U-0137]]></cell><cell><![CDATA[Borne supervisee.]]></cell><cell><![CDATA[Sous tension]]></cell><cell><![CDATA[ES]]></cell><cell><![CDATA[Hors service incident]]></cell><cell><![CDATA[2012-02-08 13:43:28]]></cell><cell><![CDATA[2012-02-08 13:43:27]]></cell><cell><![CDATA[80.14.66.55]]></cell><cell><![CDATA[CRA]]></cell><cell><![CDATA[ad_rochefort,ag_rochefort]]></cell><cell><![CDATA[ ]]></cell><cell><![CDATA[Rochefort Montagne]]></cell><cell><![CDATA[Rochefort Montagne]]></cell><cell><![CDATA[PVP-U-19]]></cell><cell><![CDATA[SCVUtilisateur]]></cell><cell><![CDATA[BU-19]]></cell><cell><![CDATA[WEB6000PVP-FT-02]]></cell><cell><![CDATA[Portail PVP]]></cell><cell><![CDATA[3.7.3]]></cell><cell><![CDATA[6.3.1]]></cell><cell><![CDATA[1.5.0.20465]]></cell><cell><![CDATA[192.168.1.2]]></cell></row></rows>
radyno
February 10, 2012, 3:10pm
#13
Please, try to update export script from attachment
grid-pdf-php.zip (979 KB)
mohierf
February 10, 2012, 4:10pm
#14
Many thanks. The result is nice !