473,394 Members | 1,866 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Embedding a chart in excel

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

Jul 18 '05 #1
4 7835
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 <St************@no.spam.motorola.com> wrote in message news:<bi**********@newshost.mot.com>...
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

Jul 18 '05 #2
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

sr****@yahoo.com 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 <St************@no.spam.motorola.com> wrote in message news:<bi**********@newshost.mot.com>...
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


Jul 18 '05 #3
Hello,
Can you send me the code? In the mean time I shall check setcell.

Regards,
Srijit

Stephen Boulet <St************@no.spam.motorola.com> wrote in message news:<bi**********@newshost.mot.com>...
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.

Jul 18 '05 #4
Hello,
Can you send me the code? In the mean time I shall check setcell.

Regards,
Srijit

Stephen Boulet <St************@no.spam.motorola.com> wrote in message news:<bi**********@newshost.mot.com>...
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.

Jul 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

22
by: PeteCresswell | last post by:
I've been to http://msdn.microsoft.com/library/default.asp?url=/library/en-us/mschrt/html/vbobjtitleobject.asp, but still don't have a clue. For example, I've got a chart object namde...
8
by: deko | last post by:
When using automation (and especially with early binding) I've heard it is best to use explicit references to everything. For example: Dim xlChart as Excel.Chart rather than Dim objChart...
0
by: Zero | last post by:
A B C D E Date Open High Low Close Chart = (Excel._Chart)oWB.Charts.Add(missing,missing,missing,missing); Chart.HasLegend = false; Chart.ChartWizard(...
1
by: Robin Tucker | last post by:
Heres and interesting problem: I have a VB.NET program that creates reports via. Word Automation. This all works fine. What I want to do as part of this report generation process is to embed a...
1
by: Jaime Lucci | last post by:
Hi everyone! I need to show an excel chart in my application. I can open an excel file and make the chart, but I want to show the chart inside my form insted of the excel GUI. I use the...
0
by: c0dergirl | last post by:
This c# program allows you to select multiple items from a listbox. For each selected item, a worksheet is created in the workbook with some information. Right now I create a chart that plots some...
1
by: =?Utf-8?B?U00=?= | last post by:
Hi, We have developed an application that transforms xsl into excel file and present xsl file to the user with data. We use open xml features of excel 2003. Our user is now asking for a chart to...
0
by: madhatter84gn | last post by:
I am trying to automate an excel spreadsheet and then create a chart. Dim chartRange As Excel.Range If rollup Then chartRange = sheet.Range("O2:Q14", Type.Missing) ...
0
by: j2flk1234 | last post by:
Hi, I am trying to graph in VB6 but am having lots of difficulty using MSChart. I switched my strategy to try and use the excel graphing method from VB. I have an excel worksheet with 2 rows,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.