Skip to content

Instantly share code, notes, and snippets.

@khepin
Created March 30, 2011 19:11
Show Gist options
  • Save khepin/895067 to your computer and use it in GitHub Desktop.
Save khepin/895067 to your computer and use it in GitHub Desktop.
<?php
class MyExcel {
public static function setContent(sfEvent $event, $response) {
if (in_array(self::$format, self::$acceptedFormats)) {
//add content file
$doc = new ZipArchive();
$doc->open(sfConfig::get('sf_data_dir') . '/documents/report/my_report.ods');
$doc->addFromString('content.xml', $response);
$doc->close();
}
if(self::$format == 'ods'){
$response = file_get_contents(sfConfig::get('sf_data_dir') . '/documents/report/my_report.ods');
}
/* ... deal with other formats ... */
return $response;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment