Skip to content

Commit 27659c5

Browse files
authored
Merge pull request #71 from akrantz/office-js-types
add @types/office-js to package.json; fix indentation
2 parents 16cadba + d77b4b4 commit 27659c5

File tree

3 files changed

+36
-30
lines changed

3 files changed

+36
-30
lines changed

package-lock.json

Lines changed: 11 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"@types/es6-promise": "0.0.32",
3232
"@types/flux": "^3.1.0",
3333
"@types/jquery": "^3.3.22",
34+
"@types/office-js": "0.0.138",
3435
"@types/office-runtime": "^1.0.1",
3536
"clean-webpack-plugin": "^1.0.0",
3637
"copy-webpack-plugin": "^4.6.0",

src/taskpane/taskpane.ts

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,38 +3,37 @@
33
* See LICENSE in the project root for license information.
44
*/
55

6-
import * as OfficeHelpers from '@microsoft/office-js-helpers';
6+
import * as OfficeHelpers from "@microsoft/office-js-helpers";
77

88
$(document).ready(() => {
9-
$('#run').click(run);
9+
$("#run").click(run);
1010
});
1111

1212
// The initialize function must be run each time a new page is loaded
13-
Office.initialize = (reason) => {
14-
$('#sideload-msg').hide();
15-
$('#app-body').show();
13+
Office.initialize = () => {
14+
$("#sideload-msg").hide();
15+
$("#app-body").show();
1616
};
1717

1818
async function run() {
1919
try {
20-
await Excel.run(async context => {
21-
/**
22-
* Insert your Excel code here
23-
*/
24-
const range = context.workbook.getSelectedRange();
25-
26-
// Read the range address
27-
range.load('address');
28-
29-
// Update the fill color
30-
range.format.fill.color = 'yellow';
31-
32-
await context.sync();
33-
console.log(`The range address was ${range.address}.`);
34-
});
35-
} catch(error) {
36-
OfficeHelpers.UI.notify(error);
37-
OfficeHelpers.Utilities.log(error);
38-
};
20+
await Excel.run(async context => {
21+
/**
22+
* Insert your Excel code here
23+
*/
24+
const range = context.workbook.getSelectedRange();
25+
26+
// Read the range address
27+
range.load("address");
28+
29+
// Update the fill color
30+
range.format.fill.color = "yellow";
31+
32+
await context.sync();
33+
console.log(`The range address was ${range.address}.`);
34+
});
35+
} catch (error) {
36+
OfficeHelpers.UI.notify(error);
37+
OfficeHelpers.Utilities.log(error);
38+
}
3939
}
40-

0 commit comments

Comments
 (0)