Skip to content

Commit bfa882f

Browse files
committed
add ribbon button that opens the taskpane
1 parent f4e1291 commit bfa882f

File tree

4 files changed

+90
-4
lines changed

4 files changed

+90
-4
lines changed

manifest.xml

Lines changed: 52 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,66 @@
2020
</DefaultSettings>
2121
<Permissions>ReadWriteDocument</Permissions>
2222
<VersionOverrides xmlns="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="VersionOverridesV1_0">
23+
<Hosts>
24+
<Host xsi:type="Workbook">
25+
<DesktopFormFactor>
26+
<GetStarted>
27+
<Title resid="Contoso.GetStarted.Title"/>
28+
<Description resid="Contoso.GetStarted.Description"/>
29+
<LearnMoreUrl resid="Contoso.GetStarted.LearnMoreUrl"/>
30+
</GetStarted>
31+
<FunctionFile resid="Contoso.Ribbon.Url" />
32+
<ExtensionPoint xsi:type="PrimaryCommandSurface">
33+
<OfficeTab id="TabHome">
34+
<Group id="Contoso.Group1">
35+
<Label resid="Contoso.Group1Label" />
36+
<Icon>
37+
<bt:Image size="16" resid="Contoso.tpicon_16x16" />
38+
<bt:Image size="32" resid="Contoso.tpicon_32x32" />
39+
<bt:Image size="80" resid="Contoso.tpicon_80x80" />
40+
</Icon>
41+
<Control xsi:type="Button" id="Contoso.TaskpaneButton">
42+
<Label resid="Contoso.TaskpaneButton.Label" />
43+
<Supertip>
44+
<Title resid="Contoso.TaskpaneButton.Label" />
45+
<Description resid="Contoso.TaskpaneButton.Tooltip" />
46+
</Supertip>
47+
<Icon>
48+
<bt:Image size="16" resid="Contoso.tpicon_16x16" />
49+
<bt:Image size="32" resid="Contoso.tpicon_32x32" />
50+
<bt:Image size="80" resid="Contoso.tpicon_80x80" />
51+
</Icon>
52+
<Action xsi:type="ShowTaskpane">
53+
<TaskpaneId>ButtonId1</TaskpaneId>
54+
<SourceLocation resid="Contoso.Taskpane.Url" />
55+
</Action>
56+
</Control>
57+
</Group>
58+
</OfficeTab>
59+
</ExtensionPoint>
60+
</DesktopFormFactor>
61+
</Host>
62+
</Hosts>
2363
<Resources>
2464
<bt:Images>
2565
<bt:Image id="Contoso.tpicon_16x16" DefaultValue="https://localhost:3000/assets/icon-16.png"/>
2666
<bt:Image id="Contoso.tpicon_32x32" DefaultValue="https://localhost:3000/assets/icon-32.png"/>
2767
<bt:Image id="Contoso.tpicon_80x80" DefaultValue="https://localhost:3000/assets/icon-80.png"/>
2868
</bt:Images>
2969
<bt:Urls>
30-
<bt:Url id="Contoso.Taskpane.Url" DefaultValue="https://localhost:3000/taskpane.html"/>
70+
<bt:Url id="Contoso.GetStarted.LearnMoreUrl" DefaultValue="https://go.microsoft.com/fwlink/?LinkId=276812" />
71+
<bt:Url id="Contoso.Ribbon.Url" DefaultValue="https://localhost:3000/ribbon.html" />
72+
<bt:Url id="Contoso.Taskpane.Url" DefaultValue="https://localhost:3000/taskpane.html" />
3173
</bt:Urls>
32-
<bt:ShortStrings>&#xD;
33-
</bt:ShortStrings>
74+
<bt:ShortStrings>
75+
<bt:String id="Contoso.GetStarted.Title" DefaultValue="Get started with your sample add-in!" />
76+
<bt:String id="Contoso.Group1Label" DefaultValue="Commands Group" />
77+
<bt:String id="Contoso.TaskpaneButton.Label" DefaultValue="Show Taskpane" />
78+
</bt:ShortStrings>
79+
<bt:LongStrings>
80+
<bt:String id="Contoso.GetStarted.Description" DefaultValue="Your sample add-in loaded succesfully. Go to the HOME tab and click the 'Show Taskpane' button to get started." />
81+
<bt:String id="Contoso.TaskpaneButton.Tooltip" DefaultValue="Click to Show a Taskpane" />
82+
</bt:LongStrings>
3483
</Resources>
3584
</VersionOverrides>
3685
</OfficeApp>

src/ribbon/ribbon.html

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!-- Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license in root of repo. -->
2+
3+
<!DOCTYPE html>
4+
<html>
5+
6+
<head>
7+
<meta charset="UTF-8" />
8+
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
9+
10+
<!-- Office JavaScript API -->
11+
<script type="text/javascript" src="https://appsforoffice.microsoft.com/lib/1.1/hosted/office.debug.js"></script>
12+
</head>
13+
14+
<body>
15+
16+
</body>
17+
18+
</html>

src/ribbon/ribbon.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
* Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
3+
* See LICENSE in the project root for license information.
4+
*/
5+
6+
(() => {
7+
// The initialize function must be run each time a new page is loaded
8+
Office.initialize = () => {
9+
10+
};
11+
12+
// Add any ui-less function here
13+
})();

webpack.config.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ module.exports = (env, options) => {
99
const config = {
1010
devtool: "source-map",
1111
entry: {
12-
taskpane: "./src/taskpane/taskpane.ts"
12+
taskpane: "./src/taskpane/taskpane.ts",
13+
ribbon: "./src/ribbon/ribbon.ts"
1314
},
1415
resolve: {
1516
extensions: [".ts", ".tsx", ".html", ".js"]
@@ -39,6 +40,11 @@ module.exports = (env, options) => {
3940
template: "./src/taskpane/taskpane.html",
4041
chunks: ["taskpane"]
4142
}),
43+
new HtmlWebpackPlugin({
44+
filename: "ribbon.html",
45+
template: "./src/ribbon/ribbon.html",
46+
chunks: ["ribbon"]
47+
}),
4248
new webpack.ProvidePlugin({
4349
Promise: ["es6-promise", "Promise"]
4450
})

0 commit comments

Comments
 (0)