Looping in Export to Word report.


One of our clients has requested an Export to Word for a complex report. So far, I’ve been able to successfully display other static values which get printed in the header section of the report.

Problem is, I’m not able to print those values which get printed in a loop from the body section. My question is:
How to implement looping in Navision so that the values get printed in Microsoft Word? [:^)]

By the way, I’m using MS Navision V 4.0 SP3 HF6, MS Office 2003.
Thanx in advance

Exporting to Word-Excel functionality appeared on NAV 5, so the only way I know to do that is developing Automation. On the other hand when you say “I’ve been able to successfully…”, did you mean you could exporte this header values to Word? (how?)

Hi Galletin…

To know how you can generate/export simple static fields to MS Word, you can go through “Application Designers Guide” PDF in that the topic is ‘Extending C/AL’.
I’ve used the same method to print header values in my Word document.

But when it comes to print looping data, the same data is getting printed again and again.

I tried to run a sample report to print my name in Word using looping in Navision, but without success.

The NAV Style Sheet Tool which you can download from here http://mibuso.com/dlinfo.asp?FileID=869 May be of use. It depends on the export to office functionality in Nav5.0 but all the functionality to do this yourself exists in the module. In the end all it does is to create a word document in xml format. They’ve done all the hard work, I don’t imagine it would be too difficult to duplicate the little export tool in NAV5. Ian

Hi Ian,

Thanx for your reply. But, I’m using MS Navision 4.0 SP3 HF6.

Also, the feature which you’ve mentioned supports direct export to word from a form. But my scenario is something like this:

In the Quality module, there are two custom tables.
A big report which runs on those two tables fetches only those items which are subject to QC and then displays their stats.
The report is running fine in Navision.
My requirement is to replicate the same report in MS Word.
So far, I’m able to bring the data from the header fields successfully in to MS Word, but the data in the report which gets into a loop in Navision is getting displayed only once in MS Word.

I’m not able to implement a loop program in Navision, so that it puts all the data in MS word under the same MailMerge field, i.e. loop to print values in MS Word using Navision.
I hope my problem is more clear to you guies now. [:S]

Have you looked at codeunit 5054 WordManagement to see how it handles word documents for interaction logging. Might be some functions that you can replicate.