$vnconv->set_to("ascii"); $xls->send($vnconv->vnconv($addressbook['name']) . ".xls"); $xls->_codepage = 0x4ea; // CP1258 //$vnconv->set_to($_POST['encoding'] == "none" ? '' : $_POST['encoding']); $vnconv->set_to('cp1258'); $sheet =& $xls->addWorksheet('Sheet1'); $line = 0; if ($_POST['export_type'] == 'contacts') { $headings = array($strTitle, $strFirstName, $strMiddleName, $strLastName, $strInitials, $strSex, $strBirthday, $strEmail, $strCountry, $strState, $strCity, $strZip, $strAddress, $strPhone, $strWorkphone, $strFax, $strWorkFax, $strCellular, $strCompany, $strDepartment, $strFunction, $ab_comment, $contacts_group); $col = 0; foreach ($headings as $heading) { $sheet->writeString($line, $col++, $vnconv->VnConv($heading)); } $line++; $ab->get_contacts_for_export($_POST['addressbook_id']); while ($ab->next_record()) { $record = array($ab->f("title"), $ab->f("first_name"), $ab->f("middle_name"), $ab->f("last_name"), $ab->f("initials"), $ab->f("sex"), $ab->f('birthday'), $ab->f("email"), $ab->f("country"), $ab->f("state"), $ab->f("city"), $ab->f("zip"), $ab->f("address"), $ab->f("home_phone"), $ab->f("work_phone"), $ab->f("fax"), $ab->f("work_fax"), $ab->f("cellular"), $ab->f("company"), $ab->f("department"), $ab->f("function"), $ab->f("comment"), $ab->f("group_name")); $col = 0; foreach ($record as $r) { $sheet->writeString($line, $col++, $vnconv->VnConv($r)); } $line++; } $xls->close(); // dump it out exit; } else { $headings = array($strName, $strCountry, $strState, $strCity, $strZip, $strAddress, $strEmail, $strPhone, $strFax, $strHomepage, $ab_bank_no, $ab_vat_no); $headings = $quote . implode($quote . $seperator . $quote, $headings) . $quote; echo $vnconv->VnConv($headings);