Jet Reports Homepage |  Community Forum |  Downloads |  Submit A Ticket |  Jet Express Support
Feedback

Launching Jet Professional from Dynamics NAV Classic Client


  1. Start Excel; make it visible and interactive.

  2. Open the Jet Reports Excel Add-in.

  3. Open a Workbook.

  4. Update Options.

  5. Run Jet/Report.

  6. PrintPreview the Worksheet that contains the report.

  7. Close Excel.

Name Data Type Subtype
XL Automation 'Microsoft Excel 10.0 Object Library' .Application
Workbook Automation 'Microsoft Excel 10.0 Object Library'.Workbook
Worksheet Automation 'Microsoft Excel 10.0 Object Library'.Worksheet

 

{To reuse existing instances of Excel, use CREATE(XL)}

 

IF CREATE(XL, TRUE) THEN BEGIN

{Workbooks don't necessarily start visible or interactive. Since the

user will interact with the workbook, you need to set the below values.}

 

XL.Interactive := TRUE;

XL.Visible := TRUE;

 

{Add-ins do not automatically open when using automation, so the Jet Excel add-in

must be opened below. You must also open any other add-ins that are needed.}

 

XL.Workbooks.Open('C:\Program Files\JetReports\JetReports.xlam'); 


{Open the report workbook.}

 

Workbook := XL.Workbooks.Open('C:\Program Files\JetReports\Reports\Finance Graph.xls');

 

{Update the report options. The option values are in single cell named ranges.}

 

Workbook.Names.Item('PeriodType').RefersToRange.Value := 'Week';

Workbook.Names.Item('DateFilter').RefersToRange.Value := '1/1/01..3/31/01';

{Run the jet report.

IMPORTANT NOTE:

Jet Reports intends to keep the below command working in future versions of Jet Professional. All other menu commands might change. They might work now, but could break in future version. Please do not use any other Jet Professional commands in your software.}

XL.Run('JetMenu','Report');

XL.Run('Events');

 

{note:  The "Events" macro applies ONLY to versions PRIOR to Jet Reports 2009}

 

{In some cases all the below steps may not be desired. Perhaps the user wants to drilldown and examine the report in Excel.}

{Choose a worksheet and launch print preview. The user can cause the report to print if desired.}

 

Worksheet := Workbook.Worksheets.Item('Report');

Worksheet.PrintPreview;

 

{Avoid the message asking if the workbook should be saved by marking it as already saved. Be careful with this. This step assumes that the workbook does not need to be saved since it is a report template.}

Workbook.Saved := TRUE;

 

{Close Excel}

 

XL.Quit;

 

END;

 
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments