Jump to content
Software FX Community

Manipulating ChartFX charts in a Word document from VB6 through automation


User (Legacy)

Recommended Posts

We are upgrading our application from MS Office Graph Charts to ChartFX

charts. Within the VB application, there is a need to manipulate the chart

in a word document thru automation.

The existing code (that has been working for some years) that gets hold of

the ms office graph chart looks like this:

Dim m_oWord As Word.Application

Dim m_oWordDoc As Word.Document

Dim oShape As Object

Set m_oWord = GetObject(, "Word.Application")

Set m_oWordDoc = m_oWord.Documents.Open(FileName:="filename.doc") 'file

with an inline MS office chart OLE object shape

For Each oShape In m_oWordDoc.InlineShapes

If oShape.Type = wdInlineShapeEmbeddedOLEObject Then

If oShape.OLEFormat.ProgId = "MSGraph.Chart.8" Then

oShape.Activate

Set oChart = oShape.OLEFormat.object.Application.Chart

'now I can manipulate the chart e.g.

oChart.HasTitle = False

end if

end if

next oShape

etc.

~~~~~~~~~~~~~~~

To get to the chartFX OLE object, this has been modified to:

Dim m_oWord As Word.Application

Dim m_oWordDoc As Word.Document

Dim oShape As Object

Set m_oWord = GetObject(, "Word.Application")

Set m_oWordDoc = m_oWord.Documents.Open(FileName:="filename.doc") 'file

with an inline chartFX OLE object shape that works when double-clicked and

can be modified by using the chartfx toolbar etc. Pasted in using the office

add-in.

For Each oShape In m_oWordDoc.InlineShapes

If oShape.Type = wdInlineShapeEmbeddedOLEObject Then

If oShape.OLEFormat.ProgId = "CfxDocServer.CfxDocServer.1" Then

oShape.Activate

Set oChart = oShape.OLEFormat.object.ChartFX.Chart 'ERROR

LINE: this consistently fails with Error: 430 Class does not support

Automation or does not support expected interface.

'now I can manipulate the chart e.g.

oChart.Title(CHART_TOPTIT) = ""

end if

end if

next oShape

What does the error line above need to look like so that chartfx chart can

be manipulated in the word doc thru automation from VB6?? I have tried

different combinations that I could think of; but the error will not go

away. Does chartFX not support automation in this context (like the MS

Office Chart does)?

There is a reference to the ChartFX Client Server control OCX in the VB

project references.

Thanks in advance,

Raj

Link to comment
Share on other sites

The Chart FX Office Add-on does NOT support automation.

The idea is that you program Chart FX ActiveX from say VB and once it is

ready to go in the document.

What exactly are you trying to do ? You are importing a Word Document from

your program and then modify the chart that's in it ?

--

FP

Software FX

Link to comment
Share on other sites

I am trying to generate a chart dynamically within VB6 (using a dataset from

a database). These charts (total of 3) need to be within a word document.

The existing VB app that does all of this using MS Office Graph Charts is an

ActiveX DLL that gets called whenever this word document needs to be

generated with new data. This ActiveX DLL does not have a form and it

creates a new word document from a template that already has the MS Office

Graph Charts in it. It will then make the charts within the doc by

manipulating the existing charts by automation.

Now, the MS Office graph charts are being replaced by chartfx charts. So if

Chart FX Office Add-on does not support automation, what is the next best

option? Thanks in advance.

Regards.

"SoftwareFX Support" <noreply@softwarefx.com> wrote in message

news:wulomoyfEHA.3888@webserver3.softwarefx.com...

> The Chart FX Office Add-on does NOT support automation.

>

> The idea is that you program Chart FX ActiveX from say VB and once it is

> ready to go in the document.

>

> What exactly are you trying to do ? You are importing a Word Document from

> your program and then modify the chart that's in it ?

>

> --

> FP

> Software FX

>

>

Link to comment
Share on other sites

The way I would do it would be this:

From my VB Program:

1) Create a new Chart FX Chart (ActiveX Control NOT Ole Object)

2) Customize it the way I want it to be in the document.

2) Read the office document.

3) Locate the chart OLE object or a place-holder

4) Remove the OLE Object from the document (or place-holder)

5) Export the chart and inset it as an OLE Object into the document.

The reason the OLE Object is not automated is that the Chart FX Office

add-in can work with either the Chart FX COM Object, ActiveX or IE Client

component.

The Chart FX COM Object for example (chart fx dll) does NOT expose an

automation interface.

--

FP

Software FX

Link to comment
Share on other sites

  • 4 years later...

 Can anybody provide either a snippet or a link to an example of step 5 ("Export the chart and inset it as an OLE Object into the document.") of the previous post?

 I've been racking my brain and pouring over the documentation for a couple of days now and can't find anything.  I have the trial versions of Chart FX 7 and Chart FX COM 6.2 installed, and would happily use either so long as I can get the above steps to work.  I can do the first four, but not the fifth.

 Thank you in advance!

Chris

post-5684-1392240968837_thumb.jpg

Link to comment
Share on other sites

 This is an old thread about an old product. If you are trying to get your charts to Word, I belive you will have to manually export them to images and then manually add it to your word document. If thats not a good solution for you, try opening a new thread on the appropriate forum (explaining exactly what it is you are trying to do).

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...