Visual Studio automatically launches the target Office application for debugging, but using other tools means we need to side-load our Add-in. In this video we'll look at the side-loading process.
- [Instructor] Now there's a bit of behavior you get in this Starter Add-in. We've got a run button down here, so if I type some text here, and select it, you see when I click on run, it makes it turn red, so let's see how that works. I can navigate to this file index dot t s, this is a Type Script file, so Type Script is a version of Java Script really that, has a lot of the future capabilities of the Java Script language, but makes it available now by compiling into native Java Script, from the Type Script language, and we can see here some extra features, of language features that we don't have in Java Script, currently widely supported version of Java Script, such as on line 18, we have the async function, and there's an await on line 31, so async await.
You may remember that we used a slightly different asynchronous pattern in the code we used earlier in the course, and also, on line 19, I've got a lambda expression, this is also a feature that will probably come to Java Script in a later version, but it's not widely supported, so we can use it in Type Script, and Type Script is really a great language for people who are used to a classical language, like Sea Shop or Sea Plus Plus or Java, and classes are supported, they will eventually come to the Java Script language, but they're available now in Type Script.
Now this is Type Script. We're going to look at Type Script in a second, and what it does is it gets the range of the current selection and changes its color to red. Now, let's change that. I have a bit of code that I've got, and I'm gonna paste it in here, in my paste buffer. I'll replace that with some code that's going to insert some text into the document, and we'll talk some more about these different APIs, later, and this is really interesting, because as soon as I save that, if I go back to my Power Show window, it was too quick to see, but it automatically went and recompiled everything so if I go back to the browser, where I've got the Add-in running, and I click on run, and you can see that that's brought in our text, including the typo, so let's fix that, we can either fix it in Word, usually Auto Correct, or I can just go into here, and probably want to change it in the source file, and I'm gonna save that again, control has to save, and then back to the browser.
Now, that text is already been written out, so that's done, but I can run this again, and it'll write a fresh sort of text without the typo. Now, if I go back to Visual Studio Code, you'll see that I've got IntelliSense here, so as I'm typing, I get a list of options, so this is because we're using Type Script, which we're going to talk about in the next section, so any changes that are detected, it automatically reloads, and another thing I wanted to talk about, was that we're using the Word styles here, so when we created these paragraphs, we used the Word Style heading one Word style normal, so we'll have a look at another way of generating that as well using HTML, so it's not using embedded HTML, it's using Word's own style language, but there is actually a way of using HTML, and we'll look at that later, but it would be quite nice wouldn't it, to be able to use your web skills in building the word add-ins as well.
We can also see this in the desktop version of Word, but it's a little bit more complicated to set up, sideloading add-ins to the web, is probably the most useful way for testing purposes, because it's supported in all of the different Office applications. We'll talk about sideloading for desktop versions of the applications later in this course.
- How Office extensions work
- Using the Office.js libraries
- Working with ScriptLab
- Creating an add-in with Visual Studio
- Working with manifests and commands
- Deploying and debugging add-ins
- Developing new add-in controls
- Working with Yeoman, Angular, and React
- Sideloading add-ins to different locations
- Guidelines for designing add-ins
- Using Office application APIs
- Publishing and licensing add-ins