Chart creation via Excel automation

tyrexxxtyrexxx Member Posts: 13
edited 2006-10-12 in Navision Attain
I automate the Chart creation via Excel and use code like this:
VAR
      XlApplication: 'Microsoft Excel 11.0 Object Library'.Application";
      XlWorkBook: 'Microsoft Excel 11.0 Object Library'.Workbook";
      XlWorkSheet: 'Microsoft Excel 11.0 Object Library'.Worksheet";
      XlRange: 'Microsoft Excel 11.0 Object Library'.Range";
      XlChart: 'Microsoft Excel 11.0 Object Library'.Chart";

PROCEDURE
     CREATE(XlApplication);
     XlWorkBook := XlApplication.Workbooks.Add(-4167);
     XlWorkSheet := XlApplication.ActiveSheet;
     XlWorkSheet.Name := 'Report';

     ... // filling data

     XlRange := XlWorkSheet.Range('a1:af10');
     XlChart := XlWorkBook.Charts.Add;
     XlChart.ChartWizard(XlRange,4,4,1,0,1,1,'Chart');
//   XlChart.SeriesCollection(1).XValues := '=Report!R2C2:R2C32';

and I want to define my own labels for X-Axis. On VBA it is wiriiten as
XlChart.SeriesCollection(1).XValues = "=Report!R2C2:R2C32"

but I got syntax error for construction XlChart.SeriesCollection(1).XValues := '=Report!R2C2:R2C32'; in Navision

How could I write that expression?

Comments

  • BigblueBigblue Member Posts: 4
    Hi, maybe write it like this
    XLChart.SeriesCollection('1').XValues('=Report!R2C2:R2C32');

    Best Regards

    Martin
  • tyrexxxtyrexxx Member Posts: 13
    not working:

    "You have specified an unkknown variable XValues"
  • rkaufmannrkaufmann Member Posts: 70
    @tyrexxx

    Hi,

    I have got similar problems here.

    Do you already have a solution for your problem?

    Rolf
  • sggsgg Member Posts: 109
    Try and specify the Category and the Value Titles with the ChartWizard parameter as follows:

    xlChart.ChartWizard(Source,Gallery,Format,PlotBy,CategoryLabels,
    SeriesLabels,HasLegend,Title,CategoryTitle,ValueTitle,ExtraTitle)
    Sunday, Godwin G
Sign In or Register to comment.