1. Mikhael Botvinik
  2. PowerBuilder
  3. Tuesday, 31 October 2023 16:40 PM UTC

Is it possible to draw graphs in an Excel file from PowerBuilder? I create tables with data in Excel from PowerBuilder, but how can I build charts or pies based on this data? I saw that classes ExcelPieChart, ExcelBarChart, enum eChartType in C# are used for this purpose, is it possible to use them or something similar in PowerBuilder?
Thank you.

Mark Goldsmith Accepted Answer Pending Moderation
  1. Wednesday, 1 November 2023 13:57 PM UTC
  2. PowerBuilder
  3. # 1

Hi Mikhael,

Chris is correct in that you can do this through OLE the same way you are connecting to Excel to retrieve data from the worksheet. It's just a matter of going through the Excel object browser to understand the (chart) objects, properties and functions for creating graphs.


Have a look at this video and you'll start to see the kind of code that needs to be converted into PowerBuilder OLE syntax: https://www.youtube.com/watch?v=xtymYml9fwc


HTH...regards,


Mark

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 31 October 2023 21:02 PM UTC
  2. PowerBuilder
  3. # 2

Hi Mikhael ;

   For that type of Excel control from a PB App into Excel, you would need to use OLE. That would allow your App to not only send data directly to various cells but then also send Excel commands to control graphing within Excel.

Regards ... Chris

Comment
  1. Mikhael Botvinik
  2. Tuesday, 31 October 2023 23:05 PM UTC
Thanks for your response, Chris.

I'm already using OLE:

oleobject ole_sheet

oleobject ole_excel

ole_excel.ConnectToNewObject('excel.application')

ole_excel.Application.WorkBooks.Open(ls_full_path)

ole_sheet = ole_excel.application.workbooks(1).worksheets(1)

ole_sheet.Activate

etc.

But how can I access the ExcelPieChart and ExcelBarChart classes? Or is there some other way to draw graphs? Maybe there is an example somewhere?

Thank you.
  1. Helpful
  1. Chris Pollach @Appeon
  2. Tuesday, 31 October 2023 23:24 PM UTC
Looks like you'll need to deal with this object class via Ole ...

https://learn.microsoft.com/en-us/office/vba/api/excel.chart.oleobjects

  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.