Skip to content

[excel, powerpoint] (Create Workbook/Presentation) Update code samples #1283

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/excel/excel-add-ins-shapes.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Work with shapes using the Excel JavaScript API
description: ''
ms.date: 07/19/2019
ms.date: 09/03/2019
localization_priority: Normal
---

Expand Down Expand Up @@ -57,8 +57,8 @@ var reader = new FileReader();

reader.onload = (event) => {
Excel.run(function (context) {
var startIndex = event.target.result.indexOf("base64,");
var myBase64 = event.target.result.substr(startIndex + 7);
var startIndex = reader.result.toString().indexOf("base64,");
var myBase64 = reader.result.toString().substr(startIndex + 7);
var sheet = context.workbook.worksheets.getItem("MyWorksheet");
var image = sheet.shapes.addImage(myBase64);
image.name = "Image";
Expand Down
10 changes: 5 additions & 5 deletions docs/excel/excel-add-ins-workbooks.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Work with workbooks using the Excel JavaScript API
description: ''
ms.date: 05/01/2019
ms.date: 09/03/2019
localization_priority: Priority
---

Expand Down Expand Up @@ -55,8 +55,8 @@ var reader = new FileReader();
reader.onload = (function (event) {
Excel.run(function (context) {
// strip off the metadata before the base64-encoded string
var startIndex = event.target.result.indexOf("base64,");
var workbookContents = event.target.result.substr(startIndex + 7);
var startIndex = reader.result.toString().indexOf("base64,");
var workbookContents = reader.result.toString().substr(startIndex + 7);

Excel.createWorkbook(workbookContents);
return context.sync();
Expand Down Expand Up @@ -87,8 +87,8 @@ var reader = new FileReader();
reader.onload = (event) => {
Excel.run((context) => {
// strip off the metadata before the base64-encoded string
var startIndex = event.target.result.indexOf("base64,");
var workbookContents = event.target.result.substr(startIndex + 7);
var startIndex = reader.result.toString().indexOf("base64,");
var workbookContents = reader.result.toString().substr(startIndex + 7);

var sheets = context.workbook.worksheets;
sheets.addFromBase64(
Expand Down
8 changes: 4 additions & 4 deletions docs/powerpoint/powerpoint-add-ins.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: PowerPoint add-ins
description: ''
ms.date: 07/05/2019
ms.date: 09/03/2019
ms.topic: overview
scenarios: getting-started
localization_priority: Priority
Expand Down Expand Up @@ -177,8 +177,8 @@ var reader = new FileReader();

reader.onload = function (event) {
// strip off the metadata before the base64-encoded string
var startIndex = event.target.result.indexOf("base64,");
var copyBase64 = event.target.result.substr(startIndex + 7);
var startIndex = reader.result.toString().indexOf("base64,");
var copyBase64 = reader.result.toString().substr(startIndex + 7);

PowerPoint.createPresentation(copyBase64);
};
Expand All @@ -194,4 +194,4 @@ reader.readAsDataURL(myFile.files[0]);
- [How to save add-in state and settings per document for content and task pane add-ins](../develop/persisting-add-in-state-and-settings.md#how-to-save-add-in-state-and-settings-per-document-for-content-and-task-pane-add-ins)
- [Read and write data to the active selection in a document or spreadsheet](../develop/read-and-write-data-to-the-active-selection-in-a-document-or-spreadsheet.md)
- [Get the whole document from an add-in for PowerPoint or Word](../powerpoint/get-the-whole-document-from-an-add-in-for-powerpoint.md)
- [Use document themes in your PowerPoint add-ins](use-document-themes-in-your-powerpoint-add-ins.md)
- [Use document themes in your PowerPoint add-ins](use-document-themes-in-your-powerpoint-add-ins.md)