csv generation options

Post Reply
danielebrambilla
User
Posts: 9

csv generation options

Post by danielebrambilla »

1) the possibility of removing the header
2) the possibility of changing the character of separation between fields


Webmaster
User
Posts: 9427

Post by Webmaster »

Use Page_Importing server event, see Server Events and Client Scripts in help file.


danielebrambilla
User
Posts: 9

Post by danielebrambilla »

Thank you
I used Page Exporting event for 1 and Row Export event for 2
Examples:
1)
// Page Exporting event
// $this->ExportDoc = export document object
function Page_Exporting() {
//$this->ExportDoc->Text = "my header";
// Export header
//return FALSE; // Return FALSE to skip default export and use Row_Export event
return FALSE; // Return TRUE to use default export and skip Row_Export event
}

2)
// Row Export event
// $this->ExportDoc = export document object
function Row_Export($rs) {
$this->ExportDoc->Text .= $this->id1->ViewValue . "," . $this->parola->ViewValue . "," . $this->traduzione->ViewValue . "\r\n"; // Build HTML with field value: $rs["MyField"] or $this->MyField->ViewValue

}

now the csv is exported in this way:
1,disk ,disco
2,happy,felice
3,true,vero
4,false,falso
5,big,grande
6,small,piccolo
7,mouse,topo
8,dog,cane
9,cat,gatto
10,phone,telefono
11,new,nuovo


Post Reply