使用php将excel转HTML解决办法

WBOY
Release: 2016-06-13 13:30:57
Original
1136 people have browsed it

使用php将excel转HTML
想要实现一个将各种文档(pdf,excel等)转成HTML的功能,可以理解为在线文档预览的需求。
目前pdf转html没有问题,但是excel这类微软的文档还没能做好,想寻找一些可以用的开源软件而不得。(全都自己解析有点吃力)

小弟初学php,还望请有经验的朋友多多指教,万分感激。

------解决方案--------------------
PHP能读取excel中的csv格式,获取数据后,你可以按照你的要求进行html排版:

PHP code

$row = 1;
$handle = fopen("test.csv","r");
while ($data = fgetcsv($handle, 1000, ",")) {
    $num = count($data);
    echo "<p> $num fields in line $row: <br>\n";
    $row++;
    for ($c=0; $c \n";
    }
}
fclose($handle);
<br><font color="#e78608">------解决方案--------------------</font><br>
http://www.iteye.com/topic/333676
<br><font color="#e78608">------解决方案--------------------</font><br>
你怎么搞定的,发出来分享一下
<br><font color="#e78608">------解决方案--------------------</font><br>
PHPExcel以把数据解析出来。转换成html的方法需要自己操作。<br>网址:http://phpexcel.codeplex.com/ </p><div class="clear">
                 
              
              
        
            </div>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template