Pages

Tuesday, August 19, 2014

Spelling errors in Office Add-In can cause wrong value substitution in table columns in R2

When you create a Word template with the Office Add-In and Word for some reason marks field names  in your columns as being misspelled, these columns aren't getting their names properly replaced with actual values when you merge the template into a document with values.

You can reproduce the problem by going through the following steps on for example a standard AX 2012 R2 demo machine.
  1. Make sure your AX user is setup to run en-us as language.
  2. Make sure that you in Word have at least one other proofing language than en-us installed.
  3. Make sure that Word uses en-us as the default proofing language.
  4. Go to Organization administration / Setup / Document Management / Documents data sources.
  5. Add the SalesLine query and activate it.
  6. Open Word.
  7. Add some text in top of the document, just to make some space to the table you are about to insert.
  8. Insert a table with two rows and five columns.
  9. Go to the Dynamics AX tab and click Add Data.
  10. Select the data source you started out setting up.
  11. Add the following fields.
    • Sales order
    • Item number
    • Quantity (ordered quantity)
    • Unit price
    • Net amount
  12. Save the document and run a Merge.
  13. That should look ok.
  14. Go back to the template, select all with Ctrl-A and change the proofing language to something other than en-us.
  15. Run a spell-check and check that it finds supposed spelling errors in your column names.
  16. Save the document and do a new Merge.
  17. Now things don't look alright.
Some screenshots:
The template

The first well done merge

The template with the new proofing language and after spell check
The not so well done merge

There are some workarounds:

  1. Keep you fields names to just one word.
  2. Run a spell-check of the template and choose to ignore all spelling errors in fields names, making the squiggly lines disappear.
  3. Use a speciel Word style, which set up to not being checked for spelling errors, for the fields.
  4. Sometimes just shortening the name of the field in the table helps; for example from "Item number" to just "Item".
Well, it is an odd issue. But now you know a probable cause if you run into it.

For some KB2904824 should fix the issue. I havn't had any luck on my systems though.
I can't reproduce the issue in R3, so it must be fair to assume that is has been fixed for R3.

No comments: