excel - toad

Topics: Developer Forum, User Forum
Aug 1, 2011 at 11:21 PM

Hi, i have a php script that connect to active directory and retrive some fields and then generate an excel file(Excel5), then i connect by ODBC with TOAD to query the data from the excel file, but it not show me the first column and add a column, if i open and save the excel file, toad show me the data without problem, i think that the problem is the excel format that it generate

i use this code to retrive and generate the excel file, my script run in linux box


    if ($ldapbind) {
        //echo "LDAP bind successful...";
        $filter = "(cn=*)";
        $fields = array("uid","cn","whencreated","accountexpires","memberof");
        $sr = ldap_search($ldapconn, $dn, $filter, $fields);
        $info = ldap_get_entries($ldapconn, $sr);
        $objPHPExcel->getActiveSheet()->SetCellValue('A1', 'NUM_DNI');
        $objPHPExcel->getActiveSheet()->SetCellValue('B1', 'DES_PROVEEDOR');
        $objPHPExcel->getActiveSheet()->SetCellValue('C1', 'FEC_INI_CON');
        $objPHPExcel->getActiveSheet()->SetCellValue('D1', 'FEC_FIN_CON');
        for ($i=0; $i<$info["count"]; $i++)
                for ($j=0; $j < count($info[$i]["memberof"]); $j++){
                        if ($info[$i]["memberof"][$j] == "cn=xx,dc=ssksk,dc=com")
                                //echo $info[$i]["uid"][0]."\t".$info[$i]["cn"][0]."\t".format_whencreated($info[$i]["whencreated"][0])."\t".convert_format_date($info[$i]["accountexpires"][0])."\n";
                        {               $objPHPExcel->getActiveSheet()->SetCellValue('A'.$k,$info[$i]["uid"][0]);
        // 2003
        $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
        $objWriter->save(str_replace('.php', '.xls','/opt/share/UsuariosAD.xls'));

Aug 2, 2011 at 10:36 PM

Hi, I think that i have the problem with the format, I generate the excel with Excel5 format, and when i open the file, this open in compatibility mode, is there a way to generate with 2003 format?, because i only see "Excel5" and "Excel 2007"