Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > PHP > PHP Forum > พอดีว่า เปิด excel ด้วย php แล้วขึ้น error นะค่ะ เลยอยากให้ผู้รู้ช่วยหน่อยนะค่ะ There are several possible reasons: • The file name or path does not exist.



 

พอดีว่า เปิด excel ด้วย php แล้วขึ้น error นะค่ะ เลยอยากให้ผู้รู้ช่วยหน่อยนะค่ะ There are several possible reasons: • The file name or path does not exist.

 



Topic : 063153



โพสกระทู้ ( 4 )
บทความ ( 0 )



สถานะออฟไลน์




ขึ้น error

Connect to Excel.Application
Fatal error: Uncaught exception 'com_exception' with message 'Source: Microsoft Excel
Description: Microsoft Excel cannot access the file 'C:\AppServ\www\test\Book1.xls'. There are several possible reasons: • The file name or path does not exist. • The file is being used by another program. • The workbook you are trying to save has the same name as a currently open workbook.' in C:\AppServ\www\test\testexcel.php:20 Stack trace: #0 C:\AppServ\www\test\testexcel.php(20): variant->Open('C:\AppServ\www\...') #1 {main} thrown in C:\AppServ\www\test\testexcel.php on line 20

โดยใช้Code (PHP)
	
	//*** Get Document Path ***//
	$strPath = realpath(basename(getenv($_SERVER["SCRIPT_NAME"]))); // C:/AppServ/www/myphp
	$OpenFile = "Book1.xls";
	//*** Create Exce.Application ***//
	$xlApp = new COM("Excel.Application");
	if($xlApp)   {        
		echo "Connect to Excel.Application";     
	}    
	else   {        
		echo "Can Not Connect to Excel.Application";   
	} 
	$xlBook = $xlApp->Workbooks->Open($strPath."/".$OpenFile); 
	////$xlBook = $xlApp->Workbooks->Open($strPath) or die("ERROR: Unable to open " . $strPatrh . "!\r\n");
	//$xlBook = $xlApp->Workbooks->Open(realpath($OpenFile));
	$xlSheet1 = $xlBook->Worksheets(1);
/*	$i = 0;
	foreach ($rows as $row)  {
		$i++; 
		$j = 0;
		foreach ($cols as $col)  {
			$j++;
			$cell = $xlSheet->Range($col . $row);
			$cell->activate();
			$matrix[$i][$j] = $cell->value;
		}
	}

	<table width="420" border="1">
	<? for($i=1;$i<=5;$i++){  ?>
	  <tr>
		<td><?=$xlSheet1->Cells->Item($i,1);?></td>
		<td><?=$xlSheet1->Cells->Item($i,2);?></td>
		<td><?=$xlSheet1->Cells->Item($i,3);?></td>
		<td><?=$xlSheet1->Cells->Item($i,4);?></td>
	  </tr>
	<? }  ?>
	</table>  

	//*** Close & Quit ***//
	$xlApp->Application->Quit();
	$xlApp = null;
	$xlBook = null;
	$xlSheet1 = null;




Tag : PHP







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2011-07-14 09:29:58 By : anusa View : 2834 Reply : 10
 

 

No. 1



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

ใช้บน Office Version อะไรครับ






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-07-14 09:33:09 By : webmaster
 


 

No. 2



โพสกระทู้ ( 4 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 1 เขียนโดย : webmaster เมื่อวันที่ 2011-07-14 09:33:09
รายละเอียดของการตอบ ::
ใช้ office 2007 ค่ะ

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-07-14 09:37:34 By : anusa
 

 

No. 3



โพสกระทู้ ( 4 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 2 เขียนโดย : anusa เมื่อวันที่ 2011-07-14 09:37:34
รายละเอียดของการตอบ ::
แล้วอาจมีการให้ใช้กับ user version 2010 ด้วยนะค่ะ

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-07-14 09:38:44 By : anusa
 


 

No. 4



โพสกระทู้ ( 545 )
บทความ ( 0 )



สถานะออฟไลน์


ลองใช้ของตัวนี้ดูครับ
http://phpexcel.codeplex.com/
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-07-14 09:56:18 By : grandraftz
 


 

No. 5



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

Code ตัวนั้นผมใช้กับ Office 2003 ครับ 2007 ไม่แน่ใจว่าจะมีปัญหาหรือเปล่าน่ะครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-07-14 10:01:03 By : webmaster
 


 

No. 6



โพสกระทู้ ( 545 )
บทความ ( 0 )



สถานะออฟไลน์


ผมเห็นว่ามันอ่าน .xlsx ได้อ่ะครับ แต่ 2010 นี่ไม่แน่ใจเพราะไม่เคยใช้
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-07-14 10:29:00 By : grandraftz
 


 

No. 7



โพสกระทู้ ( 768 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 4 เขียนโดย : grandraftz เมื่อวันที่ 2011-07-14 09:56:18
รายละเอียดของการตอบ ::
ตัวนี้ผมใช้อยู่ครับ เยี่ยมทีเดียว ใช้ได้ทั้ง Serv ที่เป็น Windows และ Linux อ่าน สร้าง xls xlsx ได้หมด สร้าง PDF ยังได้เลย
ลองดูนะครับ

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-07-14 10:33:51 By : naskw
 


 

No. 8



โพสกระทู้ ( 4 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 7 เขียนโดย : naskw เมื่อวันที่ 2011-07-14 10:33:51
รายละเอียดของการตอบ ::
ใส่โค๊ดตัวนี้ไปแล้วมันขึ้น error ตามข้างบนนะค่ะ ตอนนี้ยังแก้ไม่ได้เลยค่ะ

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-07-14 10:53:06 By : anusa
 


 

No. 9



โพสกระทู้ ( 768 )
บทความ ( 0 )



สถานะออฟไลน์


โค้ดตัวไหนครับ ไม่มีโค้ดนะความเห็นผมน่ะ ลองเอามาดูหน่อยสิ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-07-14 10:56:29 By : naskw
 


 

No. 10



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

Quote:
There are several possible reasons: • The file name or path does not exist. • The file is being used by another program. • The workbook you are trying to save has the same name as a currently open workbook.'


จัดไปตามนี้ครับ

ให้สร้างโฟเดอร์ตามนี้

・Windows 2008 Server x64
C:\Windows\SysWOW64\config\systemprofile\Desktop

・Windows 2008 Server x86
C:\Windows\System32\config\systemprofile\Desktop


อย่าลืมกำหนด Permission ให้โฟเดอร์ด้วย โดย User จะชื่อว่า IUSR หรือ IWAM เลือก Full Control

Go to : Unable to get the Open property of the Workbooks class (Excel 2003, 2007 Automation on Windows 2008 Server)
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-11-28 14:24:39 By : mr.win
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : พอดีว่า เปิด excel ด้วย php แล้วขึ้น error นะค่ะ เลยอยากให้ผู้รู้ช่วยหน่อยนะค่ะ There are several possible reasons: • The file name or path does not exist.
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 02
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่