web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Loop/Iterate through a MS Word document

(0) ShareShare
ReportReport
Posted on by 95

Hi

I want to achieve following in AX 2009.

 

Input .doc/.docx file

while(endOfFile)

{

    getWord;

    // for this particular WORD do something; if certain condition is met. 

   nextWord;

}

 

I have started from following reference.

http://learnax.blogspot.it/2011/01/x-code-to-read-ms-office-word-document.html.

There is a lot of help available for VBA and C#, but I am unable to implement using it X++.

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    Hi, Sacro.

    Have you ever found out any solutions to your problem? I am looking for the way to loop or iterate through a MS Word document. I wonder whether I need to ask some 3rd party Word processing toolkits for help? And is that more convenient to using the manual Word Doc SDKs which can be customized by users according to our own favors? I am totally a green hand on this field. Any suggestion will be appreciated. Thanks in advance.



    Best regards,
    Arron

  • Suggested answer
    Martin Dráb Profile Picture
    237,801 Most Valuable Professional on at

    No need for any third-party tool, simply use the Words property of the DocumentClass (in Word .NET Interop).

    Find an example (in C#) here.

  • Community Member Profile Picture
    on at

    Ciao ARRONLEE

    The reply from Martin is the perfect answer to my original post.

    If that is your requirement , then you have got your answer.

    But I would like to add my experience.

    When I asked the question, I thought that there is only on way to access the word document .i.e to iterate through each and every word.  

    But then I discovered that there are many ways to access/read/create/modify a word document using code.

    For example you may need to work with tables, bookmarks, header and footer, find and replace etc.

    So, there are different ways to do each of above mentioned task.

    Assembly Microsoft.Office.Interop.Word has a number of interfaces that help to achieve that.

    I accessed this assembly using COM object in X++.  

    If you have some specific, free feel to ask .

  • Community Member Profile Picture
    on at

    Thanks for your nice reply,  Martin and Sacro. It is appreciated very much.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans