public function setCell($col_index, $row_index, $val, $type=null)
    {

            $result = $this->xpath->query("//Row[@Index='".$row_index."']/Cell[@Index='".$col_index."']/Data", $this->active_worksheet);
            $data = $result->item(0);
            $type = $type ? $type : $this->getValueType($val);

            if($data){
                $data->setAttribute('ss:Type', $type);
                $data->firstChild->nodeValue = $val;
            } else {

            $result = $this->xpath->query("//Row[@Index='".$row_index."']");

            $row = $result->item(0);

            if(!$row){
                $row = $this->createElement('Row');
                $this->active_worksheet->table->appendChild($row);
                $row->setAttribute('Index', $row_index);
            }

            $result = $this->xpath->query("//Row[@Index='".$row_index."']/Cell[@Index='".$col_index."']", $row);
            $cell = $result->item(0);
            if(!$cell){
                $cell = $this->createElement('Cell');
                $row->appendChild($cell);
                $cell->setAttribute('Index', $col_index);
                $data = $this->createElement('Data');
                $cell->appendChild($data);
                $data->setAttribute('ss:Type', $type);
                $data->appendChild($this->createTextNode($val));
            } else {
                $data = $cell->getElementsByTagName('Data')->item(0);
                $data->setAttribute('ss:Type', $type);
                $data->firstChild->nodeValue = $val;
            }

            }
        return $data->parentNode;

    }