Re: How can I fill a chart in word?
- From: Cindy M. <C.Meister-C@xxxxxxxxxx>
- Date: Sat, 03 Feb 2007 11:55:46 +0100
Hi Hooyoo,
I use InlineShapes to insert a chart in a word document.This is Office 2007, correct? The object model to manipulate a chart
//Insert a chart.
object chartLocation = wordApp.Selection.Range;
wordDoc.InlineShapes.AddChart(
Microsoft.Office.Core.XlChartType.xlLineStacked,
ref chartLocation);
InlineShape shape = wordDoc.InlineShapes[1];
Next step, I want to fill data to the chart, but I don't know how to
manipulate InlineShape. Does anybody can help me ? Thanks a lot.
Another question is how to avoid Excel popping up when insert the
chart. When I insert a chart, an Excel will pop up to let me fill the
data, but I want to hide it, and fill chart with coding.
created in this manner is not exposed. You'd need to insert the chart in
the "old-fashioned" way (as in previous versions). That goes something
like this (VB code):
Dim ils as Word.InlineShape
ils = doc.InlineShapes.AddOLEObject(ClassType:="Excel.Chart",
Range:=Selection.Range)
Dim of as Word.OleFormat
of = ils.OLEFormat
of.DoVerb wdOLEVerbOpen 'not in effect when creating, only when
editing
Dim xlWkbk As Excel.Workbook
Dim xlChart As Excel.Chart
Dim xl*** As Excel.Work***
'You'll need to explicitly cast these in C#
xlWkbk = of.Object
xlChart = xlWkbk.Sheets("Chart1")
xlSheet = xlWkbk.Sheets("Sheet1")
Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org
This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :-)
.
- Follow-Ups:
- Re: How can I fill a chart in word?
- From: Hooyoo
- Re: How can I fill a chart in word?
- Prev by Date: Re: Word automation diable menuentries
- Next by Date: Re: Problem printing from Excel after printing Word doc using VB.net
- Previous by thread: Re: Word automation diable menuentries
- Next by thread: Re: How can I fill a chart in word?
- Index(es):