View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
SDelroen SDelroen is offline
external usenet poster
 
Posts: 2
Default Interfacing PHP and Excel using OLE Automation: file access pr

Hi Joel, thanks for your reply.

Yes, first echo statements work fine, the problem occurs really when opening
the file.

Effectively, I should have been more precise on what "blocked": the script
is still running, but nothing happens.

If I RDP to the console on the server, in the taskmgr I can see the
EXCEL.EXE process created by PHP, and the file it Excel is trying to open is
locked for writing (ie. if I open it by double-clicking, Excel proposes me to
access it read-only).

One interesting thing: I am using the domain integrated authentication in
IIS for this website; if I try to open the locked file by double-clicking it,
Excel tells me the file is locked by MY account, though the EXCEL.EXE process
is run by Console.

There is no firewall on this server.

I might have found the problem: the file I am trying to open has external
links. With a "normal" file it works fine.

That's why I used the second argument (UpdateLinks) in the Open call
documented here (2 means "Never update links for this workbook on opening"):
http://msdn.microsoft.com/en-us/libr...i ce.11).aspx

Apparently, the argument I passed (2 of PHP type integer) is invalid. Let me
explain why I think so:
In the following, I am running everything from http://localhost/test.php,
which allows user interaction.
If I put $excelApp-Visible = 0 and use 2 as the UpdateLinks argument to
Open, everything runs fine without any interaction with the user.
If I put $excelApp-Visible = 1 and use 2 as the UpdateLinks argument to
Open, Excel shows up and tells me the links could not be updated, which means
it tried to update it, which is NOT the expected behaviour!
The values 1, 2 and 3 all give the same result, which is contradictory with
the documentation (1 is "ask", 2 is "do not update" and 3 is "do update").
If I put 0, Excel shows up and closes without any interaction, but 0 is not
an authorised value according to the documentation.
Any other value crashes the script.

According to the documentation, this UpdateLinks argument is an Object,
maybe that's where the problem lies? If so, how can I create the object to be
passed as an argument to Open?

Just out of curiosity, I tried to use the value 0 and run the script from a
client computer, but it is still blocked in the way described above.

Thanks for your help !