Posts Tagged “Word 2013”

I hope you’ve had a chance to think about the code in the previous post for reading the value of a document property. This post will consider the problem of looping when async calls are involved, using that as the basis for the discussion. Read the rest of this entry »

Comments No Comments »

Besides writing to a specified place in a document, the other major thing an “App for Word” can do is communicate with Custom XML Parts. Mainly, I suppose the reason this was included in the original APIs is because Word can link a content control to a node in a Custom XML Part. Changing the content of either the content control or the node will mirror that change at the other end of the link. This capability is of interest for “data-mining” documents since it’s a fairly simple task to read a Custom XML Part from a closed Word document by leveraging the Office Open XML. Read the rest of this entry »

Comments No Comments »

Here’s another tool where you can try out JavaScript, on-line: JS Fiddle. The link is to the tutorial page, in the documentation. The actual editor is here.

Microsoft provides a number of resources, besides the documentation on MSDN, for learning about the Office (2013) APIs. Read the rest of this entry »

Comments 2 Comments »

In the last four installments, the basics of creating a Web Add-in and reading/inserting information was introduced, using two different data formats: matrix and plain text. When working with Word, especially, formatting can be just as important as text content. For this reason, Word supports more and complexer content types than the other Office applications. This post focuses on using these coercion types in a Web Add-in. Read the rest of this entry »

Comments No Comments »

I’m breaking the rhythm of the series on Web Add-ins to report a bug that was discovered by a developer in the VSTO forum, this week. Read the rest of this entry »

Comments No Comments »

Now that you have an idea of the basic JavaScript syntax it’s time to expand from code snippets to more complex subjects, starting with functions. This topic will extend over a number of posts as it’s not quite as simple as what we know from VBA… Read the rest of this entry »

Comments 1 Comment »

Since the release of Word 2013 we’ve been seeing sporadic complaints in the Word forum from developers that the selection highlighting disappears after their code executes. Only yesterday did someone post steps to reproduce the issue that worked consistently.

It turns out that this is, indeed, “unexpected behavior”. Apparently the screen redraw isn’t firing as it should.

There is a workaround, although it’s not ideal as it causes some screen flicker:

The Application.ScreenRefresh method will make the selection highlighting visible, again.

Changing the zoom factor should also work.

Comments 2 Comments »

A few days late for my seminar, but it’s finally here! Despite Microsoft Press’s break with O’Reilly, leaving authors in the German market in limbo, the 4th edition of the Word Programmierung Handbuch has been printed, bound and is being distributed this week.

Many thanks to the publisher for managing to accomodate all the new material without needing to throw out as much of the existing as we feared would be necessary. Instead of just over 1000 pages, the 4th edition has 1145, more than 250 completely new! Read the rest of this entry »

Comments 2 Comments »

[This is the follow-up to a previous post about mapping repeating content controls to a custom XML part.]
As a developer, you might want to be notified when the user adds a new set of mapped nodes to a repeating section, or deletes a set. If you look for events for Content Controls to help you with this you won’t find any.

Nor are there any events at the document or application level.

And you can’t re-purpose the entries placed in the context menu for adding or removing a repeating section item.
RepSec4

So, what can you do? Read the rest of this entry »

Comments No Comments »

Some significant improvements were made to Word’s content controls in Word 2013. You can find an overview here.

One interesting capability is a new kind of content control that brings back some of the functionality lost when XML nodes technology had to be pulled from Word due to the court decision in 2009. In the original release of Word 2007, xml nodes inserted into a table could be configured to repeat automatically when new table rows were inserted. While content controls in Word 2007 and 2010 can take over a lot of what could be done with xml nodes, this – and validation – were not possible “out of the box”.

A large portion of the article linked to above covers the new type of content control, in the section “Supporting repeating content”. You’ll also find a practical introduction, mainly targeting the “power user” on Greg Maxey’s site.

Something that doesn’t really jump out at you in any of the information I’ve found so far is how to

  1. Map a repeating section to a list of data already present in a Custom XML Part so that it all displays in the document
  2. Trap when the user adds or deletes a new data item (the repeating section must be mapped to a Custom XML Part in order for this to work)

Read the rest of this entry »

Comments 2 Comments »

I think many of us are still trying to come to terms with the fact that the only Help for Office 2013 is on-line. The official information can be found here:
http://technet.microsoft.com/en-us/library/cc178954.aspx
in the section AWS (Assistance and Worldwide Services).

The official line is that this is “better” all around. Help can now be searched on-line and translated. Of course, the fact that this was already the case for almost ten years isn’t mentioned…

Truth be told, the real reason is resources (financial). If Help has to be delivered with the product, then it has to be written before the product is released. This means lots of man-hours just prior to release, then down-time until the next product release. So, to a certain degree, the decision is understandable.

The other side of the coin, however, is that there’s no deadline that forces the documentation to actually be done and finished.

The result at the time of this writing, some months after the official release of Office 2013, is that the object model language reference (Help) hasn’t been reviewed for relevance to Office 2013, and new functionality isn’t fully incorporated. So you can spend literally hours trying to find information in the new, less friendly MSDN interface with the result that
you can’t find what you were looking for because it’s simply not there.

The “final straw” for me was a question about the Word object model in the Word for Developers forum the other day. So I’ve set up a new “page” on this blog to document un-documented behavior and information concerning Office. Everyone is welcome to contribute!

Comments No Comments »

In a previous post I wrote about a change in Word’s behavior: Even if the user chooses “Don’t save” when closing a Word document, the DocumentBeforeSave event triggers.

We’ve been thinking this is a bug, but it turns out that it’s not – it’s by design. Read the rest of this entry »

Comments 1 Comment »

The more people use Word 2013, the more changes and problems are bubbling to the surface. Again, this one was brought to the world’s attention in the Word for Developers forum.

“Reading mode” was introduced a few years ago to provide a more efficient way to read documents on-screen. By default, documents opened from an e-mail attachment will display in this view. As the view is optimized for reading, most editing commands are not available while in that mode. This lock-out also applies to the object model. When code tries to make modifications to the document that aren’t allowed while in reading mode, you see run-time error 4605: “This method or property is not available because this command is not available for reading”. Read the rest of this entry »

Comments 6 Comments »

EDIT: There’s an update to this in a new blog entry. To summarize: this behavior is by design and there is a workaround for the problem.

A new bug was reported in the Word for Developers forum this week. I also received an email about the same behavior. Microsoft confirms the behavior but isn’t yet ready to call it a bug. I call it a bug.

To summarize: In all versions of Word through 2010, when you are monitoring the DocumentBeforeSave event the event only triggers if the user chooses to Save the document. If the user chooses not to save when the prompt appears, the event does not trigger.

In Word 2013 the event also triggers when the user chooses “Don’t save”.

Comments No Comments »

When you create a new document in Word, it automatically bases on a template. By default, this will be the built-in Normal.dotm, but it can be any *.dotx or *.dotm file. This document will maintain a link back to the template, enabling it to use Building Blocks, Ribbon customization and macros in the template.

Users and companies provide templates for specific, oft-occurring tasks. In order to make them easily discoverable, they should appear in the interface presented for creating a new document. With the exception of Word 2007, that had an “Office button” rather than a File menu, this interface is accessed via the command File/New.

Up until the introduction of the Backstage in Office 2010, this interface was the File New dialog box. In Office 2010 and 2013, it’s a Backstage view, but in Word 2010 you have to click the link “My templates” in order to access custom templates, which are still offered in the File New dialog box. In Word 2013, custom templates are listed in the Backstage view in the “Personal” list (below), but not necessarily all of them. Why this is, is the topic of this post. Read the rest of this entry »

Comments 9 Comments »

The way Word lays out a page has changed with almost every version. Depending on what you do, you may like the new or prefer the old. For this reason, and for backwards compatibility, all the accumulated changes have been kept as growing list of “compatibility layout options”. The user can activate/de-activate these for each document individually, or as a group. Read the rest of this entry »

Comments 14 Comments »

As more people migrate away from Word 2003 and 2007 to a newer version, more bugs are starting to come out of the woodwork. Again, this one was brought up in a forum.

When a developer writes code to use Word’s built-in Find functionality, it’s usually to do a “Replace all”, or to run a loop that stops after every “hit” until the entire search Range has been processed. It’s therefore common practice to pass wdFindStop to the Wrap property (or argument of the Execute method).

It’s only rarely that we see code using wdFindAsk, so perhaps it’s not surprising that the bug hadn’t been reported previously by earlier adapters of Word 2010…

In the problem scenario, Find should only run on the current selection, then ask the user whether it should continue to execute across the entire document. This is quite legitimate and imitates the user interface. What’s happening is that Find does not stop after checking the current selection, but continues to run for the entire document (does the same as wdFindContinue).

Interestingly enough, wdFindAsk does work correctly when the end of the document is reached, asking the user if the search should continue from the beginning of the document.

Following is some VBA code that works around the problem, so that the user is queried both at the end of the selection and at the end of the document. Read the rest of this entry »

Comments No Comments »

The following information was supplied by MSFT Nathan O. last week in the Office MSDN forums:

“I know the documentation for Office 2013 is still somewhat limited, but hopefully the following link will help.

Microsoft Office Document: [MS-CustomUI2] Supporting Documentation – http://www.microsoft.com/en-us/download/details.aspx?id=727

From here, you should be able to download the *.txt files for Word, Excel and PowerPoint, plus the imageMso information. Once a file is downloaded, it can be opened in Excel to make it easier to look through all the controls.” Read the rest of this entry »

Comments 2 Comments »

It’s been over a month since I last wrote an article. Obviously, I’ve been busy…

Among other things, we’ve signed a contract for a fourth edition of “Word Programmierung, Das Handbuch” with Microsoft Press, Germany. Word developer books don’t have it easy on the software book market and the German-speaking market is comparatively limited in scope. So we’re very proud that our work is still selling well enough after almost ten years to warrant a fourth edition. Read the rest of this entry »

Comments No Comments »

In the initial release of Word 2013 the new Comment extensions, contained in the commentsEx.xml part, are not written to the XML returned to the object model property Range.WordOpenXML. Read the rest of this entry »

Comments No Comments »

One of the biggest problems with Word has always been command discovery balanced against working efficiently. For the ten plus years spanning Word 6 through Word 2003 there were menus, toolbars for various features, as well as the possibility of creating customized toolbars with the commands you needed most. In addition, the toolbars could be positioned freely on the screen. You could also customize the right-click menu.

All of that disappeared with the advent of the Ribbon in Office 2007. Surveys had “proven” that the user didn’t like adaptive menus and things that changed and didn’t drill down through menus. So commands were to be accessed through the Ribbon and those few used regularly could be placed on the user’s QAT. The right-click menu could still be customized, but not without working through the programming interface.

In addition to the Ribbon, some task panes and the right-click menu another interface with commands was introduced: the Mini Toolbar. Read the rest of this entry »

Comments No Comments »

Once again, a forum question has prompted a topic for my blog. This time, it comes from the discussions about developing for Office 2013.

For many years, a main focus of my work with Word has been related to importing and exporting data into and out of Word documents. The built-in functionality for this has always been “mail merge”. So I’ve worked with mail merge a lot. Unfortunately, it hasn’t really evolved since the early days of Word, around 1990. The only significant change occurred in Word 2003, when OLE DB became a supported connection method to the data source (and the default). Read the rest of this entry »

Comments 2 Comments »

New month, new topic – for the moment, at least. Forums are such a wonderful source of topics to write about… Today’s comes from a question in the Office 2013 Preview for Developers forum on MSDN.

In Word 2010 the Backstage was introduced with the purpose of providing management functionality for Office documents. The Backstage provides a large, for the developer customizable surface to interact with the user. Another reason for this move was to provide the same “experience” for the users of all the Office applications when using basic file management functionality.

As always, when something is “harmonized”, individuality is lost. We’ve experienced that since the first attempts at giving the Office applications a unified interface and the trend continues. Read the rest of this entry »

Comments 6 Comments »

Changes in the Word Open XML for comment’s functionality in Word 2013 were presented in my last post. This time, we’ll look at how these changes affect working with Comments using the Open XML SDK. Read the rest of this entry »

Comments No Comments »

Now that we’ve looked at Comments in the Word 2013 user interface and object model, it’s time to consider how this has been implemented in WordOpenXML and the Open XML SDK. Read the rest of this entry »

Comments No Comments »

In my last post I presented some of the new Comment functionality in the Word UI. The new functionality for Comments is also reflected in Word’s object model. Read the rest of this entry »

Comments 3 Comments »

Creating and Editing Comments

When you give the command to insert a new Comment in Word 2013 a small pane appears near the current selection. It gives the name of the person entering the Comment and how long ago the Comment was generated. This information travels with the Comment. You just start typing.

The Comment pane can be dragged any where on the screen. It can also be resized by dragging any side or corner.

 When you’re finished, click the X at the top right corner of the pane or click outside it on the document surface. Read the rest of this entry »

Comments 6 Comments »

The Word team has once again invested quite a bit of thought and effort in good old “Track Changes”. A couple of versions back, we got:

  • the Revisions Balloons – the area that appears in the margin where track changes and comments are listed in little boxes with lines back to the text
  • and the Revisions task pane that can be positioned vertically on the left or horizontally across the bottom of the Word window – lists all changes in the various sections of the document.

One pain point with the balloons is that, if there are lots of comments and changes, things appear very “busy” and it’s difficult to sort out what entry in the margin refers to which range of text. It’s also not easy to follow a discussion being carried on in the comments as they may well not be listed in the order they were created.

So an effort has been made to simplify the display of revisions, on the one hand, and allow a discussion using comments, on the other. The comments part is easy enough to understand; the changes in how revisions can be displayed takes some hands-on experimenting and getting used to.

This is too much material to cover in a single blog post, so I’m going to break the discussion down into at least four entries. The first will look at Comments in the UI, the second at the changes in the object model related to Comments.

Comments No Comments »

In the Open XML forum the other day a person was concerned about mail merge main documents they were converting from Word 2003 to Word 2010. The users insert merge fields in these documents that serve as “targets” for writing data into the documents. The software company is updating its tool to use the Open XML file formats to insert the data.

They were encountering a problem when opening the documents in Word 2010 to save them to the new file format. Read the rest of this entry »

Comments No Comments »

One of the most frustrating things for Word power users and developers is the accumulation of “bugs” in the product. If a problem is not caught early in the beta stage, it’s often around to stay. When pressed, the product team will often say that changing “expected behavior” will break backwards compatibility. Another reason we hear is that available resources are being used to “improve the product” (add new things). So when someone discovers a bug has actually been fixed, it’s a reason to ring the bells!

A few days ago a colleague asked me to check whether there really is no work-around for a problem that cropped up when Word moved from the binary *.doc to the Open XML *.docx file format in Word 2007. When a file containing form fields is saved as a template in Word 2007 and in Word 2010 any Number Formatting applied to a textbox form field is lost.

Before confirming the issue, I decided to test it in Word 2013, even though I was pessimistic, given Microsoft’s track record. But lo and behold: The problem has been fixed! Templates saved in Word 2013 retain the number formatting. What’s more, when used in Word 2007 and Word 2010, the templates function as they should.

So not only is a bug fixed, but at the same time a work-around for the problem in Word 2007 and Word 2010 is now available.

Technical details:
The problem can be seen and even corrected in the Word Open XML file. Locate a form field by searching in document.xml for the element (denotes a textbox form field). Below that look for the child element . If there is no child element then you’ve found a potential problem spot. Here’s a sample of correct Open XML for a form field with a number format:

<w:textInput>
  <w:type w:val=”number” />
  <w:format w:val=”#’##0.00″ />
</w:textInput>

Comments No Comments »