本文整理汇总了PHP中Excel::setFilename方法的典型用法代码示例。如果您正苦于以下问题:PHP Excel::setFilename方法的具体用法?PHP Excel::setFilename怎么用?PHP Excel::setFilename使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Excel
的用法示例。
在下文中一共展示了Excel::setFilename方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ar_to_xls
<?php
//xls
if ($_GET['action'] == 'xlssasas') {
global $wpdb;
$q = "\r\n\t\tselect users.*, meta2.meta_value hp, meta3.meta_value NIY from {$wpdb->users} users\r\n\t\tleft join {$wpdb->usermeta} meta\r\n\t\ton meta.user_id = users.ID and meta.meta_key = 'pegawai'\r\n\t\tleft join {$wpdb->usermeta} meta2\r\n\t\ton meta2.user_id = users.ID and meta2.meta_key = '_hp'\r\n\t\tleft join {$wpdb->usermeta} meta3\r\n\t\ton meta3.user_id = users.ID and meta3.meta_key = 'niy'\r\n\t\twhere meta.meta_value is not null\r\n\t\torder by users.display_name ASC\r\n\t\t\r\n\t";
$x = new Excel($wpdb->get_results($q));
$x->setCols(array('NIY' => 'NIY', 'display_name' => 'Nama Lengkap', 'hp' => 'hp', 'user_email' => 'Email'));
$x->setFilename('Daftar Pegawai STIBA Makassar');
$x->display();
}
function ar_to_xls($ar)
{
include get_template_directory() . '/classes/PHPExcel.php';
/** PHPExcel_Writer_Excel2007 */
include get_template_directory() . '/classes/PHPExcel/Writer/Excel2007.php';
// Create new PHPExcel object
$objPHPExcel = new PHPExcel();
// Set properties
$objPHPExcel->getProperties()->setCreator("Maarten Balliauw");
$objPHPExcel->getProperties()->setLastModifiedBy("Maarten Balliauw");
$objPHPExcel->getProperties()->setTitle("Office 2007 XLSX Test Document");
$objPHPExcel->getProperties()->setSubject("Office 2007 XLSX Test Document");
$objPHPExcel->getProperties()->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.");
// determine table header from first row
$c = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P');
$c = range('A', 'Z');
foreach ($c as $columnID) {
$objPHPExcel->getActiveSheet()->getColumnDimension($columnID)->setAutoSize(true);
}
$col = array('NIY' => 'NIY', 'display_name' => 'Nama Lengkap', 'hp' => 'hp', 'user_email' => 'Email');
示例2: get_excel
public function get_excel()
{
$x = new Excel($this->table_obj);
$x->setFilename($this->pagetitle);
$x->display();
exit;
}