Giter Site home page Giter Site logo

office-add-in-javascript-filedownload's Introduction

[ARCHIVED] Download files in a Word Web Add-in

Note: This repo is archived and no longer actively maintained. Security vulnerabilities may exist in the project, or its dependencies. If you plan to reuse or run any code from this repo, be sure to perform appropriate security checks on the code or dependencies first. Do not use this project as the starting point of a production Office Add-in. Always start your production code by using the Office/SharePoint development workload in Visual Studio, or the Yeoman generator for Office Add-ins, and follow security best practices as you develop the add-in.

This code sample teaches you the different techniques for downloading files programmatically in an Office Add-in. Different Office hosts and browsers (when using Office Online) may handle files differently. If you'd like to provide a uniform file download experience, use the techniques demonstrated in this code sample. This code sample also shows you how you can provide a fallback mechanism if the Office host or browser does not support one of the other methods.

Table of Contents

Change History

November 3, 2016:

  • Initial version.

Prerequisites

  • Word 2016 for Windows (build 16.0.6727.1000 or later), Word Online, or Word for Mac (build 15.26 or later).
  • Visual Studio 2015

Design templates used in this add-in

  • Landing page

For more information about the design patterns, see UX design pattern templates for Office Add-ins. And for sample implementations, see Office-Add-in-UX-Design-Patterns-Code.

Get the FileSaver library

This code sample uses the FileSaver.js library. Take the following steps after you have cloned this repo.

  1. Clone the FileSaver.js repo.
  2. Copy the FileSaver.min.js file to the Scripts folder of this code sample.
  3. In Home.html, add a script tag to reference the FileSaver.min.js file.

Run the project

  1. Open the Visual Studio solution file.
  2. Press F5.
  3. When Word opens, click the File download button on the right end of the Home ribbon. The add-in opens in a task pane.
  4. Choose the Download file or Insert download link buttons.

Questions and comments

We'd love to get your feedback about this sample. You can send your feedback to us in the Issues section of this repository.

Questions about Microsoft Office 365 development in general should be posted to Stack Overflow. If your question is about the Office JavaScript APIs, make sure that your questions are tagged with [office-js] and [API].

Additional resources

Copyright

Copyright (c) 2016 Microsoft Corporation. All rights reserved.

This project has adopted the Microsoft Open Source Code of Conduct. For more information, see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

office-add-in-javascript-filedownload's People

Contributors

davidchesnut avatar lindalu-msft avatar o365devx avatar officegsx avatar reezaali avatar rick-kirkham avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

office-add-in-javascript-filedownload's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.