09/10/2018, 23:33
Xử lý import tệp tin .doc bằng PHP???
Hiện tại mình đang cần biết phương pháp để xử lý vấn đề chuyển dữ liệu từ word sang Mysql. Dùng Php để đọc file Excel thì mình biết rồi (Có bộ code free), nhưng dùng Php để xử lý file word thì mình chưa có phương hướng gì. Xin mọi người góp ý!
Chân thành cảm ơn!
Chân thành cảm ơn!
Bài liên quan





function catdoc_string($str) { // requires catdoc // write to temp file $tmpfname = tempnam ('/tmp','doc'); $handle = fopen($tmpfname,'w'); fwrite($handle,$a); fclose($handle); // run catdoc $ret = shell_exec('catdoc -ab '.escapeshellarg($tmpfname) .' 2>&1'); // remove temp file unlink($tmpfname); if (preg_match('/^sh: line 1: catdoc/i',$ret)) { return false; } return trim($ret); } function catdoc_file($fname) { // requires catdoc // run catdoc $ret = shell_exec('catdoc -ab '.escapeshellarg($fname) .' 2>&1'); if (preg_match('/^sh: line 1: catdoc/i',$ret)) { return false; } return trim($ret); }<?php // starting word $word = new COM("word.application") or die("Unable to instanciate Word"); print "Loaded Word, version {$word->Version}\n"; //bring it to front $word->Visible = 1; //open an empty document $word->Documents->Add(); //do some weird stuff $word->Selection->TypeText("This is a test..."); $word->Documents[1]->SaveAs("test.doc"); //closing word $word->Quit(); //free the object $word->Release(); $word = null; ?>Chân thành cảm ơn!