Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default minor but irritating problem when generating Excel files with Perl

Eric,
You can write the BIFF8 format to create a true Excel file.
As long as you do not want too much fancy stuff, look at
http://www.Planet-Source-Code.com/vb...11898&lngWId=1

NickHK


"Peter" <peterguy -at- hotmail -dot- com wrote in message
...
Generating text files and renaming them with a .xls extension does not

mean
that Excel will treat them as "true" Excel files. It's analogous to
renaming a text file with a .mp3 extension and expecting an mp3 player to
play it.

If you want to generate true Excel files with PERL, you'll have to do it
with OLE, as hinted at in his/her post.

-Peter


"EJF" wrote in message
...

I generate the files just like I generate any other file using Perl
except that I use the .xls extension. For example, here I do exactly
the same thing with two files, except one of them (.txt - which I never
open in Excel) behaves well and the other one (.xls, which I *do*, of
course, open in Excel) behaves poorly:

open (OUTPUT1, "test.xls");
open (OUTPUT2, "test.txt");

print OUTPUT1 "hello";
print OUTPUT2 "hello";

close OUTPUT1;
close OUTPUT2;

I run this program and I then see two files that it's generated - an
Excel file and a file in a simple text editor. If I double click on the
simple text file, it opens in a simple editor (TextEdit, as it happens -
I'm a Mac user). I can then make changes and save it and everything is
normal - it recognizes that the file that I double clicked is the same
one that I'm working in. However, if I double click on the Excel file
and make changes, then when I go to save it

a) it doesn't recognize that the file that already exists in this
folder is exactly the same file as I'm working with - otherwise it
would never say "a file with this name already exists - do you want to
replace it with the current file?"; and
b) it seems to think that my default choice to save the file would be
as a .txt file, even though the file itself is an Excel Worksheet file.


It sounds like a trivial little thing, and it is basically trivial
except that sometimes I'll generate 100 Excel files and then with each
one of them I have to go through the same silly thing.

Thanks for the help.

Eric


--
EJF
------------------------------------------------------------------------
EJF's Profile:

http://www.excelforum.com/member.php...o&userid=32065
View this thread:

http://www.excelforum.com/showthread...hreadid=518842




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
excel, install perl script 2apart Excel Discussion (Misc queries) 0 March 26th 08 11:28 PM
Disable Excel Command Bars and Remove Irritating Grey Bar Andy B via OfficeKB.com Excel Programming 0 December 8th 05 09:23 AM
excel, vb arrays and perl Mark Seger Excel Programming 0 June 4th 05 01:11 PM
Excel 2000 Macro and Perl problem Jim Simpson Excel Programming 0 May 19th 04 06:45 PM


All times are GMT +1. The time now is 09:22 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"