codeigniter将excel文件转换为pdf [英] codeigniter convert excel file to pdf

查看:169
本文介绍了codeigniter将excel文件转换为pdf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想问一下如何将excel转换成pdf?



我想放5个excel文件,点击上传后转换为1个pdf? p>

现在我在这段代码中使用:

  / ** 
*示例:DOMPDF
*
*文档:
* http://code.google.com/p/dompdf/wiki/Usage
*
* /
public function index(){
//以正常方式加载所有视图
$ this-> load-> view('test');
//获取输出html
$ html = $ this-> output-> get_output();

//加载库
$ this-> load-> library('dompdf_gen');

//转换为PDF
$ this-> dompdf-> load_html($ html);
$ this-> dompdf-> render();
$ this-> dompdf-> stream(welcome.pdf);

}

图书馆:



class Dompdf_gen {

  public function __construct(){

require_once APPPATH。 'THIRD_PARTY / DOMPDF / dompdf_config.inc.php';

$ pdf = new DOMPDF();

$ CI =& get_instance();
$ CI-> dompdf = $ pdf;

}

}

解决方案

第一件事情,你必须将所有excel转储到php数组或var,之后可以根据需要创建pdf,这是将excel转换为pdf的简单php脚本,你可以使用它并将其转换为代码标识符的子类



请检查此URL



PHP读取excel文件



当您使用该类时,您的excel数据将与您一起使用,因此您可以使用另一个类别的PDF,此类将帮助您



codeigniter创建PDF文件



希望这对你有帮助。


I want to ask how can I convert excel to pdf?

I want to put 5 excel files and after I click upload in convert to 1 pdf?

for now I use in this code:

    /**
 * Example: DOMPDF 
 *
 * Documentation: 
 * http://code.google.com/p/dompdf/wiki/Usage
 *
 */
public function index() {   
    // Load all views as normal
    $this->load->view('test');
    // Get output html
    $html = $this->output->get_output();

    // Load library
    $this->load->library('dompdf_gen');

    // Convert to PDF
    $this->dompdf->load_html($html);
    $this->dompdf->render();
    $this->dompdf->stream("welcome.pdf");

}

the library:

class Dompdf_gen {

public function __construct() {

    require_once APPPATH.'third_party/dompdf/dompdf_config.inc.php';

    $pdf = new DOMPDF();

    $CI =& get_instance();
    $CI->dompdf = $pdf;

}

}

解决方案

first of things , you have to dump all excel to php array or var , after that you can create pdf as you want , this is simple php script for convert excel to pdf , you can use it and convert it to subclass of codeigniter as well

please check this url

PHP read excel file

when you use that class your excel data will be with you so you can use another class for pdf and this class will help you

codeigniter create PDF file

hopeful this is helpful for you .

这篇关于codeigniter将excel文件转换为pdf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆