July 14, 2018
A few days ago I encountered a question on Stack Overflow about using tabs to align content in a Word document. The required result was something like this:

I started looking at the Word JS API documentation and realized there is nothing in that object model for inserting tabs or defining tab stops. Read the rest of this entry »
No Comments » |
Office JS API, OOXML, Web Add-ins, Word object model | Tagged: add-in, object model, office-js, OOXML, Web Add-ins |
Permalink
Posted by WordMeister
June 30, 2018
One question I’ve seen fairly regularly is, “How do I copy formatted content from a Visual Studio RichTextBox to a Word document?”
The answer, of course, is, “Use the clipboard.” But behind that is another question: How to put the content in the Clipboard? Read the rest of this entry »
2 Comments |
General, VS+Word | Tagged: copy, RichText |
Permalink
Posted by WordMeister
June 25, 2018
My previous post on getting started with Script Lab and the Office JS APIs for Word looked at some similarities between the COM and Word JS API object models, based on the Script Lab Basic API call sample. This time, I’ll highlight the core part of the sample code that differs from working with COM/VBA. Read the rest of this entry »
No Comments » |
Concept, Office JS API, Syntax, VBA->JS, VBA->JS;Web Add-ins | Tagged: add-in, object model, office-js, VBA->JS, Word 2016 |
Permalink
Posted by WordMeister
March 29, 2018
Ran into an interesting question on Stack Overflow the other day. The problem description is short, so I’ll copy it here:
There is a word VBA method style("style").LinkToListTemplate ListTemplate:=Nothing
which is used to set the style numbering to None. My problem is that I cannot find the same in C# word interop. The method exists but does not work with style.LinkToListTemplate(null)
.
Read the rest of this entry »
No Comments » |
Word object model | Tagged: numbering, object model, styles |
Permalink
Posted by WordMeister
March 23, 2018
Since last I wrote about “Web Add-ins” and the Office JavaScript API a lot has happened. Office 2016 with the updated APIs has been released and the APIs are constantly being up-dated. Those with a subscription will receive the updates more regularly than anyone who has installed Office from an msi. Web add-ins for Office 2016 (and later) run not only on the Windows desktop, like VBA, VSTO and other solutions, they also run on Mac, iPad, mobile devices and the on-line versions of the Office applications. Read the rest of this entry »
No Comments » |
Office JS API, Web Add-ins, Word 2016 | Tagged: office-js, Web Add-ins, Word 2016 |
Permalink
Posted by WordMeister
February 23, 2018
…and the problem isn’t reproducible.
I was confronted with a request to trouble-shoot such a situation, not long ago. A large organization contacted me and this was the problem description. Read the rest of this entry »
No Comments » |
General, VSTO, Word object model | Tagged: crash, object model, VSTO |
Permalink
Posted by WordMeister
November 5, 2015
Microsoft has a new way to collect product feedback: UserVoice.
For as long as I can remember, it’s seldom been possible to provide feedback about Office to Microsoft. There has been the occasional conduit, hidden away, but on the whole it’s been like throwing spit balls at a brick wall…
This has changed for developers. For how long no one knows, but take advantage of it while it lasts! You can post an idea and link to it so that like-minded folks can up-vote it in order to give it more weight:
Office Developer portal
The Microsoft folks are reading and evaluating these, so take care to provide a clear, logical presentation, with example scenarios as to why the point is important.
No Comments » |
General |
Permalink
Posted by WordMeister
August 13, 2015
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 »
1 Comment |
Concept, VBA->JS, Web Add-ins, Word 2013, Word 2016 | Tagged: VBA->JS, Web Add-ins, Word 2013, Word 2016 |
Permalink
Posted by WordMeister
August 10, 2015
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 »
2 Comments |
Tools, Web Add-ins, Word 2013 | Tagged: Web Add-ins, Word 2013 |
Permalink
Posted by WordMeister
August 9, 2015
As is often the case with code samples, error-handling is omitted for the sake of clarity and space. But serious code requires, of course, error handling, no matter which programming language is used.
VBA is old, comparatively speaking, and classic VB, upon which it was built, even older. We’re all familiar with On Error GoTo [label]
, On Error Resume Next
and related commands.
More recent programming languages use a different pattern, generally known as “try…catch”. The .NET Framework languages use it (although VB.NET can still work with On Error
) and it’s become a widely accepted standard. This is the basic pattern in synchronous JavaScript, as well. Read the rest of this entry »
No Comments » |
Concept, Syntax, VBA->JS | Tagged: VBA->JS |
Permalink
Posted by WordMeister
August 4, 2015
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 »
No Comments » |
Web Add-ins, Word 2013, Word 2016 | Tagged: Web Add-ins, Word 2013, Word 2016 |
Permalink
Posted by WordMeister
July 31, 2015
As you’ve seen from the discussions about JavaScript and creating the “Hello World” Web Add-in sample, working with non-proprietary programming languages, such as JavaScript, does have at least one advantage: You’re not locked into any particular software to write your code. In order to create VBA code you need the VBA editor, running in an Office application. JavaScript, HTML and CSS can be typed anywhere.
On the other hand, an editor with Intellisense and automatic formatting can save wear-and-tear on your fingers and your nerves! So this post will show you how to write Web Add-ins in a free version of Visual Studio. Read the rest of this entry »
No Comments » |
Web Add-ins | Tagged: Web Add-ins |
Permalink
Posted by WordMeister
July 30, 2015
I hope you’re not feeling too intimidated and have been able to create and load the “Hello World” sample…
This post takes a closer look at the JavaScript part of the sample. The discussion is in two parts: First, how JavaScript is linked into the HTML page; then, the JavaScript code with the main focus on the Office JS API. Read the rest of this entry »
3 Comments |
General, Web Add-ins | Tagged: Web Add-ins |
Permalink
Posted by WordMeister
July 28, 2015
My discussion of Web Add-ins will center on Word, since that’s “where I live”. The information on the basics is certainly relevant to other Office applications (Excel and PowerPoint) if the Web Add-in is hosted in a Task Pane – the only kind of Web Add-in Word supports.
So, what all is involved in creating a Web Add-in? Unfortunately, it’s not only JavaScript and the Office JavaScript APIs – that’s just the programming language and object model. At least some knowledge of HTML is required and familiarity with CSS is an advantage. Read the rest of this entry »
2 Comments |
Web Add-ins | Tagged: Web Add-ins |
Permalink
Posted by WordMeister