Embedding a chart in excel

Discussion in 'Python' started by Stephen Boulet, Aug 21, 2003.

  1. 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
     
    Stephen Boulet, Aug 21, 2003
    #1
    1. Advertising

  2. Stephen Boulet

    Guest

    Hello,
    Refer the following link:
    http://groups.google.com/groups?hl=#link11

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

    Regards,
    Srijit

    Stephen Boulet <> wrote in message news:<bi3gg3$8pk$>...
    > 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
     
    , Aug 22, 2003
    #2
    1. Advertising

  3. 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

    wrote:
    > Hello,
    > Refer the following link:
    > http://groups.google.com/groups?hl=#link11
    >
    > Does it help you? If it doesn't, let me know what improvements are
    > required.
    >
    > Regards,
    > Srijit
    >
    > Stephen Boulet <> wrote in message news:<bi3gg3$8pk$>...
    >
    >>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
     
    Stephen Boulet, Aug 22, 2003
    #3
  4. Stephen Boulet

    Guest

    Hello,
    Can you send me the code? In the mean time I shall check setcell.

    Regards,
    Srijit

    Stephen Boulet <> wrote in message news:<bi5hm6$40t$>...
    > 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.
    >
     
    , Aug 23, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brian Shade

    Excel Chart SeriesCollection Error

    Brian Shade, Sep 9, 2004, in forum: Perl
    Replies:
    0
    Views:
    1,000
    Brian Shade
    Sep 9, 2004
  2. =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?=

    Problem with Excel reports ::::Excel 2003 Migration To Excel 2007

    =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?=, Oct 5, 2007, in forum: ASP .Net
    Replies:
    15
    Views:
    1,508
    =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?=
    Oct 24, 2007
  3. gnewsgroup
    Replies:
    4
    Views:
    3,011
    Kevin Spencer
    Feb 6, 2008
  4. Tarek
    Replies:
    6
    Views:
    318
    Chris Hohmann
    Nov 19, 2004
  5. Replies:
    1
    Views:
    831
Loading...

Share This Page