OfficeDev/Excel-Add-in-JavaScript-SalesTracker

Name: Excel-Add-in-JavaScript-SalesTracker

Owner: Office Developer

Description: Display data in Excel tables and charts, and programmatically change the formatting of tables and charts.

Created: 2016-09-26 21:05:38.0

Updated: 2018-05-20 07:44:07.0

Pushed: 2018-01-31 20:32:18.0

Homepage:

Size: 150

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Excel Web Add-in for Manipulating Table and Chart Formatting

Learn how to programmatically format tables and charts, and how to import data to a spreadsheet, in Excel Web Add-ins. Compare with how these tasks are done in the Tables and Charts VSTO Add-in. This Excel web add-in also shows how to use the design samples from Office Add-in UX Design Patterns Code.

Table of Contents
Change History

November 2, 2016:

Prerequisites
Design templates used in this add-in

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 PickADate library

The Office Fabric date picker control has a dependency on the PickADate library. Take the following steps after you have downloaded this sample.

  1. Download version 3.5.3 of the library from pickadate.js.
  2. Unzip the package and navigate to the \pickadate.js-3.5.3\lib folder.
  3. Copy all the files and folders in that folder, except the compressed and themes-source folders, to the project folder: SalesTrackerWeb\Scripts\PickADate.
Run the project
  1. Open the Visual Studio solution file.
  2. Press F5.
  3. When Excel opens, click the Track sales button on the right end of the Home ribbon. The add-in opens in a task pane.
Import data
  1. On the Home page, enter one of the following product names (case sensitive) in the Product name box: Keyboard, Mouse, Monitor, Laptop,
  2. Use the date picker control to pick a date no later than September 16th, 2016, because there are no sales after this date in the sample data.
  3. Select the Get sales data button. After a few seconds, the workbook will switch focus to a new Sales worksheet.
Change table settings
  1. Select Table on the tab bar.
  2. Deselect radio buttons as needed, to hide the corresponding columns.
  3. Select a color for the table.
Change chart settings
  1. Select Chart on the tab bar.
  2. Select a data source for the chart.
  3. Select a chart type.
  4. Select a chart color theme.
Compare this Excel web add-in code with the VSTO add-in sample

The code that uses the Office and Word JavaScript APIs is in Home.js and Helpers.js. All of the styling is done with HTML5 and the stylesheet files: settings.css, tab.bar.css and several Office Fabric css files.

Compare this code with the code in Tables and Charts. Note the following:

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 opencode@microsoft.com with any additional questions or comments.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.