473,407 Members | 2,676 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Reading EXCEL (XLS) documents with other charactersets


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

???? ? ???? ???? ???? (the other code i cannot post due weird carakters!)

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. If i convert the script to a HTML document i get the carakters with &# and a four digit number... that's what i like to extract from the excel sheet.

The script i wrote is.

Code:
<?php
$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();
?>

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!. If you like you may mail me personaly at eric [at] bruggema [dot] (netherlands) nl


Nov 7 '06 #1
0 1800

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: hokiegal99 | last post by:
This is not really a Python-centric question, however, I am using Python to solve this problem (as of now) so I thought it appropiate to pose the question here. I have some functions that search...
1
by: frankvfox | last post by:
I need a code sample using VB ASP.Net 2003 which exports a tab delimited text file resident on the server into an Excel spreadsheet which will be saved through the browser to the client's local...
5
by: Carl | last post by:
Please can anyone tell me how I can create a macro to save the results of a query as an excel file? The query is called Student List and I would like to save it to "My Documents". We have had...
3
by: michb | last post by:
Hi I have decided to export specific data to excel to calculate times and job costing etc and have managed to create a macro to export the data. Can I then adjust the macro to open the excel on...
1
by: Jim | last post by:
This should really be simple, but I can't figure it out. I have some VB that exports a table in an Excel format ("C:\NewReport.xls"). After the export is done, I simply want to have some code...
6
by: nitromuse | last post by:
I haven't been able to configure a data adapter with the wizard for Excel (Access is no problem) and when I try to do it in code I still have problems, can anyone help, here is some code I've been...
0
by: dt | last post by:
I downloaded Microsoft Office 2003 Reference Schemas from: http://www.microsoft.com/downloads/details.aspx?familyid=fe118952-354... Then I tried to use JAXB on them, specifically excel.xsd and...
0
by: aotemp | last post by:
Hi! Im having a bit of trouble... im trying to convert an excel spreadsheet cell value to a string! But all I get is "System.__COM" in my string variable... this.openFileDialog1.FileName =...
0
by: sandervanee | last post by:
Hello, I am trying to export several Access 2003 select queries to Excel 2003 using an Access macro. I'm using the macro command "TransferSpreadsheet" to export the queries. This going quit well,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.