Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Embedding a chart in excel

Reply
Thread Tools

Embedding a chart in excel

 
 
Stephen Boulet
Guest
Posts: n/a
 
      08-21-2003
I'm having trouble scripting Excel to embed a chart from python.

Say I have created a sheet object and a workbook object, "xlSheet" and
"xlBook".

Creating a chart in front of my sheet is as easy as:

xlSheet.Select()
xlChart = xlBook.Charts.Add()

Now how do I tell it to go embed itself in my sheet? In VBA, it might be
something like:

xlChart.Location Where:=xlLocationAsObject, Name:=xlSheet.Name

Thanks.

(Is there a newsgroup/list with more of a focus on issues like this than
c.l.py?)

-- Stephen

 
Reply With Quote
 
 
 
 
srijit@yahoo.com
Guest
Posts: n/a
 
      08-22-2003
Hello,
Refer the following link:
http://groups.google.com/groups?hl=e...gle.com#link11

Does it help you? If it doesn't, let me know what improvements are
required.

Regards,
Srijit

Stephen Boulet <(E-Mail Removed)> wrote in message news:<bi3gg3$8pk$(E-Mail Removed)>...
> I'm having trouble scripting Excel to embed a chart from python.
>
> Say I have created a sheet object and a workbook object, "xlSheet" and
> "xlBook".
>
> Creating a chart in front of my sheet is as easy as:
>
> xlSheet.Select()
> xlChart = xlBook.Charts.Add()
>
> Now how do I tell it to go embed itself in my sheet? In VBA, it might be
> something like:
>
> xlChart.Location Where:=xlLocationAsObject, Name:=xlSheet.Name
>
> Thanks.
>
> (Is there a newsgroup/list with more of a focus on issues like this than
> c.l.py?)
>
> -- Stephen

 
Reply With Quote
 
 
 
 
Stephen Boulet
Guest
Posts: n/a
 
      08-22-2003
Very nice. I was working on my own excel classes, but I see this does lots.

Im my example, I can see from the code that arguments to the Add method
aren't optional. Thanks.

Maybe this should be in the python cookbook?

-- Stephen

http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> Hello,
> Refer the following link:
> http://groups.google.com/groups?hl=e...gle.com#link11
>
> Does it help you? If it doesn't, let me know what improvements are
> required.
>
> Regards,
> Srijit
>
> Stephen Boulet <(E-Mail Removed)> wrote in message news:<bi3gg3$8pk$(E-Mail Removed)>...
>
>>I'm having trouble scripting Excel to embed a chart from python.
>>
>>Say I have created a sheet object and a workbook object, "xlSheet" and
>>"xlBook".
>>
>>Creating a chart in front of my sheet is as easy as:
>>
>>xlSheet.Select()
>>xlChart = xlBook.Charts.Add()
>>
>>Now how do I tell it to go embed itself in my sheet? In VBA, it might be
>>something like:
>>
>>xlChart.Location Where:=xlLocationAsObject, Name:=xlSheet.Name
>>
>>Thanks.
>>
>>(Is there a newsgroup/list with more of a focus on issues like this than
>>c.l.py?)
>>
>>-- Stephen


 
Reply With Quote
 
srijit@yahoo.com
Guest
Posts: n/a
 
      08-23-2003
Hello,
Can you send me the code? In the mean time I shall check setcell.

Regards,
Srijit

Stephen Boulet <(E-Mail Removed)> wrote in message news:<bi5hm6$40t$(E-Mail Removed)>...
> There seems to be a problem with UseExcel.setcell:
>
> >>> a.setcell(sht1.Name,1,(1,1))

> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> File "excel_from_google.py", line 139, in setcell
> sht.Cells(row, col).Font.FontSize = fontSize
> File "C:\Python23\lib\site-packages\win32com\client\dynamic.py", line
> 504, in __setattr__
> raise AttributeError, "Property '%s.%s' can not be set." %
> (self._username_, attr)
> AttributeError: Property '<unknown>.FontSize' can not be set.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
A real challenge: Create a Gantt-chart-like chart gnewsgroup ASP .Net 4 02-06-2008 02:27 PM
Problem with Excel reports ::::Excel 2003 Migration To Excel 2007 =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?= ASP .Net 15 10-24-2007 01:34 PM
ASP can generate a chart (pie chart) ? Tarek ASP General 6 11-19-2004 06:33 PM
Excel Chart SeriesCollection Error Brian Shade Perl 0 09-09-2004 02:37 PM
Win32::OLE Excel Chart SeriesCollection. Problem changing from Excel 2000 to 2002 moller@notvalid.se Perl Misc 1 07-05-2004 10:50 AM



Advertisments