phpexcel

cant upload file using phpexcel issue with file path

泪湿孤枕 提交于 2019-12-22 09:49:08
问题 i am currently using phpexcel library to read my excel file which is to be uploaded by user . but i cannot at this moment :( i am using this code, i cannot get the file path right at this moment and if some one could tell me , how to over ride existing file and renaming the input file. file is being transferred to folder , but i cant get the path name correct in this line $objPHPExcel = $objReader->load('upload/'.$test);can any one help me ? move_uploaded_file($_FILES["file"]["tmp_name"],

PHPExcel download file

冷暖自知 提交于 2019-12-22 06:11:15
问题 I wanted to download an excel file generated by using PHPExcel. I followed the code from PHPExcel Force Download Issue and to no avail. After I log the data receive, my console only shows full of these symbols �.However, when I change the $objWriter->save('php://output'); to $objWriter->save('filename.xlsx'); then it just download the file to my root folder in my web server without any indication of downloading a file. Below is the code snippet for my php file <?php $con = mysqli_connect(

Laravel Excel how to load a view to specific row or cell?

喜夏-厌秋 提交于 2019-12-22 04:15:11
问题 I'm using Laravel Excel, I want to load a view file and set it to specific row. Is it possible to do it with laravel excel? bellow is the code for loading view in to the sheet: Excel::create('New file', function($excel) { $excel->sheet('New sheet', function($sheet) { $sheet->loadView('folder.view'); }); }); 回答1: It seems like the package doesn't offer that I this time but maybe you could do something like this. Create a wrapping view that you can pass some parameters to, such as a target row

PHPExcel Date Format

孤街浪徒 提交于 2019-12-22 03:44:29
问题 I am getting an output from MS SQL server in the '2012-08-09 00:00:00' (without quotes) format. However, when I write it to excel file I'm unable to write it in date format to have dd mmm yyyy formatting on excel. As a result i tried to write in format =date(2012,08,09) as a formula to the respective cells. But I don't want to output it as a formula but rather the value '09 Aug 2012' with the data type integrity intact. How do I do this? Or is there a simpler method? I read through the

Style a range of cells with phpexcel

笑着哭i 提交于 2019-12-22 03:36:40
问题 I'm trying to style an excel table with phpexcel. I do this: $sheet->getStyle('A1:B2')->applyFromArray($style); But it would be better if I can give numeric coordinates. I can use getStyleByColumnAndRow($x, $y) with one cell, but not with a range. Any ideas? Is it supported? Thanks in advance, M. 回答1: You can generate the cell names A1 and B2 from integer coordinates by PHPExcel function which name I currently don't remember (will add when found) and just concat the names using ':' as the

PHPExcel - dynamic row height for merged cells

社会主义新天地 提交于 2019-12-21 19:27:12
问题 After a lot of trial and error, I still can't seem to figure out a workaround to get merged cells to have an AutoFit height. I've tried an approach based on a bit of VBA code I found at this site: https://groups.google.com/forum/?fromgroups=#!topic/microsoft.public.excel.programming/pcvg7o5sKhA The following code pastes the text, wraps it, and changes the width of the cell (A1) to the total width of the merged cells I want. Then, it merges the cells and sets column A back down to the original

Passing data from PHP class to PHPExcel via AJAX

我与影子孤独终老i 提交于 2019-12-21 12:49:36
问题 i got stuck with OOP PHP and json data. i'm not completely new to OOP, but i can't get my head around this. if anyone can please explain to me, would be great! i have the following grid object in PHP: Class Grid { var $data; var $joins; var $fields; var $where; var $table; var $groupBy; var $having; var $limit; var $order_by; var $sort; var $security; var $set; var $sql; .... // loads data into the grid function load() { ... // setup the sql - bring it all together $sql = " SELECT $post[cols]

PHPExcel toArray skip first header row

寵の児 提交于 2019-12-21 11:01:11
问题 I'm uploading an excel file to website and process it for database use. I'm using toArray() function to get all rows in a php array. But I want to skip the first row ( header title row). The rest of rows will be stored in array. How can I skip the first row. Note : I can't use rangeToArray() function since there is not fixed range to get rows into array. It is dynamic. All i want is get all rows except first. 回答1: Eko answers half the problem, you can use rangeToArray(); but you don't need to

TP5导入EXCEL到数据库

最后都变了- 提交于 2019-12-21 09:33:14
前期准备工作: 1.下载PHPExcel放到vendor下 2.前端页面: <form action="save" method="post" enctype="multipart/form-data"> <div class="time-add clearfix"> <input type="submit" disabled name="submit" class="submit" value="提交" /> <a class="dianji" href="javascript:;"> <input type="file" name="file" id="fileupload" class="inputfile" style="position: absolute;display: none;"/> <label class="span" for="fileupload">批量导入用餐记录</label> </a> </div> </form> 3.后端代码 public function save(){ //设置文件上传的最大限制 ini_set('memory_limit','1024M'); //加载第三方类文件 vendor("PHPExcel.PHPExcel"); //防止乱码 header("Content-type:text/html;charset=utf-8"

Php Excel set whole column data alignment not working

荒凉一梦 提交于 2019-12-21 07:10:08
问题 I am Using this code For E column data set to right align but Its not showing me effect $objPHPExcel->getActiveSheet() ->getStyle('E') ->getAlignment() ->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT); instead of 'E' if i write E6 then it display E6 cell data to right. $objPHPExcel->getActiveSheet() ->getStyle('E6') ->getAlignment() ->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT); 回答1: You're correct: row and column styles aren't supported by PHPExcel. Cell styling is,