LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-16-2010, 04:05 AM   #1
pu8y
LQ Newbie
 
Registered: Nov 2009
Posts: 12

Rep: Reputation: 0
Export an OpenOffice chart with VB6


Hi all,

I am developing using vb6 to export a chart (line graph) to OpenOffice Calc.
I am using:
Code:
Chart.diagram = Chart.CreateInstance("com.sun.star.chart.LineDiagram")
to create the LineDiagram.

However, it is just a line diagram. What I need is a line graph with points plotted on it. How can I make it to LineDiagram with LINES AND POINTS?

Many thanks!
 
Old 11-16-2010, 12:11 PM   #2
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Does OpenOffice support Visual Basic ? AFAIR the built-in scripting language of OpenOffice is Python.
 
Old 11-16-2010, 12:16 PM   #3
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by pu8y View Post
I am developing using vb6 ...
Are you sure it is VB6? It looks like OOo Basic which is similar but not identical to VB6.

OOo's scripting languages are BeanShell, JavaScript, OOo Basic and Python.
 
Old 11-16-2010, 06:38 PM   #4
pu8y
LQ Newbie
 
Registered: Nov 2009
Posts: 12

Original Poster
Rep: Reputation: 0
Yes it is VB6, my program generates a list in rows and columns, then creates a chart to represent the data in the table list. As code below:

Code:
Set Rect = oSM.Bridge_GetStruct("com.sun.star.awt.Rectangle")
Set RangeAddress(0) = oSM.Bridge_GetStruct("com.sun.star.table.CellRangeAddress")
Set Charts = oSheet.getCharts
            
Rect.x = 2200
Rect.Y = 3300
Rect.Width = 50000
Rect.Height = 15000
RangeAddress(0).Sheet = 0
RangeAddress(0).StartColumn = 1
RangeAddress(0).StartRow = 15
RangeAddress(0).EndColumn = 2
RangeAddress(0).EndRow = 14 + x
            
            
Call Charts.addNewByName("LineChart", Rect, RangeAddress(), True, True)
Set Chart = Charts.getByName("LineChart").embeddedObject
Chart.diagram = Chart.CreateInstance("com.sun.star.chart.LineDiagram")
Chart.diagram.HasXAxisTitle = True
Chart.diagram.XAxisTitle.String = "X"
Chart.diagram.HasYAxisTitle = True
Chart.diagram.YAxisTitle.String = "Y"
However it just came out with a line graph, I need a line graph with points, any idea?
 
Old 11-16-2010, 09:07 PM   #5
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
What file type (.xls, ods ...) is the VB6 in, which office suite has it open (MS Office, OOo ...) and can you give more detail on what you mean by "export a chart (line graph) to OpenOffice Calc"?
 
Old 11-16-2010, 09:40 PM   #6
pu8y
LQ Newbie
 
Registered: Nov 2009
Posts: 12

Original Poster
Rep: Reputation: 0
Actually it is VB6 and OOo Calc automation.

In my program I export the data to OpenOffice Calc file (.ods).
For example the data exported:
NO 1 2 3 4 5
VALUE 72 8 24 11 15

After that i intended to create a graph based on these data. I used:
Code:
Set Rect = oSM.Bridge_GetStruct("com.sun.star.awt.Rectangle")
Set RangeAddress(0) = oSM.Bridge_GetStruct("com.sun.star.table.CellRangeAddress")
Set Charts = oSheet.getCharts
            
Rect.x = 2200
Rect.Y = 3300
Rect.Width = 50000
Rect.Height = 15000
RangeAddress(0).Sheet = 0
RangeAddress(0).StartColumn = 0
RangeAddress(0).StartRow = 0
RangeAddress(0).EndColumn = 1
RangeAddress(0).EndRow = 5
            
            
Call Charts.addNewByName("LineChart", Rect, RangeAddress(), True, True)
Set Chart = Charts.getByName("LineChart").embeddedObject
Chart.diagram = Chart.CreateInstance("com.sun.star.chart.LineDiagram")
Chart.diagram.HasXAxisTitle = True
Chart.diagram.XAxisTitle.String = "X"
Chart.diagram.HasYAxisTitle = True
Chart.diagram.YAxisTitle.String = "Y"
Below is what I get. But i need a graph with lines and points plotted, as shown in another attachment.
Attached Thumbnails
Click image for larger version

Name:	lines only.JPG
Views:	31
Size:	16.9 KB
ID:	5198   Click image for larger version

Name:	points and lines.JPG
Views:	30
Size:	18.3 KB
ID:	5199  
 
Old 11-16-2010, 10:02 PM   #7
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Now we almost know what the question is ("OOo Calc automation" means launching OOo Calc and telling it to run a macro ...?) I have to apologise for not thinking ahead and realising this sort of in-depth OOo scripting question is seldom answered on LQ so OpenOffice.org community forum or OpenOffice.org Forum would be better places to ask the question. I'm still dubious that OOo runs VB6 and wonder if it could be detail differences between VB6 and OOo basic that are causing the problem.
 
Old 11-16-2010, 10:53 PM   #8
pu8y
LQ Newbie
 
Registered: Nov 2009
Posts: 12

Original Poster
Rep: Reputation: 0
Yes I have asked for help in OpenOffice.org Forum, but seems like nobody can help me yet.
Looking around for experts in OpenOffice.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how do I label chart data in OpenOffice calc? newbiesforever Linux - Software 5 10-11-2009 01:21 PM
OpenOffice Calc Chart Editing...sucks? R00ts Linux - Software 11 10-16-2007 06:10 AM
Can you Automate a Word Chart from VB6? pgstein Programming 1 08-04-2005 10:30 AM
OpenOffice Calc export chart to image file? cast55 Linux - Software 2 03-15-2005 10:51 AM
OpenOffice Calc Chart Editting dubya Linux - Software 0 01-15-2005 04:19 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration