[python-win32] Excel win32com newbie question

Jim Steil jim at qlf.com
Thu Oct 5 23:16:15 CEST 2006


I've been working this week building some Excel spreadsheets using Python
and win32com.  I am not having any trouble getting my sheets built with the
proper data in the proper cells, but I'm having a heck of a time trying to
find out how I can format my cells to make it look nicer.  I want to set it
so most of the columns will resize themselves to the proper width and I
would like to adjust the alignment of some columns.  I've browsed through
the last years worth of archives on this mailing list and searched the web
extensively but can't seem to find how to get it to work.  I've come across
numerous examples of how to do some things, but they don't seem to work on
my machine.
 
Possibly my biggest problem is that I can't get my machine to give me the
Excel constants.  Here is the code I'm doing to try to test the constants
and the error I'm getting back.  
 
from win32com.client import constants, Dispatch
 
x = constants.xlHAlignRight
Traceback (most recent call last):
  File "<input>", line 1, in ?
  File "C:\Python24\Lib\site-packages\win32com\client\__init__.py", line
168, in __getattr__
    raise AttributeError, a
AttributeError: xlHAlignRight
 
I'm hoping there is something obvious that I'm missing.  I think I can find
my way through the rest of my issues if I can just get by this constants
problem.  Thanks for any help you can provide.
 
            -Jim
 
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20061005/f2baca12/attachment.html 


More information about the Python-win32 mailing list