Skip to content

Commit e9449db

Browse files
AlexJerabekgithub-actions
andauthored
Automatically generated docs (#2315)
Co-authored-by: github-actions <[email protected]>
1 parent 4f1e7a4 commit e9449db

File tree

62 files changed

+3072
-4
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+3072
-4
lines changed

docs/docs-ref-autogen/excel/excel/excel.chartdatalabel.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,56 @@ remarks: >-
88
\[ [API set: ExcelApi
99
1.7](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]
1010
11+
12+
#### Examples
13+
14+
15+
```TypeScript
16+
17+
// Link to full sample:
18+
https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/10-chart/chart-data-labels.yaml
19+
20+
21+
// This function styles substrings within data label text using font
22+
formatting.
23+
24+
await Excel.run(async (context) => {
25+
const sheet = context.workbook.worksheets.getItem(sheetName);
26+
const chart = sheet.charts.getItemAt(0);
27+
await context.sync();
28+
29+
const series = chart.series.getItemAt(0);
30+
series.load("points");
31+
await context.sync();
32+
33+
series.points.load("items");
34+
await context.sync();
35+
36+
// Style a substring in the first data label.
37+
let searchString = "sports";
38+
let dataLabel = series.points.getItemAt(dataLabelInfo[0].index).dataLabel.load("text");
39+
await context.sync();
40+
let substringStart = dataLabel.text.indexOf(searchString);
41+
let subLabel = dataLabel.getSubstring(substringStart, searchString.length);
42+
subLabel.font.size = 13;
43+
subLabel.font.bold = true;
44+
45+
// Style a substring in the second data label.
46+
searchString = "'Titanic'";
47+
dataLabel = series.points.getItemAt(dataLabelInfo[1].index).dataLabel.load("text");
48+
await context.sync();
49+
50+
substringStart = dataLabel.text.indexOf(searchString);
51+
subLabel = dataLabel.getSubstring(substringStart, searchString.length);
52+
subLabel.font.name = "Calibri";
53+
subLabel.font.size = 13;
54+
subLabel.font.italic = true;
55+
subLabel.font.color = "blue";
56+
await context.sync();
57+
});
58+
59+
```
60+
1161
isPreview: false
1262
isDeprecated: false
1363
type: class

docs/docs-ref-autogen/excel/excel/excel.chartpoint.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,55 @@ remarks: >-
88
\[ [API set: ExcelApi
99
1.1](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]
1010
11+
12+
#### Examples
13+
14+
15+
```TypeScript
16+
17+
// Link to full sample:
18+
https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/10-chart/chart-data-labels.yaml
19+
20+
21+
// This function adds data labels to specific chart points
22+
23+
// and sets their text and position.
24+
25+
await Excel.run(async (context) => {
26+
const sheet = context.workbook.worksheets.getItem(sheetName);
27+
const chart = sheet.charts.getItemAt(0);
28+
await context.sync();
29+
30+
const series = chart.series.getItemAt(0);
31+
series.points.load("dataLabel");
32+
await context.sync();
33+
34+
// Define properties for data label positioning and shape.
35+
const labelProperties = [
36+
{
37+
top: 70,
38+
geometricShapeType: Excel.GeometricShapeType.rectangle
39+
},
40+
{
41+
top: 200,
42+
geometricShapeType: Excel.GeometricShapeType.rectangle
43+
}
44+
];
45+
46+
// Add data labels to specific chart points and set their text and properties.
47+
for (let i = 0; i < dataLabelInfo.length; i++) {
48+
const point = series.points.getItemAt(dataLabelInfo[i].index);
49+
point.hasDataLabel = true;
50+
51+
const dataLabel = point.dataLabel;
52+
dataLabel.text = dataLabelInfo[i].news;
53+
dataLabel.set(labelProperties[i]);
54+
}
55+
await context.sync();
56+
});
57+
58+
```
59+
1160
isPreview: false
1261
isDeprecated: false
1362
type: class

docs/docs-ref-autogen/excel/excel/excel.chartpointscollection.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,55 @@ remarks: >-
88
\[ [API set: ExcelApi
99
1.1](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]
1010
11+
12+
#### Examples
13+
14+
15+
```TypeScript
16+
17+
// Link to full sample:
18+
https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/10-chart/chart-data-labels.yaml
19+
20+
21+
// This function adds data labels to specific chart points
22+
23+
// and sets their text and position.
24+
25+
await Excel.run(async (context) => {
26+
const sheet = context.workbook.worksheets.getItem(sheetName);
27+
const chart = sheet.charts.getItemAt(0);
28+
await context.sync();
29+
30+
const series = chart.series.getItemAt(0);
31+
series.points.load("dataLabel");
32+
await context.sync();
33+
34+
// Define properties for data label positioning and shape.
35+
const labelProperties = [
36+
{
37+
top: 70,
38+
geometricShapeType: Excel.GeometricShapeType.rectangle
39+
},
40+
{
41+
top: 200,
42+
geometricShapeType: Excel.GeometricShapeType.rectangle
43+
}
44+
];
45+
46+
// Add data labels to specific chart points and set their text and properties.
47+
for (let i = 0; i < dataLabelInfo.length; i++) {
48+
const point = series.points.getItemAt(dataLabelInfo[i].index);
49+
point.hasDataLabel = true;
50+
51+
const dataLabel = point.dataLabel;
52+
dataLabel.text = dataLabelInfo[i].news;
53+
dataLabel.set(labelProperties[i]);
54+
}
55+
await context.sync();
56+
});
57+
58+
```
59+
1160
isPreview: false
1261
isDeprecated: false
1362
type: class

docs/docs-ref-autogen/excel/excel/excel.workbook.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -942,6 +942,41 @@ methods:
942942
1.19](/javascript/api/requirement-sets/excel/excel-api-requirement-sets)
943943
\]
944944
945+
946+
#### Examples
947+
948+
949+
```TypeScript
950+
951+
// Link to full sample:
952+
https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/44-shape/shape-get-active.yaml
953+
954+
955+
// This method gets the active shape and displays it as an image in the
956+
task pane.
957+
958+
await Excel.run(async (context) => {
959+
// Get the currently active shape, if any.
960+
const activeShape = context.workbook.getActiveShapeOrNullObject();
961+
962+
if (activeShape) {
963+
// Convert the active shape to an image.
964+
const shapeImage = activeShape.getAsImage(Excel.PictureFormat.png);
965+
await context.sync();
966+
967+
// Display the image in the task pane.
968+
const imageContainer = document.getElementById("image");
969+
imageContainer.innerHTML = ''; // Clear the container before adding a new image.
970+
const imageElement = document.createElement("img");
971+
imageElement.src = "data:image/png;base64," + shapeImage.value;
972+
imageContainer.appendChild(imageElement);
973+
} else {
974+
console.log("No active shape");
975+
}
976+
});
977+
978+
```
979+
945980
isPreview: false
946981
isDeprecated: false
947982
syntax:

docs/docs-ref-autogen/excel_1_1/excel/excel.chartpoint.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,55 @@ remarks: >-
88
\[ [API set: ExcelApi
99
1.1](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]
1010
11+
12+
#### Examples
13+
14+
15+
```TypeScript
16+
17+
// Link to full sample:
18+
https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/10-chart/chart-data-labels.yaml
19+
20+
21+
// This function adds data labels to specific chart points
22+
23+
// and sets their text and position.
24+
25+
await Excel.run(async (context) => {
26+
const sheet = context.workbook.worksheets.getItem(sheetName);
27+
const chart = sheet.charts.getItemAt(0);
28+
await context.sync();
29+
30+
const series = chart.series.getItemAt(0);
31+
series.points.load("dataLabel");
32+
await context.sync();
33+
34+
// Define properties for data label positioning and shape.
35+
const labelProperties = [
36+
{
37+
top: 70,
38+
geometricShapeType: Excel.GeometricShapeType.rectangle
39+
},
40+
{
41+
top: 200,
42+
geometricShapeType: Excel.GeometricShapeType.rectangle
43+
}
44+
];
45+
46+
// Add data labels to specific chart points and set their text and properties.
47+
for (let i = 0; i < dataLabelInfo.length; i++) {
48+
const point = series.points.getItemAt(dataLabelInfo[i].index);
49+
point.hasDataLabel = true;
50+
51+
const dataLabel = point.dataLabel;
52+
dataLabel.text = dataLabelInfo[i].news;
53+
dataLabel.set(labelProperties[i]);
54+
}
55+
await context.sync();
56+
});
57+
58+
```
59+
1160
isPreview: false
1261
isDeprecated: false
1362
type: class

docs/docs-ref-autogen/excel_1_1/excel/excel.chartpointscollection.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,55 @@ remarks: >-
88
\[ [API set: ExcelApi
99
1.1](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]
1010
11+
12+
#### Examples
13+
14+
15+
```TypeScript
16+
17+
// Link to full sample:
18+
https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/10-chart/chart-data-labels.yaml
19+
20+
21+
// This function adds data labels to specific chart points
22+
23+
// and sets their text and position.
24+
25+
await Excel.run(async (context) => {
26+
const sheet = context.workbook.worksheets.getItem(sheetName);
27+
const chart = sheet.charts.getItemAt(0);
28+
await context.sync();
29+
30+
const series = chart.series.getItemAt(0);
31+
series.points.load("dataLabel");
32+
await context.sync();
33+
34+
// Define properties for data label positioning and shape.
35+
const labelProperties = [
36+
{
37+
top: 70,
38+
geometricShapeType: Excel.GeometricShapeType.rectangle
39+
},
40+
{
41+
top: 200,
42+
geometricShapeType: Excel.GeometricShapeType.rectangle
43+
}
44+
];
45+
46+
// Add data labels to specific chart points and set their text and properties.
47+
for (let i = 0; i < dataLabelInfo.length; i++) {
48+
const point = series.points.getItemAt(dataLabelInfo[i].index);
49+
point.hasDataLabel = true;
50+
51+
const dataLabel = point.dataLabel;
52+
dataLabel.text = dataLabelInfo[i].news;
53+
dataLabel.set(labelProperties[i]);
54+
}
55+
await context.sync();
56+
});
57+
58+
```
59+
1160
isPreview: false
1261
isDeprecated: false
1362
type: class

docs/docs-ref-autogen/excel_1_10/excel/excel.chartdatalabel.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,56 @@ remarks: >-
88
\[ [API set: ExcelApi
99
1.7](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]
1010
11+
12+
#### Examples
13+
14+
15+
```TypeScript
16+
17+
// Link to full sample:
18+
https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/10-chart/chart-data-labels.yaml
19+
20+
21+
// This function styles substrings within data label text using font
22+
formatting.
23+
24+
await Excel.run(async (context) => {
25+
const sheet = context.workbook.worksheets.getItem(sheetName);
26+
const chart = sheet.charts.getItemAt(0);
27+
await context.sync();
28+
29+
const series = chart.series.getItemAt(0);
30+
series.load("points");
31+
await context.sync();
32+
33+
series.points.load("items");
34+
await context.sync();
35+
36+
// Style a substring in the first data label.
37+
let searchString = "sports";
38+
let dataLabel = series.points.getItemAt(dataLabelInfo[0].index).dataLabel.load("text");
39+
await context.sync();
40+
let substringStart = dataLabel.text.indexOf(searchString);
41+
let subLabel = dataLabel.getSubstring(substringStart, searchString.length);
42+
subLabel.font.size = 13;
43+
subLabel.font.bold = true;
44+
45+
// Style a substring in the second data label.
46+
searchString = "'Titanic'";
47+
dataLabel = series.points.getItemAt(dataLabelInfo[1].index).dataLabel.load("text");
48+
await context.sync();
49+
50+
substringStart = dataLabel.text.indexOf(searchString);
51+
subLabel = dataLabel.getSubstring(substringStart, searchString.length);
52+
subLabel.font.name = "Calibri";
53+
subLabel.font.size = 13;
54+
subLabel.font.italic = true;
55+
subLabel.font.color = "blue";
56+
await context.sync();
57+
});
58+
59+
```
60+
1161
isPreview: false
1262
isDeprecated: false
1363
type: class

0 commit comments

Comments
 (0)