472,958 Members | 2,363 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 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 1773

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: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.