Bugs item #1097387, was opened at 2005-01-06 13:50
Message generated for change (Settings changed) made by dhabersa
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=551954&aid=1097387&group_id=78018
Category: None
Group: None
>Status: Closed
Resolution: None
Priority: 5
Submitted By: Daniel B. Habersat (dhabersa)
Assigned to: Nobody/Anonymous (nobody)
Summary: Characters property does not have __call__ method
Initial Comment:
The Characters property/method is supposed to allow an
application to modify the contents (in whole or in
partial) of a cell, text box, etc. According to the
Microsoft Excel Object Model, Characters has two
optional arguments, one to specify the starting
position and a second to specify the number of
characters (default is for the whole set). When I try
to call Characters of an object such as an AxisTitle or
Cell, python fails with an error like so:
<--
Traceback (most recent call last):
File "__init__.py", line 546, in ?
y2axis.AxisTitle.Characters(2,2).Font.Subscript = True
AttributeError: Characters instance has no __call__ method
-->
The way that a call like this should work can be easily
implemented within Excel's Visual Basic Editor with an
open sheet named "Sheet1":
<--
Function demonstration()
Sheet1.Cells(1,1).Value = "test phrase"
Sheet1.Cells(1,1).Characters(1,4).Font.Bold = True
End Function
-->
This script places the value "test phrase" into the
first cell on Sheet1, and then makes only the "test"
part bold. I have made a python script which attempts
to do the same thing as an example but fails on the
call to Characters.
Software versions:
Python 2.3.2
win32com build 203
Microsoft Excel 2002 (10.4302.4219) SP-2
----------------------------------------------------------------------
Comment By: Daniel B. Habersat (dhabersa)
Date: 2005-01-07 09:02
Message:
Logged In: YES
user_id=422196
Thanks! That's just what I was looking for.
Is there a better way to find information like this, like
documentation or source code or something? I tried (among
other things) looking in the makepy wrapper .py file but it
was rather confusing and not very helpful.
----------------------------------------------------------------------
Comment By: Stefan Schukat (sschukat)
Date: 2005-01-07 01:43
Message:
Logged In: YES
user_id=977439
The Characters property is a "parametrized" property.
Such a concept is not natively supported by Python.
With a makepy wrapper you could call
y2axis.AxisTitle.GetCharacters(2,2).Font.Subscript = True
So just a little bit different interpretation of an
interface definition.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=551954&aid=1097387&group_id=78018
|