从Excel中检索数据并显示在页面页面、数据、Excel

2023-09-11 22:35:29 作者:我要的 你给不起

大家好我有,我想拉一些信息并将其发布一个excel表... 它看起来像

到目前为止,我已经做了将它们放入选项卡公司的名称,如下拉菜单。

我想做的选择的信息,如一个在画面:

但我不能让它的动态,使它看起来....你可以给一个关于如何使它的动态线索吗?(不是问阿贾克斯......我要求,以从阵列中选择,并显示可显示它一) 这里是code

 < PHP
    set_include_path(破灭(PATH_SEPARATOR,[
        真实路径(__ DIR__。/类'),//假设类是在同一目录作为这个脚本
        get_include_path()
    ]));
    require_once目录名(__ FILE__)。 /Classes/PHPExcel/IOFactory.php;
    require_once'PHPExcel.php;
    $文件=./uploads/".$_GET["filename];
    $查找inputfilename =($文件);
    //读取Excel工作簿
    尝试 {
        $ inputFileType = PHPExcel_IOFactory ::识别($查找inputfilename);
        $ objReader = PHPExcel_IOFactory :: createReader($ inputFileType);
        $ objPHPExcel = $ objReader->负载($查找inputfilename);
    }
    赶上(异常$ E){
        死亡(错误加载文件'.pathinfo($查找inputfilename,PATHINFO_BASENAME)。':'。$ E->的getMessage());
    }
    //获取工作表的尺寸
    $片= $ objPHPExcel-> getSheet(0);
    $ highestRow = $片状> getHighestRow();
    $ highestColumn = $片状> getHighestColumn();

    / *
    $总额=阵列();
    //循环轮流工作表的每一行

    为($行= 1; $行< = $ highestRow; $行++){

    //读取一行数据到一个数组
        $ rowData = $片状> rangeToArray('A'$行':'。$ highestColumn $行,NULL,TRUE,FALSE);
    //回声-----------------为rowData ---------------;


    //后续代码var_dump($ rowData); //插入行数据阵列到您选择的数据库在这里
    //回声-----------------的var_dump总---------------!;


        array_push($总,$ rowData);
    //后续代码var_dump($总);
        $ myFlatArray = PHPExcel_Calculation_Functions :: flattenArray($总);
        回声< BR>中;
        回声-----------------共为JSON EN code ---------------;
        后续代码var_dump(json_en code($ myFlatArray));
    }
    * /
    $ foundInCells =阵列();
    $ searchValue =公司;

    $ wscounter = 0; //工作表计数器
    的foreach($ objPHPExcel-> getWorksheetIterator()为$工作表){
        回声< HR>< P>工作表数。 $ wscounter。  名称:  。 $ worksheet->的getTitle()。 &所述; / P>中;
        /// START Sirket isimlerini listele




        $列='B';
        $ LASTROW = $ worksheet-> getHighestRow();
        回声'< P>公司名称:<选择ID =my_select>';
        为($行= 1; $行< = $ LASTROW; $行++){

            如果($ worksheet-> cellExists($列$行))
                {
                回声<期权价值='$列$行。>中。 $ worksheet-> getCell  - &GT($列$行);的getValue()。 < /选项>中;

            }
        }

        回声< /选择>< / P>中;
        /// END Sirket isimlerini listele

        $ rowCompanyInfoStart = 4;
        $ rowCompanyInfoEnd = 9;
        $ colCompanyInfoStart ='C';
        $ colCompanyInfoEnd =L;
        回声<表格边框='1'>中;

//回声打印行;
//回声$ _ POST [getCell($列$行。)]。


        为($行数= $ rowCompanyInfoStart; $行数< = $ rowCompanyInfoEnd; $行数++){

            // $数据= $ objWorksheet-> rangeToArray(A1:'。$ maxCell ['列'] $ maxCell ['行']);
            $ rangeCoordinates = $ colCompanyInfoStart。 $行数。 :。 $ colCompanyInfoEnd。 $行数;
            $ rowData = $片状> rangeToArray($ rangeCoordinates,NULL,TRUE,FALSE);

            // fazla bosluk olursabunlarıAC雅大hucre BOS亩KONTROL等(cellExists ILE)
            // rowData = array_map('array_filter',$ rowData);
            // $ rowData = array_filter($ rowData);
            回声< TR>中;
            的foreach($ rowData [0]为$结果){
                回声< TD>中$的结果。< / TD>中;
            }
            回声< / TR>中;
        }
        回声< /表>;


    / * GB01开始

        //尝试 {
        ///ÿ0değil1书房basliyor dikkat
            $ rowcounter = 1;
            的foreach($ worksheet-> getRowIterator()为$行){
                回声工作表。 $ wscounter。  行  。 $ rowcounter。 < BR />中;
                $ cellIterator = $行向> getCellIterator();
                $ cellIterator-> setIterateOnlyExistingCells(真正的);

                $ cellcounter = 0;
                $隐私权|发布= 0;
                的foreach($ cellIterator为$细胞){
                    回声工作表。 $ wscounter。  行  。 $ rowcounter。  细胞  。 $ cellcounter。 < BR />中;
                    如果($小区>的getValue()== $ searchValue){
                        $隐私权|发布++;
                        回声隐私权|发布。 $隐私权|发布。 < BR />中;
                        $ foundInCells [] = $ worksheet->的getTitle()。 ! 。 $小区> getCoordinate();
                    }
                    $ cellcounter ++;
                }
                $ rowcounter ++;
            }
        / *
        }
        //赶上(例外$ EXC){
        //回声<股利风格='填充:5像素;背景颜色:#fc8888'>捕获到异常的工作表。 $ wscounter。  行  。 $ rowcounter。 < BR />中。 $ EXC->的getMessage()。 < / DIV>中;
        //}
        $ wscounter ++;
        // GB01 END * /
    }
    回声-----在细胞中发现---------------------------------------- ------------------------;
    后续代码var_dump($ foundInCells);

?>

<!DOCTYPE HTML>
< HTML LANG =EN>
    < HEAD>
      <元字符集=utf-8>
      <冠军> jQuery用户界面自动完成 - 默认功能和LT; /标题>
      <链接相对=样式表的href =// code.jquery.com / UI / 1.11.4 /主题/平滑/ jQuery的-ui.css>
      <脚本的src =// code.jquery.com / jQuery的-1.10.2.js>< / SCRIPT>
      <脚本的src =// code.jquery.com / UI / 1.11.4 / jQuery的-ui.js>< / SCRIPT>
      <脚本>
     / * $(函数(){
        VAR availableTags = $ .parseJSON('<?PHP的回声json_en code($ myFlatArray);?>');
        $(#tags).autocomplete({
        来源:availableTags
        });
      }); * /

    功能待办事项()
    {

    VAR XMLHTTP;
如果(window.XMLHtt prequest)

{// $ C $下IE7 +,火狐,Chrome,歌剧,Safari浏览器
  XMLHTTP =新XMLHtt prequest();
  }
其他
  {// code对IE6,IE5
  XMLHTTP =新的ActiveXObject(Microsoft.XMLHTTP);
  }
xmlhttp.onreadystatechange =功能()
  {

  如果(xmlhttp.readyState == 4和&安培; xmlhttp.status == 200)
    {
    的document.getElementById(my_select)的innerHTML = xmlhttp.responseText。
    }
  }

    }



    < / SCRIPT>
    < /头>
    <身体GT;
        < BR>< BR>< BR>
        < D​​IV CLASS =UI小部件>
            <标签=标签>标签:LT; /标签>
            <输入ID =标签>
            < BR>< BR>< BR>< BR>
        < / DIV>
    < /身体GT;
< / HTML>
 

解决方案

下面是我的完整的解决方案!如果您有任何疑问,请该解决方案但它的工作原理pretty的良好的下发表评论!

 <!DOCTYPE HTML>
< HTML LANG =EN>
    < HEAD>
        <元字符集=utf-8>
        <冠军>选择一个公司< /标题>
        <链接相对=样式表的href =// code.jquery.com / UI / 1.11.4 /主题/平滑/ jQuery的-ui.css>
        <脚本的src =// code.jquery.com / jQuery的-1.10.2.js>< / SCRIPT>
        <脚本的src =// code.jquery.com / UI / 1.11.4 / jQuery的-ui.js>< / SCRIPT>
        <脚本>
        < / SCRIPT>
    < /头>
    <风格>
        div.back {
        边界:2px的固体灰色;
        保证金:汽车;
        位置:相对;}
        .button {
        保证金底:200像素;
        }
    < /风格>
    <脚本>
    < / SCRIPT>
    <身体GT;
        < D​​IV ID =头>
            < H1>< U>选择一个公司< / U>< / H1>
        < / DIV>
        < D​​IV CLASS =后面的>
            < P>作为要到previous Excel列表,请preSS为后退按钮< / P>
            < A HREF =HTTP://本地主机:81 / phpex / list.php的>
                <输入类型=按钮级=按钮值=后退/>
            &所述; / a取代;
        < / DIV>
        < D​​IV ID =行动>
            &其中p为H.;或< / P>
            < P>请从公司名称选项中选择一个名字,那么preSS为获取选定值< / P>
        < / DIV>
    < /身体GT;
< / HTML>
< PHP
    require_once目录名(__ FILE__)'/ TCPDF / tcpdf.php。
    set_include_path(破灭(PATH_SEPARATOR,[
    真实路径(__ DIR__。/类'),//假设类是在同一目录作为这个脚本
    get_include_path()
    ]));
    require_once目录名(__ FILE__)。 /Classes/PHPExcel/IOFactory.php;
    require_once'PHPExcel.php;
    $文件=./uploads/".$_GET["filename];
    $查找inputfilename =($文件);
    //读取Excel工作簿
    尝试 {
        $ inputFileType = PHPExcel_IOFactory ::识别($查找inputfilename);
        $ objReader = PHPExcel_IOFactory :: createReader($ inputFileType);
        $ objPHPExcel = $ objReader->负载($查找inputfilename);
    }
    赶上(异常$ E){
        死亡(错误加载文件'.pathinfo($查找inputfilename,PATHINFO_BASENAME)。':'。$ E->的getMessage());
    }
    //获取工作表的尺寸
    $片= $ objPHPExcel-> getSheet(0);
    $ highestRow = $片状> getHighestRow();
    $ highestColumn = $片状> getHighestColumn();
    在session_start();
// $ _SESSION [颜色] =绿色;
    $ wscounter = 0; //工作表计数器
    的foreach($ objPHPExcel-> getWorksheetIterator()为$工作表){
        //回声< HR>< P>工作表数。 $ wscounter。  名称:  。 $ worksheet->的getTitle()。 &所述; / P>中;
        /// START Sirket isimlerini listele
        $计数= 0;
        $列='C';
        $ LASTROW = $ worksheet-> getHighestRow();
        回声'<形式的行动=#的方法=邮报>';
        回声'< P>公司名称:<选择名称=my_select>';
        为($行= 1; $行< = $ LASTROW; $行++)
        {
            如果($ worksheet-> cellExists($列$行))
            {
                回声<期权价值='。$列。'。'$行。>中。 $ worksheet-> getCell  - &GT($列$行);的getValue()。 < /选项>中;
            }
        }
        回声< /选择>< / P>中;
        回声< BR />中;
        回声'<输入类型=提交名称=提交值=获取选定值/>';
        回声< /形式GT;;
        回声< BR />中;
        $排版=阵列(100);
        $ tempcount = 0;
        为($行= 1; $行< = $ LASTROW; $行++)
        {
            如果($ worksheet-> cellExists($列$行))
            {
                $计数++;
                $ NAME = $ worksheet-> getCell  - &GT($列$行);的getValue();
                $样稿[$ tempcount] =阵列($名称,$列,$行);
                //后续代码var_dump($样稿[$ tempcount]);
                //回声< P>< B>排名$行< / B>< / P>中;
                为($ COL = 0; $栏3;; $山口++)
                {
                    //回声<李>$可比[$ CNT] [$ COL]。< /李>中;
                }
                $ tempcount ++;
                //回声sadece tempcount;
                //后续代码var_dump($ tempcount);
            }
        }
        //回声tempcount补偿布尔达;
        //后续代码var_dump($补偿[31]);
        //回声$计数;
        如果(使用isset($ _ POST [提交]))
        {
            $ selected_val = $ _ POST ['my_select']; //保存选定的价值在变
            $ only_row =爆炸(,$ selected_val'。');
            //回声您已选择:$ selected_val。 < BR />中; //显示所选择的价值
            //后续代码var_dump($ only_row);
            //回声选择行值:$ only_row [1]。 < BR />中;
            为($ i = 0; $ I< $计数; $ I ++)
            {
                如果($排版[$ i]于[2] == $ only_row [1])
                {
                    $ info_end =($排版[$ i + 1的] [2] -1);
                }
            }
        }
        其他{把error_reporting(E_ALL ^​​ E_NOTICE);}
        $ rowCompanyInfoStart = $ only_row [1] 2;
        $ rowCompanyInfoEnd = $ info_end;
        $ colCompanyInfoStart ='D';
        $ colCompanyInfoEnd ='N';



        如果($ _ SERVER ['REQUEST_METHOD'] =='POST'){
            回声'<形式的行动=final.php方法=POST>';
            $ tablo =< BR />中;
            $ tablo = $ tablo。<表格边框= \1 \的cellpadding = \2 \CELLSPACING = \2 \ALI​​GN =中心>中;
            为($行数= $ rowCompanyInfoStart; $行数< = $ rowCompanyInfoEnd; $行数++)
            {
                // $数据= $ objWorksheet-> rangeToArray(A1:'。$ maxCell ['列'] $ maxCell ['行']);
                $ rangeCoordinates = $ colCompanyInfoStart。 $行数。 :。 $ colCompanyInfoEnd。 $行数;
                $ rowData = $片状> rangeToArray($ rangeCoordinates,NULL,TRUE,FALSE);
                // fazla bosluk olursabunlarıAC雅大hucre BOS亩KONTROL等(cellExists ILE)
                // rowData = array_map('array_filter',$ rowData);
                // $ rowData = array_filter($ rowData);
                $ tablo = $ tablo&其中; TR>中。
                $公司名称= $ worksheet-> getCell  - &GT($列$行);的getValue();
                //回声$公司名称;
                的foreach($ rowData [0]为$结果)
                {
                    $ tablo = $ tablo。 < TD>中$的结果。 &所述; / TD>中;
                }
                $ tablo = $ tablo。 &所述; / TR>中;
            }
            $ tablo = $ tablo。 < /表>;
            回声$ tablo;
            回声< BR />中;

            如果($ _ SERVER ['REQUEST_METHOD']!='POST'){
                回声会议没有利用第一次运行。
            }


            其他{
                $ _SESSION ['varname的'] = $ tablo;
                }

            回声'<输入类型=提交名称=resName值=转换成PDF/>';

        }
        回声'< /形式GT;';
        回声< BR />中;
        回声< BR />中;
    }
?>
 
在EXCEL中一列数据如何根据一列数据为条件进行匹配检索,并在第三列中输出检索结果

Hi guys I have a excel sheet that I want to pull some info and publish it... it looks like

so far I have done putting them into option tab the company names like drop down menu.

I want to do the selected ones information like the one in the picture:

But I couldnt make it dynamic to make it appear.... can you give a clue about how to make it dynamic?( not asking about ajax... I am asking to show it from choosing from array and showing available one) here is code

<?php
    set_include_path(implode(PATH_SEPARATOR, [
        realpath(__DIR__ . '/Classes'), // assuming Classes is in the same directory as this script
        get_include_path()
    ]));
    require_once dirname(__FILE__) . '/Classes/PHPExcel/IOFactory.php';
    require_once 'PHPExcel.php';
    $file= "./uploads/".$_GET["filename"];
    $inputFileName = ($file);
    //  Read your Excel workbook
    try {
        $inputFileType = PHPExcel_IOFactory::identify($inputFileName);
        $objReader = PHPExcel_IOFactory::createReader($inputFileType);
        $objPHPExcel = $objReader->load($inputFileName);
    } 
    catch(Exception $e) {
        die('Error loading file "'.pathinfo($inputFileName,PATHINFO_BASENAME).'": '.$e->getMessage());
    }
    //  Get worksheet dimensions
    $sheet = $objPHPExcel->getSheet(0); 
    $highestRow = $sheet->getHighestRow(); 
    $highestColumn = $sheet->getHighestColumn();

    /*
    $total=array();
    //  Loop through each row of the worksheet in turn

    for ($row = 1; $row <= $highestRow; $row++) { 

    //  Read a row of data into an array
        $rowData = $sheet->rangeToArray('A' . $row . ':' . $highestColumn . $row, NULL, TRUE, FALSE);
    //  echo "-----------------as rowData---------------";


    //  var_dump($rowData); //  Insert row data array into your database of choice here
    //    echo "-----------------VAR_DUMP total!---------------";


        array_push($total, $rowData);
    //  var_dump($total);
        $myFlatArray = PHPExcel_Calculation_Functions::flattenArray($total);    
        echo    "<br>";
        echo "----------------- total as json encode---------------";
        var_dump(json_encode($myFlatArray));
    }
    */
    $foundInCells = array();
    $searchValue = 'Company';

    $wscounter=0; //worksheet counter
    foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) {
        echo "<hr><p> Worksheet count: " . $wscounter . " name: " . $worksheet->getTitle() . "</p>";
        ///START Sirket isimlerini listele




        $column = 'B';
        $lastRow = $worksheet->getHighestRow();
        echo '<p> Company name: <select id="my_select">';
        for ($row = 1; $row <= $lastRow; $row++) {

            if($worksheet->cellExists($column.$row))
                {
                echo "<option value='".$column.$row."'>". $worksheet->getCell($column.$row)->getValue() . "</option>";

            }
        }

        echo "</select> </p>";
        ///END Sirket isimlerini listele 

        $rowCompanyInfoStart = 4;
        $rowCompanyInfoEnd = 9;
        $colCompanyInfoStart = 'C';
        $colCompanyInfoEnd = 'L';
        echo "<table border='1'>";

//      echo " print row ";
//  echo $_POST["getCell($column.$row)"];


        for ($rowcount = $rowCompanyInfoStart; $rowcount <= $rowCompanyInfoEnd; $rowcount++) { 

            //$data = $objWorksheet->rangeToArray('A1:' . $maxCell['column'] . $maxCell['row']);
            $rangeCoordinates = $colCompanyInfoStart . $rowcount . ':' . $colCompanyInfoEnd . $rowcount;
            $rowData = $sheet->rangeToArray($rangeCoordinates, NULL, TRUE, FALSE);

            //fazla bosluk olursa bunları aç ya da hucre bos mu kontrol et (cellExists ile) 
            //rowData = array_map('array_filter', $rowData);
            //$rowData = array_filter($rowData);
            echo "<tr>";
            foreach($rowData[0] as $result) {
                echo "<td>".$result." </td>";
            }
            echo "</tr>";
        }
        echo "</table>";


    /* GB01 START

        //try {
        /// Y 0 değil 1 den basliyor dikkat
            $rowcounter=1;       
            foreach ($worksheet->getRowIterator() as $row) {
                echo "Worksheet " . $wscounter . " Row " . $rowcounter . "<br/>";
                $cellIterator = $row->getCellIterator();
                $cellIterator->setIterateOnlyExistingCells(true);

                $cellcounter=0; 
                $hitcounter=0;
                foreach ($cellIterator as $cell) {
                    echo "Worksheet " . $wscounter . " Row " . $rowcounter . " Cell " . $cellcounter . "<br/>";
                    if ($cell->getValue() == $searchValue) {
                        $hitcounter++;
                        echo "hitcounter" . $hitcounter . "<br/>";
                        $foundInCells[] = $worksheet->getTitle() . '!' . $cell->getCoordinate();
                    }
                    $cellcounter++;
                }
                $rowcounter++;
            }
        /*
        }
        // catch (Exception $exc) {
        //   echo "<div style='padding:5px; background-color:#fc8888'> Exception caught on Worksheet " . $wscounter . " Row " . $rowcounter . "<br/>" . $exc->getMessage() . "</div>";
        // }
        $wscounter++;
        //GB01 END */   
    }
    echo "-----found in cells----------------------------------------------------------------";
    var_dump($foundInCells);

?>

<!doctype html>
<html lang="en">
    <head>
      <meta charset="utf-8">
      <title>jQuery UI Autocomplete - Default functionality</title>
      <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
      <script src="//code.jquery.com/jquery-1.10.2.js"></script>
      <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
      <script>
     /* $(function() {
        var availableTags = $.parseJSON('<?php echo json_encode($myFlatArray); ?>');
        $( "#tags" ).autocomplete({
        source: availableTags
        });
      });  */

    function todo()
    {

    var xmlhttp;
if (window.XMLHttpRequest)

{// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {

  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("my_select").innerHTML=xmlhttp.responseText;
    }
  }

    }



    </script>
    </head>
    <body>
        <br><br><br>
        <div class="ui-widget">
            <label for="tags">Tags: </label>
            <input id="tags">
            <br><br><br><br>
        </div>
    </body>
</html>

解决方案

Here is my full solution! if you have any question please comment under this solution however it works pretty good!

<!doctype html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <title>Choose a Company</title>
        <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
        <script src="//code.jquery.com/jquery-1.10.2.js"></script>
        <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
        <script>
        </script>           
    </head>
    <style>
        div.back {
        border:2px solid grey;
        margin:auto;
        position:relative;}
        .button {
        margin-bottom:200 px;
        }
    </style>
    <script>
    </script>
    <body>
        <div id="header">
            <h1><u> Choose a Company </u></h1>
        </div>
        <div class="back">
            <p>For going to the previous excel list, please press to "Back" button </p>
            <a href="http://localhost:81/phpex/list.php">
                <input type="button" class="button"  value=" Back " />
            </a>
        </div>
        <div id="action">
            <p>OR</p>
            <p>Please from "Company name" options choose a name then Press to "Get Selected Values" </p>
        </div>
    </body>
</html>
<?php
    require_once dirname(__FILE__) .'/tcpdf/tcpdf.php';
    set_include_path(implode(PATH_SEPARATOR, [
    realpath(__DIR__ . '/Classes'), // assuming Classes is in the same directory as this script
    get_include_path()
    ]));
    require_once dirname(__FILE__) . '/Classes/PHPExcel/IOFactory.php';
    require_once 'PHPExcel.php';
    $file= "./uploads/".$_GET["filename"];
    $inputFileName = ($file);
    //  Read your Excel workbook
    try {
        $inputFileType = PHPExcel_IOFactory::identify($inputFileName);
        $objReader = PHPExcel_IOFactory::createReader($inputFileType);
        $objPHPExcel = $objReader->load($inputFileName);
    } 
    catch(Exception $e) {
        die('Error loading file "'.pathinfo($inputFileName,PATHINFO_BASENAME).'": '.$e->getMessage());
    }
    //  Get worksheet dimensions
    $sheet = $objPHPExcel->getSheet(0); 
    $highestRow = $sheet->getHighestRow(); 
    $highestColumn = $sheet->getHighestColumn();
    session_start();
//  $_SESSION["color"] = "green";
    $wscounter=0; //worksheet counter
    foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) {
        //  echo "<hr><p> Worksheet count: " . $wscounter . " name: " . $worksheet->getTitle() . "</p>";
        ///START Sirket isimlerini listele
        $count=0;
        $column = 'C';
        $lastRow = $worksheet->getHighestRow();
        echo '<form action="#" method="post">';
        echo '<p> Company name: <select name="my_select">';
        for ($row = 1; $row <= $lastRow; $row++)
        {       
            if($worksheet->cellExists($column.$row))
            {
                echo "<option value='".$column.'.'.$row."'>". $worksheet->getCell($column.$row)->getValue() . "</option>";
            }
        }   
        echo "</select> </p>";
        echo "<br />";
        echo    '<input type="submit" name="submit" value="Get Selected Values" />';
        echo "</form>";
        echo "<br />";
        $comp = array(100);
        $tempcount=0;
        for ($row = 1; $row <= $lastRow; $row++)
        {   
            if($worksheet->cellExists($column.$row))
            {
                $count++;
                $name=  $worksheet->getCell($column.$row)->getValue();
                $comp[$tempcount] = array($name,$column,$row);
                //var_dump($comp[$tempcount]);
                //  echo "<p><b>rank number $row </b></p>";
                for ($col = 0; $col < 3; $col++)
                {
                    //  echo "<li>".$comp[$cnt][$col]."</li>";
                }
                $tempcount++;
                //  echo"sadece tempcount";
                //  var_dump($tempcount);
            }
        }
        //  echo "tempcount comp burda";
        //  var_dump ($comp[31]);
        //  echo $count;
        if(isset($_POST['submit']))
        {
            $selected_val = $_POST['my_select'];  // Storing Selected Value In Variable
            $only_row = explode('.',$selected_val);
            //echo "You have selected :" .$selected_val. "<br />";  // Displaying Selected Value
            //var_dump($only_row);
            //echo "selected row value :".$only_row[1]. "<br />";
            for($i=0; $i< $count; $i++)
            {
                if ($comp[$i][2]== $only_row[1])
                { 
                    $info_end=($comp[$i+1][2]-1);
                }
            }
        }   
        else{error_reporting(E_ALL ^ E_NOTICE);}    
        $rowCompanyInfoStart = $only_row[1]+2;
        $rowCompanyInfoEnd = $info_end;
        $colCompanyInfoStart = 'D';
        $colCompanyInfoEnd = 'N';



        if($_SERVER['REQUEST_METHOD'] == 'POST') {
            echo '<form action="final.php" method="POST">';
            $tablo="<br />";
            $tablo = $tablo."<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\" align='center'>";
            for ($rowcount = $rowCompanyInfoStart; $rowcount <= $rowCompanyInfoEnd; $rowcount++)
            { 
                //$data = $objWorksheet->rangeToArray('A1:' . $maxCell['column'] . $maxCell['row']);
                $rangeCoordinates = $colCompanyInfoStart . $rowcount . ':' . $colCompanyInfoEnd . $rowcount;
                $rowData = $sheet->rangeToArray($rangeCoordinates, NULL, TRUE, FALSE);
                //fazla bosluk olursa bunları aç ya da hucre bos mu kontrol et (cellExists ile) 
                //rowData = array_map('array_filter', $rowData);
                //$rowData = array_filter($rowData);    
                $tablo= $tablo."<tr >";
                $companyname=$worksheet->getCell($column.$row)->getValue();
                //  echo $companyname;              
                foreach($rowData[0] as $result) 
                {
                    $tablo= $tablo. "<td>".$result. " </td>";
                }
                $tablo= $tablo. "</tr>";
            }
            $tablo= $tablo. "</table>";
            echo $tablo;
            echo "<br />";

            if($_SERVER['REQUEST_METHOD'] != 'POST') {
                echo "SESSION Not AVAIL. first run.";
            }


            else{   
                $_SESSION['varname'] = $tablo;
                }

            echo    '<input type="submit" name="resName" value="Convert into PDF" />';

        }
        echo '</form>';
        echo "<br />";
        echo "<br />";
    }
?>

 
精彩推荐