Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Codeigniter and PHPWord

I'm trying to read some document. So I use PHPWord.

Here what i got in my library.

<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');

require_once  APPPATH . '/third_party/PhpWord/Autoloader.php';
use PhpWord\Autoloader as Autoloader;
Autoloader::register();

class Word extends Autoloader {

}

when i'm going to use it. I have this error :

Fatal error: Class 'PhpOffice\PhpWord\Autoloader' not found in D:\xampp\htdocs\jdih\application\libraries\Word.php on line 6
A PHP Error was encountered

Severity: Error

Message: Class 'PhpOffice\PhpWord\Autoloader' not found

Filename: libraries/Word.php

Line Number: 6

Backtrace:

I have try this CodeIgniter PHPWord using as third_party but no help .

Here is the folder of my third_party. How can i fix the problem ?

enter image description here

like image 881
YVS1102 Avatar asked Aug 23 '16 15:08

YVS1102


1 Answers

Download PHPWord from here

And load the library like this.

include_once(APPPATH."third_party/PhpWord/Autoloader.php");
//use PhpOffice\PhpWord\Autoloader;
//use PhpOffice\PhpWord\Settings;
Autoloader::register();
Settings::loadConfig();
like image 142
Abdulla Nilam Avatar answered Sep 28 '22 06:09

Abdulla Nilam