質問編集履歴

2

ソース修正

2016/09/13 04:02

投稿

fixmiura
fixmiura

スコア17

test CHANGED
File without changes
test CHANGED
@@ -32,7 +32,7 @@
32
32
 
33
33
  #4 /home/user/workspace/project/Classes/PHPExcel/Writer/Excel2007.php(262): PHPExcel_Writer_Excel2007_Workbook->writeWorkbook(Object(PHPExcel))
34
34
 
35
- #5 /home/user/workspace/project/distribution_attrac in /home/user/workspace/project/Classes/PHPExcel/Cell.php on line 508
35
+ #5 /home/user/workspace/project/report_out in /home/user/workspace/project/Classes/PHPExcel/Cell.php on line 508
36
36
 
37
37
  ```
38
38
 

1

ソースを追加しました。

2016/09/13 04:02

投稿

fixmiura
fixmiura

スコア17

test CHANGED
File without changes
test CHANGED
@@ -35,3 +35,39 @@
35
35
  #5 /home/user/workspace/project/distribution_attrac in /home/user/workspace/project/Classes/PHPExcel/Cell.php on line 508
36
36
 
37
37
  ```
38
+
39
+
40
+
41
+ ```PHP
42
+
43
+ include('Classes/PHPExcel.php');
44
+
45
+ include('Classes/PHPExcel/IOFactory.php');
46
+
47
+
48
+
49
+ $objPHPExcel = new PHPExcel();
50
+
51
+ $reader = PHPExcel_IOFactory::createReader('Excel2007');
52
+
53
+ $excel = $reader->load("sample.xlsx");
54
+
55
+
56
+
57
+ $excel->setActiveSheetIndex(0);
58
+
59
+ $sheet = $excel->getActiveSheet();
60
+
61
+
62
+
63
+ //データ挿入部分はとりあえずコメントアウトしてあります
64
+
65
+
66
+
67
+ $writer = PHPExcel_IOFactory::createWriter($excel, 'Excel2007');
68
+
69
+ $out_file = 'report.xlsx';
70
+
71
+ $writer->save($out_file);
72
+
73
+ ```