Export CSV without column headers?

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
missinglina
User
Posts: 25

Export CSV without column headers?

Post by missinglina »

Greetings, All:

I am sure one of you savvy fellows knows the answer to this: What file do I edit and how to export to CSV without column headers?

Thanks!


arbei
User
Posts: 9420

Post by arbei »

You can customize the class ExportCsv or you can write a new class inherited from ExportCsv and then set:

$EXPORT["csv"] = "MyExportCsv"; // MyExportCsv is your new class for export

in server side Global Code.

You may also use server event "Row_Export" to export in your own way.

See the topic Server Events and Client Scripts in the help file for details about Global Code and the server event.


missinglina
User
Posts: 25

Post by missinglina »

Thank you! The problem is I don't know how to edit the class. And I did try to edit the Row_Export server event as follows (also Page_Exporting) but it did not work. The headers are still being exported in CSV. The column headers names can be seen below: They are: RecordCode,VoidedIndicator,AccountNo,CheckNo,CheckAmount,IssueDate,PayeeName

// Row Export event
// $this->ExportDoc = export document object
function Row_Export($rs) {

$this->ExportDoc->Text .= $this->RecordCode->ViewValue . "," . $this->VoidedIndicator->ViewValue . "," . $this->AccountNo->ViewValue . "," . $this->CheckNo->ViewValue . "," . $this->CheckAmount->ViewValue . "," . $this->IssueDate->ViewValue . "," . $this->PayeeName->ViewValue . "\r\n";

}

following a tip for the above, I also modified Page_Exporting like this based on the tip:

function Page_Exporting() {

return FALSE; // Return TRUE to use default export and skip Row_Export event
}


missinglina
User
Posts: 25

Post by missinglina »

Also would be great to have the option to not export the row or rows with the aggregate totals. Useful to see it on the page, but would be nice to choose not to export it. I'm still looking for the solution to turn off exporting headers. Thanks.


Post Reply