Mergefield count header/footer section word.

Marcos
Member Posts: 55
Hello,
I have a hot question (for me it is).
Im building an CU for a word intergration in NAV2009, in the CU i use the Microsoft Word 12.0 Object Library automation control to perform several actions.
One of the things i want to achieve is to fill mergefields in header and footer sections.
To achieve this i need to know how many mergefields are used in this sections, the code to read the sections is clear to me and works.
But there is one thing what doesnt work, and that is the count function.
I only get the result of the first line in the header section of the document, example.
--WORD DOC
--HEADER
<<mergefield1>> <<mergefield2>>
<<mergefield3>>
--HEADER
If i do the following, MergeFieldCount := WordApp.Selection.Fields.Count;
The result is 2, so only the first line in the header section is counted.
Does anyone knows al solution for this ?? I searched the inet for a long time now but no answers.
I have a hot question (for me it is).
Im building an CU for a word intergration in NAV2009, in the CU i use the Microsoft Word 12.0 Object Library automation control to perform several actions.
One of the things i want to achieve is to fill mergefields in header and footer sections.
To achieve this i need to know how many mergefields are used in this sections, the code to read the sections is clear to me and works.
But there is one thing what doesnt work, and that is the count function.
I only get the result of the first line in the header section of the document, example.
--WORD DOC
--HEADER
<<mergefield1>> <<mergefield2>>
<<mergefield3>>
--HEADER
If i do the following, MergeFieldCount := WordApp.Selection.Fields.Count;
The result is 2, so only the first line in the header section is counted.
Does anyone knows al solution for this ?? I searched the inet for a long time now but no answers.
0
Comments
-
Nobody, has a solution or the same problem.... :-k0
-
Does your selection include all fields you want to count?Ufuk Asci
Pargesoft0 -
The selection contains the section.0
-
I am not sure but it seems like your selection does not include all lines in header. Once I've done something about field count but they weren't in header. I also had a similiar problem and the reason was selection's scope. You should try workaround solutions like putting another values as header.field, activepane etc.Ufuk Asci
Pargesoft0 -
Ok thnx for the tip, i will try it out.0
-
Problem solved, just lucky shot.
But thnx for the reply.
I changed the iunit paramter from 5 to 6, and now the count delivers a good result.
WordApp.Selection.EndKey(iUnit,iExtend);
greetzzz0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions