Posts Tagged “bug”

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 »

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 »

There was a discussion in the Open XML SDK forum today that I found interesting. Certain namespaces for Office 2010 weren’t being recognized with a reference to the Open XML SDK version 2.0, even though they should have been. The references were being picked up just fine with a reference to the newer Open XML SDK 2.5, however.

When I tested I had no problems using the namespaces. Luckily, I thought to include the version number of the Open XML SDK runtime in my reply. Turns out that Microsoft replaced the original download with a newer version without any public notification, either about the fact that it was being done or mention about problems with the older version. When the OP downloaded the newer version, the problem disappeared!

So if you need to use the older version of the Open XML SDK and are having problems with any namespaces that belong to DocumentFormat.OpenXml.Office2010.Word.DrawingShape, try uninstalling, downloading a newer version and re-installing. You need a version that starts with v2.0.5###; the problem was ocurring in v2.0.4###.

Comments No Comments »

A poster in the Word for Developers forum has brought a new problem with the Documents collection to light this week. Unlike the one discussed in an earlier blog post, this behavior applies to all current versions of Word, including 2013.

Back when the Internet was comparatively new, Word didn’t know how to handle URLs as paths to files at all. The Open and Save methods of the Document(s) object couldn’t deal with anything that wasn’t a standard local or network path. At some point, this was rectified and Word can quite happily open and save documents to Internet, SharePoint and Skydrive sites.

What Word still can’t handle, however, is a URL as the index value to identify a Document object in the Documents collection. Code such as the following triggers the error 4160 “Bad file name”. Read the rest of this entry »

Comments No Comments »

I attempted to upgrade a Word 2007 document-level customization, created with VSTO 2008 to VSTO 2012 and Word 2013 the other day. Even after following all the migration steps, I was still getting an error message for the Document Designer:

“Designer failed to load correctly. Do not use the Designer to work on the document until you fix any errors in the error list, then close and re-open the Designer. Some errors can be fixed by rebuilding your project, while other might require code changes.” Read the rest of this entry »

Comments No Comments »

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 »

In my last post I showed how to change the target version of Word for a document using the Open XML SDK in order to ensure that “[Compatibility Mode]” does not appear in the document’s title bar. The code sample was in C#.

In this post I provide the code sample for VB.NET. Due to a bug in VB.NET Linq, it’s not possible to use the same “simple” approach as for C#. VB.NET Linq does not recognize the URI property as a property for the Compatibility Setting. The VB.NET equivalent of the C# approach (included near the end of the code sample, but commented out) causes an error. Read the rest of this entry »

Comments No 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 »

There is apparently a bug in the Open XML SDK 2.0 when trying to work with a document that contains a Ribbon extension using the namespace for Office 2010 <customUI xmlns=”http://schemas.microsoft.com/office/2009/07/customui“>

If the document contains a customUI12 part, you get the error ArgumentOutOfRangeException when using WordProcessingDocument.Open.

The problem appears to be fixed in Open XML SDK 2.5, which requires the .NET Framework 4.0. Read the rest of this entry »

Comments No Comments »

Mostly, I work with Word and that’s what this blog is usually about. But I do program inter-Office with Excel, PowerPoint and Access, when the need arises. Of those, PowerPoint is my least favorite – I find the object model impenetrable and always have to ask questions of my colleagues in the PowerPoint forum

One of the projects that’s kept me busy the last few weeks is a VSTO add-in for PowerPoint. Simply formulated, it’s a tool to assist in drawing diagrams for Western trail patterns. I want it to work in versions 2007, 2010 and 2013, which it does, with a notable exception in 2013. Read the rest of this entry »

Comments No Comments »

A fairly common question in the world of Word Development is how to merge multiple documents into one. (See for example this discussion in the MSDN Open XML SDK forum.) Read the rest of this entry »

Comments No Comments »

A person in the Word for Developers forum brought an important bug to our attention last week. When documents are opened/created then closed the Documents collection does not keep proper track. The index value is not reduced correctly (there are more documents in the collection than there should be) and some document names are missing while others are duplicated. (The thread with repro code sample can be found here.) Read the rest of this entry »

Comments 10 Comments »