Call to undefined method PHPExcel::sheetNameExists() When Loading a Template Excel File - phpexcel

I am trying to load an excel template:
require_once BASEPATH .'libraries/PHPExcel/IOFactory.php';
$objPHPExcel = PHPExcel_IOFactory::load($filename);
and it throws an Error:
Call to undefined method PHPExcel::sheetNameExists() in ...\libraries\PHPExcel\Worksheet.php on line 809
I checked $filename and the file is existing.
Spec:
PHPExcel: v. 1.7.6, 2011-02-27

You're likely mixing PHPExcel versions. The latest stable version is PHPExcel 1.8.0, and was released in March 2014. The missing function, PHPExcel::sheetNameExists(), is defined in PHPExcel.php.
PHPExcel_1.8.0_doc.zip contains a folder named Classes, inside it there's a folder named PHPExcel and a file named PHPExcel.php. You need to copy both to your libraries folder.
Download the latest PHPExcel version at https://phpexcel.codeplex.com/

Related

Laravel 5.7: what is the meaning of Undefined index style(mix('/css/frontend.css'))?

I am new to Laravel and currently attempt to import vue to my Laravel project.
After I ran 'npm run dev' command and check a page built with blade layout which is downloaded from a boilerplate project, I see the error : Undefined index in style(mix('/css/frontend.css')). This css file exists in public/css.
This is the line that invokes this error.
{{ style(mix('/css/frontend.css')) }}
What is its meaning and how to fix it?
Also, I can't find the api documentation that tell the function of style() and mix().
If you know where the documentation is, please give me the link. Thanks!
Check webpack.mix.js to see if frontend.css is being compiled by Laravel Mix. If you don't see any reference to it, then you should reference the file in your Blade views with asset('/css/frontend.css') instead of mix().
mix() reads from public/mix-manifest.json to map your source filenames to their output name, which is useful when files are versioned for cache busting. A mix-manifest entry might look like this: "/css/app.css": "/css/app.css?id=7564ad125f69af0035c3". If your file wasn't compiled or copied with Laravel mix then it would not have an entry in mix-manifest.json, which would explain the undefined index error and why you need to use asset() instead.
Also, I don't know what style() is but it doesn't come with the Laravel framework.
Refs: https://laravel.com/docs/5.7/mix#versioning-and-cache-busting

How do I install mpdf 7 without composer?

I'm currently using mpdf 6.1 and I'd like to switch to 7. But I can't find a way to install it without composer. Is there a full package that I can download, unzip and test on my localhost?
well, i've spend few days to search a way, finally i found it, you can download full package mpdf in this site, after download extract files and place on your project and load 'vendor/autoload.php'. in my case i use it with codeigniter, so i make some php file on libraries folder to load it.
<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
class M_pdf
{
function __construct()
{
include_once APPPATH.'libraries\vendor\autoload.php';
}
function pdf()
{
$CI = & get_instance();
log_message('Debug', 'mPDF class is loaded.');
}
function load($param=[])
{
return new \Mpdf\Mpdf($param);
}
}
after that i use it on my controller file :
$this->load->library('M_pdf');
$mpdf = $this->m_pdf->load([
'mode' => 'utf-8',
'format' => 'A4'
]);
$mpdf->WriteHTML("Hello World!");
$mpdf->Output();
but i still recommend to use composer as well,
There is no official v 7.x package including dependencies. To install without composer, you need to do two things:
1) Download the library and all dependencies
For version 7.0.3, that will be
psr/log,
setasign/fpdi (if you need to import other PDF documents),
paragonie/random_compat (if you have PHP 5.6),
myclabs/deep-copy
2) Ensure all needed classes are loaded
This means both mPDF classes and dependencies classes.
You can do this manually (reload, find the file with missing class, add require call, repeat) or you can use some autoloading library.
Or, just use composer, it will do all this work for you in one composer require mpdf/mpdf command and one require vendor/autoload.php call.
Using MPDF without using composer
1.Open your any htdocs folder and make new file of any extension
img-1
Note: Make sure you installed composer into your local server. if not then check this link
composer install
Open that php file into notepad++ file then right click and open folder in cmd.
img-2
3. After open cmd, type: “composer require mpdf/mpdf” then enter
img-3
After done this, you got 3 files in folder
img-4
Make Zip of these 3 files and upload into the server directory with your code
Try with below code
<?php
require_once __DIR__ . '/vendor/autoload.php';
$mpdf = new \Mpdf\Mpdf();
$mpdf->WriteHTML('<h1>Hello world!</h1>');
$mpdf->Output();
?>
For more details :
mpdf doc

Execute external jar file from pentaho

I am trying to execute a custom jar file from the modified javascript value. My Jar name is JsonParsing.jar which I have placed in lib folder. When I am trying to execute a method in the jar its giving me the error:
ReferenceError: "JsonParsing" is not defined.
Code Snippet:
var package1 = JsonParsing.parseJson.ParseJSON;
xyz=package1.processJson(data);
The Javascript kettle uses is Rhino. Rhino gives Javascript access to Java classes, but it's not completely transparent.
Check out the Rhino docs on Scripting Java.
I have resolved the issue. I was missing the Packages thing while creating the instance. As I had a static method in my class I have to call it in the following way. (parseJson is my package name and ParseJSON is my class name) . Here Packages is the default class provided by Rhino
var call = Packages.parseJson.ParseJSON;
xyz=call.processJson(data);
If it is a non static method I had to create an object in the following way
var call = new Pakages.parseJson.ParseJSON();
xyz=call.processJson(data);

meteor update from 0.6.4.1 to 0.6.5

in ~/.meteor/package/ folder all package.js files has only this:
// This file is included for compatibility with the Meteor 0.6.4 package downloader.
and nothing more.
Where is the package.js code?
Thanks!
The package system has changed.
You will find the auto-generated file you're refering to under:
/packages/name_of_your_package/.build/
As for where the actual 'package.js' file is, it's under
/packages/name_of_your_package/
As per the source code that's building these files for you:
// Pre-linker versions of Meteor expect all packages in the warehouse to
// contain a file called "package.js"; they use this as part of deciding
// whether or not they need to download a new package. Because packages
// are downloaded by the *existing* version of the tools, we need to
// include this file until we're comfortable breaking "meteor update" from
// 0.6.4. (Specifically, warehouse.packageExistsInWarehouse used to check
// to see if package.js exists instead of just looking for the package
// directory.)
// XXX Remove this once we can.
builder.write("package.js", {
data: new Buffer(
("// This file is included for compatibility with the Meteor " +
"0.6.4 package downloader.\n"),
"utf8")
});
I hope this helps!

How to install a Symfony 2.0 Bundle from Zip file

I tried installing the FixturesBundle as described in http://symfony.com/doc/2.0/bundles/DoctrineFixturesBundle/index.html but my proxy wont let me out.
So I went to https://github.com/doctrine/data-fixtures and download a zip from the latest commit.
I unzipped into the vendor directory and renamed it to doctrine-fixures. I edited the autoload.php and AppKernel.php files as described in the tutorial.
When I run:
php app\console doctrine:fixtures:load
I get the following message:
PHP Fatal error: Class 'Symfony\Bundle\DoctrineFixturesBundle\DoctrineFixturesB
undle' not found in C:\NetbeansProjects\route_rest_service\app\AppKernel.php on
line 20
Fatal error: Class 'Symfony\Bundle\DoctrineFixturesBundle\DoctrineFixturesBundle
' not found in C:\NetbeansProjects\route_rest_service\app\AppKernel.php on line
20
Is there a way to run the installation of bundle pointing it to a zip file?
I´m running Symfony 2.0.9 on Windows 7.
Seems like the doctrine bundle has been moved outside of Symfony scope back to Doctrine.
Please, use https://github.com/doctrine/DoctrineFixturesBundle
I had the same problem and this is how i successfully solved it. I started to download this files data-fixtures and DoctrineFixturesBundle, unzipped both into /vendor/doctrine and created this folder structure:
vendor
- doctrine
- doctrine-fixtures-bundle
- Doctrine
- Bundle
- FixturesBundle
DoctrineFixturesBundle.php
..other files...
vendor
- doctrine
- data-fixtures
- lib
- test
composer.json
..other files...
Then i edited the AppKernel.php and added
public function registerBundles(){
.....
new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(),
.....
}
Edited the composer.json located in the root of the project and added this 2 lines:
"Doctrine\\Bundle\\FixturesBundle": "vendor/doctrine/doctrine-fixtures-bundle",
"Doctrine\\Common\\DataFixtures": "vendor/doctrine/data-fixtures/lib"
Mine, now look like this:
{
"autoload": {
"psr-0": {
"": "src/",
"Doctrine\\Bundle\\FixturesBundle": "vendor/doctrine/doctrine-fixtures-bundle",
"Doctrine\\Common\\DataFixtures": "vendor/doctrine/data-fixtures/lib"
}
}
}
afterwards execute composer dump-autoload -o to recreate the classmap. All this was thanks to the users Wouter J and nifr that answered my question How to install DoctrineFixturesBundle offline
Happy coding!
Yes, it's true that Doctrine is being moved away from the Symfony namespace (see here).
So if you're using the Symfony standard distribution you download from the website (without using git), and you want to have the FixturesBundle installed manually, you have to download the doctrine-fixtures library from here, extract the zip into
YourProject/vendor/doctrine-fixtures
Download the FixturesBundle from here, and extract it in
YourProject/vendor/bundles/Doctrine/Bundle/FixturesBundle
Then you have to register the library's namespace, do it by adding
'Doctrine\\\\Common\\\\DataFixtures' => \__DIR\__.'/../vendor/doctrine-fixtures/lib',
in your autoload.php.
In addition, you'll have to register the Doctrine's namespace, because some part of your application will be using the DoctrineBundle shipped from the Symfony namespace, but the new downloaded FixturesBundle will be using the new Doctrine's namespace, so to make it work, in your autoload.php add the following line (taking care you do it before the Doctrine namespace, remember that more specific rules go first!)
'Doctrine\\\\Bundle' => \__DIR\__.'/../vendor/bundles',
So all you have to do now is to register the new bundle in your AppKernel.php writing
new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(),

Resources