xtentic Posted November 6, 2006 Share Posted November 6, 2006 Hi all,First i appoligise for my bad english. ;)For a friend i need to create a script that can read XLS documents. Well that's not the problem anymore... with the code (down here) i've already writen i can read tru the document. All rows and colums... but there one fault.. ROW A has normal characters (like A-Z) but row C contains thai carakters (using font : Angsana New in EXCEL or WORD). When i run the following script i see the words on ROW A displayed correctly but on row C wich contains THAI language words i only see ??? ? ? ? ?????.I've been searching over the internet for days but havent found why! i've tried alot of scripts (both free or wich i need to pay for) but only a pricy script (like 80$) would show the carakters in ROW C correctly.The script i wrote is.[code]<? $excel = new COM("excel.application") or die("Unable to instanciate excel"); //bring it to front $excel->Visible = 1;//NOT //dont want alerts ... run silent $excel->DisplayAlerts = 1; //open document $excel->Workbooks->Open("d:/excel.xls"); for ($h = 1; $h <= 3; $h++) { $book = $excel->Workbooks(1); $sheet = $book->Worksheets($h); echo "<table>\n"; //Wtite row for ($i = 1; $i <= 150; $i++) { echo "<tr>\n"; //write colom for ($j = 1; $j <= 5; $j++) { $cell = $sheet->Cells($i, $j); // #Select the cell (Row Column number) $cell->activate; // #Activate the cell if($cell->value == '0') { $td = ""; } else { $td = $cell->value; } echo "<td>" . $td . "</td>\n"; // #write the cell } echo "</tr>\n"; } echo "</table>\n"; } //closing excel $excel->Quit(); ?>[/code]the file excel.xls contains a couple of words on row A and the translation on row C.I hope someone has a possible sollution for this problem!.Thank you all for reading! If you don't have a anwser and you think someone you know could know the answer!!!, please point them to this topic!.. Quote Link to comment Share on other sites More sharing options...
Penny_Rollo Posted November 6, 2006 Share Posted November 6, 2006 [quote author=xtentic link=topic=114045.msg463824#msg463824 date=1162839925]Hi all,First i appoligise for my bad english. ;)For a friend i need to create a script that can read XLS documents. Well that's not the problem anymore... with the code (down here) i've already writen i can read tru the document. All rows and colums... but there one fault.. ROW A has normal characters (like A-Z) but row C contains thai carakters (using font : Angsana New in EXCEL or WORD). When i run the following script i see the words on ROW A displayed correctly but on row C wich contains THAI language words i only see ??? ? ? ? ?????.[/quote]Hi xtentic,I understand the problem you're having (sort of) and I know how to get Excel to display the hex codes (or whatever they're called) rather than the foreign language characters, so as to output a .txt file that doesn't have ???? wherever the foreign language characters should be.(see explanation at http://www.phpfreaks.com/forums/index.php/topic,110192.msg444978.html#msg444978 0 ).Not sure what you're doing with the language bits after calling them up, but if it's for a webpage, browsers will display the characters relating to the hex codes accurately, ie if you use the generated hex codes from the Excel conversion in place of the Thai characters.Hope this makes sense :) please ask, if not.Regards,Penny. Quote Link to comment Share on other sites More sharing options...
xtentic Posted November 6, 2006 Author Share Posted November 6, 2006 Hi,I understand the solution you have offerd me. But it's not the kind of solution i was hoping for. The list changes regularly so i need to convert the given data from the excel cell in realtime. Some scripts on the internet can do that... But as writen before they cost alot. And i think that the solution should me not that hard...Thanks for your support! :) Quote Link to comment Share on other sites More sharing options...
Penny_Rollo Posted November 6, 2006 Share Posted November 6, 2006 [quote author=xtentic link=topic=114045.msg463919#msg463919 date=1162849882]Hi,I understand the solution you have offerd me. But it's not the kind of solution i was hoping for. The list changes regularly so i need to convert the given data from the excel cell in realtime. Some scripts on the internet can do that... But as writen before they cost alot. And i think that the solution should me not that hard...Thanks for your support! :)[/quote]You're welcome :) sorry the info wasn't exactly what you needed for your application.Regards,Penny. Quote Link to comment Share on other sites More sharing options...
xtentic Posted November 7, 2006 Author Share Posted November 7, 2006 Well it could be but i rather have the solution of converting the data out of the cell to the hex codesAnyone more? :'( Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.