473,387 Members | 1,844 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,387 software developers and data experts.

MS Word Chart filled with data - URGENT PLEASE

My boss wants this done in a day. I would be happy with a week!

Anyway, I have a dataset filled with data and need to populate an MS word
chart with it when writing a report. Any tutorials or suggestions would be
great.

Sample data at http://www.kjmsolutions.com/sample.txt

Oct 5 '06 #1
7 8998
Hi,

Here I understand that you means the Chart that using Word Menu,
Insert/Picture/Chart.
So I think you may try to transfer the DataSet to a Excel Workbook and then
import the excel file into the Chart.

Here is a VBA macro for your reference, but it is easy to run the similar
code in VB.NET.

Sub Macro1()
Dim oChart As Graph.Chart 'Add reference to Graph Object library
Set oChart =
Selection.InlineShapes.AddOLEObject(ClassType:="MS Graph.Chart.8",
LinkToFile:=False, DisplayAsIcon:=False).OLEFormat.Object
oChart.Application.FileImport "C:\temp\TestABC.xls"
End Sub

How to automate Word from Visual Basic .NET to create a new document
http://support.microsoft.com/default.aspx?scid=kb;[LN];316383

How to automate Microsoft Word to perform a mail merge from Visual Basic
.NET
http://support.microsoft.com/default.aspx?scid=kb;[LN];302816

How to automate Microsoft Word to perform a mail merge from Visual Basic
.NET
http://support.microsoft.com/default.aspx?scid=kb;[LN];301656

Here is a link about how to transfer data into Excel Workbook in VB.NET.
How to transfer data to an Excel workbook by using Visual Basic .NET
http://support.microsoft.com/default.aspx?scid=kb;[LN];306022

You may have a try and let me know the result.

If I misunderstood or you have any conern on this issue, please feel free
to let me know and I am glad to be of assistance.
Best regards,

Peter Huang

Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Oct 5 '06 #2
Can you possibly demonstrate in the Set oChart statement the use of a
dataset?


""Peter Huang" [MSFT]" <v-******@online.microsoft.comwrote in message
news:yX**************@TK2MSFTNGXA01.phx.gbl...
Hi,

Here I understand that you means the Chart that using Word Menu,
Insert/Picture/Chart.
So I think you may try to transfer the DataSet to a Excel Workbook and
then
import the excel file into the Chart.

Here is a VBA macro for your reference, but it is easy to run the similar
code in VB.NET.

Sub Macro1()
Dim oChart As Graph.Chart 'Add reference to Graph Object library
Set oChart =
Selection.InlineShapes.AddOLEObject(ClassType:="MS Graph.Chart.8",
LinkToFile:=False, DisplayAsIcon:=False).OLEFormat.Object
oChart.Application.FileImport "C:\temp\TestABC.xls"
End Sub

How to automate Word from Visual Basic .NET to create a new document
http://support.microsoft.com/default.aspx?scid=kb;[LN];316383

How to automate Microsoft Word to perform a mail merge from Visual Basic
NET
http://support.microsoft.com/default.aspx?scid=kb;[LN];302816

How to automate Microsoft Word to perform a mail merge from Visual Basic
NET
http://support.microsoft.com/default.aspx?scid=kb;[LN];301656

Here is a link about how to transfer data into Excel Workbook in VB.NET.
How to transfer data to an Excel workbook by using Visual Basic .NET
http://support.microsoft.com/default.aspx?scid=kb;[LN];306022

You may have a try and let me know the result.

If I misunderstood or you have any conern on this issue, please feel free
to let me know and I am glad to be of assistance.
Best regards,

Peter Huang

Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.

Oct 5 '06 #3
Let me explain....the data gets moved to an access database from the csv
file. I will actually be reading it from the access database. The csv file
itself is not usable due to bad formatting and column names being too long.

Also, could you demonstrate formatting of the chart within .NET?

--
Get a powerful web, database, application, and email hosting with KJM
Solutions
http://www.kjmsolutions.com

""Peter Huang" [MSFT]" <v-******@online.microsoft.comwrote in message
news:yX**************@TK2MSFTNGXA01.phx.gbl...
Hi,

Here I understand that you means the Chart that using Word Menu,
Insert/Picture/Chart.
So I think you may try to transfer the DataSet to a Excel Workbook and
then
import the excel file into the Chart.

Here is a VBA macro for your reference, but it is easy to run the similar
code in VB.NET.

Sub Macro1()
Dim oChart As Graph.Chart 'Add reference to Graph Object library
Set oChart =
Selection.InlineShapes.AddOLEObject(ClassType:="MS Graph.Chart.8",
LinkToFile:=False, DisplayAsIcon:=False).OLEFormat.Object
oChart.Application.FileImport "C:\temp\TestABC.xls"
End Sub

How to automate Word from Visual Basic .NET to create a new document
http://support.microsoft.com/default.aspx?scid=kb;[LN];316383

How to automate Microsoft Word to perform a mail merge from Visual Basic
NET
http://support.microsoft.com/default.aspx?scid=kb;[LN];302816

How to automate Microsoft Word to perform a mail merge from Visual Basic
NET
http://support.microsoft.com/default.aspx?scid=kb;[LN];301656

Here is a link about how to transfer data into Excel Workbook in VB.NET.
How to transfer data to an Excel workbook by using Visual Basic .NET
http://support.microsoft.com/default.aspx?scid=kb;[LN];306022

You may have a try and let me know the result.

If I misunderstood or you have any conern on this issue, please feel free
to let me know and I am glad to be of assistance.
Best regards,

Peter Huang

Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.

Oct 5 '06 #4
Hi,

Here I provide some code about insert a chart into Word document and import
excel data into the chart and then format it.

Imports Word = Microsoft.Office.Interop.Word
Imports Graph = Microsoft.Office.Interop.Graph

Module Module1

Sub Main()
Dim wdApp As New Word.Application
wdApp.Visible = True
Dim oDoc As Word.Document = wdApp.Documents.Add
Dim oInlineShape As Word.InlineShape =
oDoc.Content.InlineShapes.AddOLEObject(ClassType:= "MSGraph.Chart.8",
LinkToFile:=False, DisplayAsIcon:=False)
Dim oChart As Graph.Chart = oInlineShape.OLEFormat.Object
oChart.Application.FileImport("C:\temp\TestABC.xls ")
oChart.BarShape = Graph.XlBarShape.xlPyramidToMax
oChart.DisplayBlanksAs = Graph.XlDisplayBlanksAs.xlInterpolated
oChart.ChartArea.Font.Italic = True
oChart.ChartArea.Interior.Color = RGB(128, 128, 128)
End Sub

End Module

NOTE: the FileImport did not accept an .NET DataSet, that is why I suggest
you transfer your data into Excel Worksheet first.
Here the information for FileImport Method.

Imports a specified file or range, or an entire sheet of data.
expression.FileImport(FileName, Password, ImportRange, WorksheetName,
OverwriteCells)
expression Required. An expression that returns an Application object.
FileName Required String. The file that contains the data to be imported.
Password Optional Variant. The password for the file to be imported, if the
file is password protected.
ImportRange Optional Variant. The range of cells to be imported, if the
file to be imported is a Microsoft Excel worksheet or workbook. If this
argument is omitted, the complete contents of the worksheet are imported.
WorksheetName Optional Variant. The name of the worksheet to be imported,
if the file to be imported is a Microsoft Excel workbook.
OverwriteCells Optional Variant. True to specify that the user be notified
before imported data overwrites existing data on the specified datasheet.
The default value is True.
Example
This example imports data from the range A2:D5 on the worksheet named
"MySheet" in the Microsoft Excel workbook named "mynums.xls."
With myChart.Application
.FileImport FileName:="C:\mynums.xls", _
ImportRange:="A2:D5", WorksheetName:="MySheet", _
OverwriteCells:=False
End With

Please have a try and let me know the result.

Best regards,

Peter Huang

Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Oct 6 '06 #5
Hi,

In addition, here is the document for MS GRAPH Object Modal.
<Program Files>\Microsoft Office\OFFICE11\1033\VBAGR10.CHM

Best regards,

Peter Huang

Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Oct 6 '06 #6
Hi,

I am posting to check how the thing is going on.
If you still have any concern on this issue, please feel free to let me
know.

Best regards,

Peter Huang

Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Oct 11 '06 #7
I ended up filling the sheet with data first like you mentioned. I apologize
for my late response as I had not known you posted.

Thanks again,
Kelly


""Peter Huang" [MSFT]" <v-******@online.microsoft.comwrote in message
news:Ik**************@TK2MSFTNGXA01.phx.gbl...
Hi,

I am posting to check how the thing is going on.
If you still have any concern on this issue, please feel free to let me
know.

Best regards,

Peter Huang

Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.

Nov 15 '06 #8

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

Similar topics

0
by: Pranav | last post by:
I've a web page that displays report data in a data grid an a chart ( I'm using Chart Fx for .Net which creates .PNG files on Server) I've a requirement to export the datagrid and chart both to...
9
by: Patrick.O.Ige | last post by:
I have a code below and its a PIE & BAR CHART. The values now are all static but I want to be able to pull the values from a database. Can you guys give me some ideas to do this? Thanks ...
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...
5
by: rick m | last post by:
We have a fairly good sized Access database that contains some info on the children our agency sees. We also have 40+ templates that require some info from the database be inputted into them, such...
0
southoz
by: southoz | last post by:
Good ay all , I'm fairly new to access(a little over 5 weeks now). Since I'v started I have picked up a lot of useful information from forums such as this and in doing so will share that information...
5
by: Kuna | last post by:
Hi All, I am trying to create a gantt chart in php by getting data from database. I am using WindowsXp OS and having php-4 and my-sql DB. I have installed the JPGRAPH package to my system and...
2
by: JP SIngh | last post by:
Hi All We urgently needs some help please. We need to create an org chart from our employee data but struglling. We are using ASP with SQL Server 2000. Does anyone know of a commercial...
5
by: grant | last post by:
I'm trying to use a scatter chart to plot level reading for a pump station level sensor. The sensor takes a reading every 4 seconds, and there are 23,000 reading per chart There appears to be...
0
by: blurbology | last post by:
I have a word document that contains a Graph (MSGraph). I am trying to update the Chart's datasheet with new values, but I cannot seem to get the correct reference for the chart object. What I am...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.