You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[admin] (Style) Standardize Base64 as a proper noun (#5195)
* Standardize Base64 as a propoer noun
* Update docs/outlook/validate-an-identity-token.md
Co-authored-by: Elizabeth Samuel <[email protected]>
---------
Co-authored-by: Elizabeth Samuel <[email protected]>
Copy file name to clipboardExpand all lines: docs/develop/support-for-task-pane-and-content-add-ins.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -88,7 +88,7 @@ For more details and examples, see [Bind to regions in a document or spreadsheet
88
88
89
89
If your task pane add-in runs in PowerPoint or Word, you can use the [Document.getFileAsync](/javascript/api/office/office.document#office-office-document-getfileasync-member(1)), [File.getSliceAsync](/javascript/api/office/office.file#office-office-file-getsliceasync-member(1)), and [File.closeAsync](/javascript/api/office/office.file#office-office-file-closeasync-member(1)) methods to get an entire presentation or document.
90
90
91
-
When you call `Document.getFileAsync` you get a copy of the document in a [File](/javascript/api/office/office.file) object. The `File` object provides access to the document in "chunks" represented as [Slice](/javascript/api/office/office.slice) objects. When you call `getFileAsync`, you can specify the file type (text or compressed Open Office XML format), and size of the slices (up to 4MB). To access the contents of the `File` object, you then call `File.getSliceAsync` which returns the raw data in the [Slice.data](/javascript/api/office/office.slice#office-office-slice-data-member) property. If you specified compressed format, you will get the file data as a byte array. If you are transmitting the file to a web service, you can transform the compressed raw data to a base64-encoded string before submission. Finally, when you are finished getting slices of the file, use the `File.closeAsync` method to close the document.
91
+
When you call `Document.getFileAsync` you get a copy of the document in a [File](/javascript/api/office/office.file) object. The `File` object provides access to the document in "chunks" represented as [Slice](/javascript/api/office/office.slice) objects. When you call `getFileAsync`, you can specify the file type (text or compressed Open Office XML format), and size of the slices (up to 4MB). To access the contents of the `File` object, you then call `File.getSliceAsync` which returns the raw data in the [Slice.data](/javascript/api/office/office.slice#office-office-slice-data-member) property. If you specified compressed format, you will get the file data as a byte array. If you are transmitting the file to a web service, you can transform the compressed raw data to a Base64-encoded string before submission. Finally, when you are finished getting slices of the file, use the `File.closeAsync` method to close the document.
92
92
93
93
For more details, see how to [get the whole document from an add-in for PowerPoint or Word](../word/get-the-whole-document-from-an-add-in-for-word.md).
Copy file name to clipboardExpand all lines: docs/excel/excel-add-ins-charts.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -227,7 +227,7 @@ The following screenshot shows the data table that the preceding code sample cre
227
227
228
228
## Export a chart as an image
229
229
230
-
Charts can be rendered as images outside of Excel. `Chart.getImage` returns the chart as a base64-encoded string representing the chart as a JPEG image. The following code shows how to get the image string and log it to the console.
230
+
Charts can be rendered as images outside of Excel. `Chart.getImage` returns the chart as a Base64-encoded string representing the chart as a JPEG image. The following code shows how to get the image string and log it to the console.
JPEG, PNG, and SVG images can be inserted into a worksheet as shapes. The `ShapeCollection.addImage` method takes a base64-encoded string as an argument. This is either a JPEG or PNG image in string form. `ShapeCollection.addSvg` also takes in a string, though this argument is XML that defines the graphic.
54
+
JPEG, PNG, and SVG images can be inserted into a worksheet as shapes. The `ShapeCollection.addImage` method takes a Base64-encoded string as an argument. This is either a JPEG or PNG image in string form. `ShapeCollection.addSvg` also takes in a string, though this argument is XML that defines the graphic.
55
55
56
56
The following code sample shows an image file being loaded by a [FileReader](https://developer.mozilla.org/docs/Web/API/FileReader) as a string. The string has the metadata "base64," removed before the shape is created.
Any `Shape` object can be converted to an image. [Shape.getAsImage](/javascript/api/excel/excel.shape#excel-excel-shape-getasimage-member(1)) returns base64-encoded string. The image's format is specified as a [PictureFormat](/javascript/api/excel/excel.pictureformat) enum passed to `getAsImage`.
240
+
Any `Shape` object can be converted to an image. [Shape.getAsImage](/javascript/api/excel/excel.shape#excel-excel-shape-getasimage-member(1)) returns Base64-encoded string. The image's format is specified as a [PictureFormat](/javascript/api/excel/excel.pictureformat) enum passed to `getAsImage`.
Copy file name to clipboardExpand all lines: docs/excel/excel-add-ins-workbooks.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,9 +43,9 @@ Your add-in can create a new workbook, separate from the Excel instance in which
43
43
Excel.createWorkbook();
44
44
```
45
45
46
-
The `createWorkbook` method can also create a copy of an existing workbook. The method accepts a base64-encoded string representation of an .xlsx file as an optional parameter. The resulting workbook will be a copy of that file, assuming the string argument is a valid .xlsx file.
46
+
The `createWorkbook` method can also create a copy of an existing workbook. The method accepts a Base64-encoded string representation of an .xlsx file as an optional parameter. The resulting workbook will be a copy of that file, assuming the string argument is a valid .xlsx file.
47
47
48
-
You can get your add-in's current workbook as a base64-encoded string by using [file slicing](/javascript/api/office/office.document#office-office-document-getfileasync-member(1)). The [FileReader](https://developer.mozilla.org/docs/Web/API/FileReader) class can be used to convert a file into the required base64-encoded string, as demonstrated in the following example.
48
+
You can get your add-in's current workbook as a Base64-encoded string by using [file slicing](/javascript/api/office/office.document#office-office-document-getfileasync-member(1)). The [FileReader](https://developer.mozilla.org/docs/Web/API/FileReader) class can be used to convert a file into the required Base64-encoded string, as demonstrated in the following example.
49
49
50
50
```js
51
51
// Retrieve the external workbook file and set up a `FileReader` object.
@@ -54,7 +54,7 @@ let reader = new FileReader();
54
54
55
55
reader.onload= (function (event) {
56
56
Excel.run(function (context) {
57
-
// Remove the metadata before the base64-encoded string.
57
+
// Remove the metadata before the Base64-encoded string.
58
58
let startIndex =reader.result.toString().indexOf("base64,");
59
59
let externalWorkbook =reader.result.toString().substr(startIndex +7);
// Read the file as a data URL so we can parse the base64-encoded string.
66
+
// Read the file as a data URL so we can parse the Base64-encoded string.
67
67
reader.readAsDataURL(myFile.files[0]);
68
68
```
69
69
70
70
### Insert a copy of an existing workbook into the current one
71
71
72
-
The previous example shows a new workbook being created from an existing workbook. You can also copy some or all of an existing workbook into the one currently associated with your add-in. A [Workbook](/javascript/api/excel/excel.workbook) has the `insertWorksheetsFromBase64` method to insert copies of the target workbook's worksheets into itself. The other workbook's file is passed as a base64-encoded string, just like the `Excel.createWorkbook` call.
72
+
The previous example shows a new workbook being created from an existing workbook. You can also copy some or all of an existing workbook into the one currently associated with your add-in. A [Workbook](/javascript/api/excel/excel.workbook) has the `insertWorksheetsFromBase64` method to insert copies of the target workbook's worksheets into itself. The other workbook's file is passed as a Base64-encoded string, just like the `Excel.createWorkbook` call.
> The `insertWorksheetsFromBase64` method is supported for Excel on the web, on Windows, and on Mac. It's not supported for iOS. Additionally, in Excel on the web, this method doesn't support source worksheets with PivotTable, Chart, Comment, or Slicer elements. If those objects are present, the `insertWorksheetsFromBase64` method returns the `UnsupportedFeature` error in Excel on the web.
80
80
81
-
The following code sample shows how to insert worksheets from another workbook into the current workbook. This code sample first processes a workbook file with a [`FileReader`](https://developer.mozilla.org/docs/Web/API/FileReader) object and extracts a base64-encoded string, and then it inserts this base64-encoded string into the current workbook. The new worksheets are inserted after the worksheet named **Sheet1**. Note that `[]` is passed as the parameter for the [InsertWorksheetOptions.sheetNamesToInsert](/javascript/api/excel/excel.insertworksheetoptions#excel-excel-insertworksheetoptions-sheetnamestoinsert-member) property. This means that all the worksheets from the target workbook are inserted into the current workbook.
81
+
The following code sample shows how to insert worksheets from another workbook into the current workbook. This code sample first processes a workbook file with a [`FileReader`](https://developer.mozilla.org/docs/Web/API/FileReader) object and extracts a Base64-encoded string, and then it inserts this Base64-encoded string into the current workbook. The new worksheets are inserted after the worksheet named **Sheet1**. Note that `[]` is passed as the parameter for the [InsertWorksheetOptions.sheetNamesToInsert](/javascript/api/excel/excel.insertworksheetoptions#excel-excel-insertworksheetoptions-sheetnamestoinsert-member) property. This means that all the worksheets from the target workbook are inserted into the current workbook.
82
82
83
83
```js
84
84
// Retrieve the external workbook file and set up a `FileReader` object.
@@ -87,7 +87,7 @@ let reader = new FileReader();
87
87
88
88
reader.onload= (event) => {
89
89
Excel.run((context) => {
90
-
// Remove the metadata before the base64-encoded string.
90
+
// Remove the metadata before the Base64-encoded string.
91
91
let startIndex =reader.result.toString().indexOf("base64,");
92
92
let externalWorkbook =reader.result.toString().substr(startIndex +7);
93
93
@@ -107,7 +107,7 @@ reader.onload = (event) => {
107
107
});
108
108
};
109
109
110
-
// Read the file as a data URL so we can parse the base64-encoded string.
110
+
// Read the file as a data URL so we can parse the Base64-encoded string.
Copy file name to clipboardExpand all lines: docs/outlook/validate-an-identity-token.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ ms.localizationpriority: medium
12
12
13
13
Your Outlook add-in can send you an Exchange user identity token, but before you trust the request you must validate the token to ensure that it came from the Exchange server that you expect. Exchange user identity tokens are JSON Web Tokens (JWT). The steps required to validate a JWT are described in [RFC 7519 JSON Web Token (JWT)](https://www.rfc-editor.org/rfc/rfc7519.txt).
14
14
15
-
We suggest that you use a four-step process to validate the identity token and obtain the user's unique identifier. First, extract the JSON Web Token (JWT) from a base64 URL-encoded string. Second, make sure that the token is well-formed, that it is for your Outlook add-in, that it has not expired, and that you can extract a valid URL for the authentication metadata document. Next, retrieve the authentication metadata document from the Exchange server and validate the signature attached to the identity token. Finally, compute a unique identifier for the user by concatenating the user's Exchange ID with the URL of the authentication metadata document.
15
+
We suggest that you use a four-step process to validate the identity token and obtain the user's unique identifier. First, extract the JSON Web Token (JWT) from a Base64-encoded URL string. Second, make sure that the token is well-formed, that it is for your Outlook add-in, that it has not expired, and that you can extract a valid URL for the authentication metadata document. Next, retrieve the authentication metadata document from the Exchange server and validate the signature attached to the identity token. Finally, compute a unique identifier for the user by concatenating the user's Exchange ID with the URL of the authentication metadata document.
16
16
17
17
## Extract the JSON Web Token
18
18
@@ -22,7 +22,7 @@ The token returned from [getUserIdentityTokenAsync](/javascript/api/requirement-
22
22
{header}.{payload}.{signature}
23
23
```
24
24
25
-
The header and payload should be base64-decoded to obtain a JSON representation of each part. The signature should be base64-decoded to obtain a byte array containing the binary signature.
25
+
The header and payload should be Base64-decoded to obtain a JSON representation of each part. The signature should be Base64-decoded to obtain a byte array containing the binary signature.
26
26
27
27
For more information about the contents of the token, see [Inside the Exchange identity token](inside-the-identity-token.md).
28
28
@@ -98,7 +98,7 @@ The authentication metadata document uses the following format.
98
98
}
99
99
```
100
100
101
-
The available signing keys are in the `keys` array. Select the correct key by ensuring that the `x5t` value in the `keyinfo` property matches the `x5t` value in the header of the token. The public key is inside the `value` property in the `keyvalue` property, stored as a base64-encoded byte array.
101
+
The available signing keys are in the `keys` array. Select the correct key by ensuring that the `x5t` value in the `keyinfo` property matches the `x5t` value in the header of the token. The public key is inside the `value` property in the `keyvalue` property, stored as a Base64-encoded byte array.
102
102
103
103
After you have the correct public key, verify the signature. The signed data is the first two parts of the encoded token, separated by a period:
Copy file name to clipboardExpand all lines: docs/powerpoint/insert-slides-into-presentation.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,12 +13,12 @@ The slide insertion APIs are primarily used in presentation template scenarios:
13
13
14
14
There are two steps to inserting slides from one presentation into another.
15
15
16
-
1. Convert the source presentation file (.pptx) into a base64-formatted string.
17
-
1. Use the `insertSlidesFromBase64` method to insert one or more slides from the base64 file into the current presentation.
16
+
1. Convert the source presentation file (.pptx) into a Base64-formatted string.
17
+
1. Use the `insertSlidesFromBase64` method to insert one or more slides from the Base64 file into the current presentation.
18
18
19
-
## Convert the source presentation to base64
19
+
## Convert the source presentation to Base64
20
20
21
-
There are many ways to convert a file to base64. Which programming language and library you use, and whether to convert on the server-side of your add-in or the client-side is determined by your scenario. Most commonly, you'll do the conversion in JavaScript on the client-side by using a [FileReader](https://developer.mozilla.org/docs/Web/API/FileReader) object. The following example shows this practice.
21
+
There are many ways to convert a file to Base64. Which programming language and library you use, and whether to convert on the server-side of your add-in or the client-side is determined by your scenario. Most commonly, you'll do the conversion in JavaScript on the client-side by using a [FileReader](https://developer.mozilla.org/docs/Web/API/FileReader) object. The following example shows this practice.
22
22
23
23
1. Begin by getting a reference to the source PowerPoint file. In this example, we will use an `<input>` control of type `file` to prompt the user to choose a file. Add the following markup to the add-in page.
24
24
@@ -46,9 +46,9 @@ There are many ways to convert a file to base64. Which programming language and
46
46
47
47
3. Add the following code. Note the following about this code.
48
48
49
-
- The `reader.readAsDataURL` method converts the file to base64 and stores it in the `reader.result` property. When the method completes, it triggers the `onload` event handler.
49
+
- The `reader.readAsDataURL` method converts the file to Base64 and stores it in the `reader.result` property. When the method completes, it triggers the `onload` event handler.
50
50
- The `onload` event handler trims metadata off of the encoded file and stores the encoded string in a global variable.
51
-
- The base64-encoded string is stored globally because it will be read by another function that you create in a later step.
51
+
- The Base64-encoded string is stored globally because it will be read by another function that you create in a later step.
52
52
53
53
```javascript
54
54
let chosenFileBase64;
@@ -70,7 +70,7 @@ There are many ways to convert a file to base64. Which programming language and
70
70
71
71
## Insert slides with insertSlidesFromBase64
72
72
73
-
Your add-in inserts slides from another PowerPoint presentation into the current presentation with the [Presentation.insertSlidesFromBase64](/javascript/api/powerpoint/powerpoint.presentation#powerpoint-powerpoint-presentation-insertslidesfrombase64-member(1)) method. The following is a simple example in which all of the slides from the source presentation are inserted at the beginning of the current presentation and the inserted slides keep the formatting of the source file. Note that `chosenFileBase64` is a global variable that holds a base64-encoded version of a PowerPoint presentation file.
73
+
Your add-in inserts slides from another PowerPoint presentation into the current presentation with the [Presentation.insertSlidesFromBase64](/javascript/api/powerpoint/powerpoint.presentation#powerpoint-powerpoint-presentation-insertslidesfrombase64-member(1)) method. The following is a simple example in which all of the slides from the source presentation are inserted at the beginning of the current presentation and the inserted slides keep the formatting of the source file. Note that `chosenFileBase64` is a global variable that holds a Base64-encoded version of a PowerPoint presentation file.
0 commit comments