I understand where you're coming from, I just don't like how Windows handles 
such things.  My opinion is that determining file type by extension (arbitrary 
at that) is a bad thing to begin with.

-----Original Message-----
From: python-win32-bounces+rdahlstrom=directedge....@python.org 
[mailto:python-win32-bounces+rdahlstrom=directedge....@python.org] On Behalf Of 
Tim Roberts
Sent: Friday, December 12, 2008 1:24 PM
To: Python-Win32 List
Subject: Re: [python-win32] Writing to Excel performance

Dahlstrom, Roger wrote:
> Couple of tricks I've used with some success...
>
> 1.  If this is data only, and not formulas, you can write the data as
> an html table, but name the file something.xls - Excel will open it
> natively.
> 2.  If you need special formatting or formulas, you can write the data
> as Excel's HTML templates (make a sample file in Excel, save it as
> html, then you can see how to do it)
>
> I believe #1 to be a security flaw in windows - that you can just name
> a file anything, and the application will open it,

No, it's not a security flaw.  The file still has to be in a format that
Excel knows how to import.  Excel just happens to understand a lot of
formats, and it reads the file to figure out what the format really is.
It doesn't trust the extension.  Internet Explorer uses the same
tactic.  When a web page sends an attachment, it doesn't trust the MIME
type.  It reads the file to detect the file type.

If you rename an executable to xxx.xls and try to open it within it
Excel, it will complain about the format.

--
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.

_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


DISCLAIMER:
This e-mail, and any attachments thereto, is intended only for use by the 
addressee(s) named herein and
may contain legally privileged and/or confidential information. If you are not 
the intended recipient
of this e-mail, you are hereby notified that any dissemination, distribution or 
copying of this e-mail, and 
any attachments thereto, is strictly prohibited. If you have received this in 
error, please immediately notify 
me and permanently delete the original and any copy of any e-mail and any 
printout thereof. 
E-mail transmission cannot be guaranteed to be secure or error-free. The sender 
therefore does not accept 
liability for any errors or omissions in the contents of this message which 
arise as a result of e-mail transmission.

NOTICE REGARDING PRIVACY AND CONFIDENTIALITY
Direct Edge ECN LLC may, at its discretion, monitor and review the content of 
all e-mail communications.

www.directedge.com
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to