Skip to content

Commit fc5ec19

Browse files
authored
[excel] Update reference docs with latest IntelliSense file (#394)
* Pulling latest from CDN * Include proper beta tags * Make beta tags consistent * Clarify convertToPdf note * Run docs generation * Use GitHub Copilot to update preprocessor.ts and strip text after @beta tags in output files
1 parent b69a1d0 commit fc5ec19

File tree

8 files changed

+239
-106
lines changed

8 files changed

+239
-106
lines changed

docs/docs-ref-autogen/excelscript/excelscript.cellcontrol.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,16 @@ uid: ExcelScript!ExcelScript.CellControl:type
44
package: ExcelScript!
55
fullName: ExcelScript.CellControl
66
summary: Represents an interactable control inside of a cell.
7-
remarks: "\r\n\r\nLearn more about the types in this type alias through the following links. \r\n\r\n[ExcelScript.UnknownCellControl](/javascript/api/office-scripts/excelscript/excelscript.unknowncellcontrol), [ExcelScript.EmptyCellControl](/javascript/api/office-scripts/excelscript/excelscript.emptycellcontrol), [ExcelScript.MixedCellControl](/javascript/api/office-scripts/excelscript/excelscript.mixedcellcontrol), [ExcelScript.CheckboxCellControl](/javascript/api/office-scripts/excelscript/excelscript.checkboxcellcontrol)"
7+
remarks: >-
8+
9+
10+
Learn more about the types in this type alias through the following links.
11+
12+
13+
[ExcelScript.UnknownCellControl](/javascript/api/office-scripts/excelscript/excelscript.unknowncellcontrol),
14+
[ExcelScript.EmptyCellControl](/javascript/api/office-scripts/excelscript/excelscript.emptycellcontrol),
15+
[ExcelScript.MixedCellControl](/javascript/api/office-scripts/excelscript/excelscript.mixedcellcontrol),
16+
[ExcelScript.CheckboxCellControl](/javascript/api/office-scripts/excelscript/excelscript.checkboxcellcontrol)
817
918
isPreview: false
1019
isDeprecated: false

docs/docs-ref-autogen/officescript.yml

Lines changed: 66 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ type: package
55
summary: ''
66
interfaces:
77
- OfficeScript!OfficeScript.EmailAttachment:interface
8+
- OfficeScript!OfficeScript.FileProperties:interface
89
- OfficeScript!OfficeScript.MailProperties:interface
910
enums:
1011
- OfficeScript!OfficeScript.EmailContentType:enum
@@ -14,10 +15,9 @@ functions:
1415
uid: OfficeScript!OfficeScript.convertToPdf:function(1)
1516
package: OfficeScript!
1617
summary: >-
17-
Return the text encoding of the document as a PDF. If the document is
18-
empty, then the following error is shown: "We didn't find anything to
19-
print". Some actions made prior to using this API may not be captured in
20-
the PDF in Excel on the web.
18+
Converts the document to a PDF and returns the text encoding of it. Note:
19+
Recent changes made to the workbook in Excel on the web, through Office
20+
Scripts or the Excel UI, may not be captured in the PDF.
2121
remarks: ''
2222

2323
isPreview: true
@@ -26,12 +26,27 @@ functions:
2626
content: 'export function convertToPdf(): string;'
2727
return:
2828
type: string
29-
description: |-
29+
description: >-
3030
The content of the workbook as a string, in PDF format.
3131
32+
33+
**Throws**: `ConvertToPdfEmptyWorkbook` The error thrown if the
34+
document is empty.
35+
36+
37+
**Throws**: `ConvertToPdfProtectedWorkbook` The error thrown if
38+
the document is protected.
39+
40+
41+
**Throws**: `ExternalApiTimeout` The error thrown if the API
42+
reaches the timeout limit of 30 seconds.
43+
44+
3245
#### Examples
3346
47+
3448
```TypeScript
49+
3550
/**
3651
* This script saves a worksheet as a PDF and emails that PDF to a recipient.
3752
*/
@@ -48,8 +63,9 @@ functions:
4863
attachments: [pdfFile]
4964
})
5065
}
66+
5167
```
52-
- name: "OfficeScript.downloadFile({\r\n name,\r\n content,\r\n })"
68+
- name: OfficeScript.downloadFile(fileProperties)
5369
uid: OfficeScript!OfficeScript.downloadFile:function(1)
5470
package: OfficeScript!
5571
summary: >-
@@ -60,22 +76,28 @@ functions:
6076
isPreview: true
6177
isDeprecated: false
6278
syntax:
63-
content: |-
64-
export function downloadFile({
65-
name,
66-
content,
67-
}: {
68-
name: string;
69-
content: string;
70-
}): void;
79+
content: 'export function downloadFile(fileProperties: FileProperties): void;'
7180
parameters:
72-
- id: "{\r\n name,\r\n content,\r\n }"
73-
description: ''
74-
type: |-
75-
{
76-
name: string;
77-
content: string;
78-
}
81+
- id: fileProperties
82+
description: >-
83+
The file to download.
84+
85+
86+
**Throws**: `DownloadFileNameMissing` The error thrown if the
87+
name is empty.
88+
89+
90+
**Throws**: `DownloadFileContentMissing` The error thrown if the
91+
content is empty.
92+
93+
94+
**Throws**: `DownloadFileInvalidExtension` The error thrown if
95+
the file name extension is not ".txt" or ".pdf".
96+
97+
98+
**Throws**: `ExternalApiTimeout` The error thrown if the API
99+
reaches the timeout limit of 30 seconds.
100+
type: <xref uid="OfficeScript!OfficeScript.FileProperties:interface" />
79101
return:
80102
type: void
81103
description: ''
@@ -97,27 +119,7 @@ functions:
97119
package: OfficeScript!
98120
summary: >-
99121
Saves a copy of the current workbook in OneDrive, in the same directory as
100-
the original file, with the specified file name. The API has a timeout
101-
limit of 30 seconds. This limit is rarely exceeded. Note: Timeout doesn't
102-
necessarily indicate that the API failed. The workbook copy may still be
103-
created, but after the timeout limit this API does not return a success or
104-
failure message.
105-
106-
107-
**Throws**: `ExternalAPITimeout` The error thrown if the API reaches
108-
the timeout limit of 30 seconds. Note that the copy may still be created.
109-
110-
111-
**Throws**: `InvalidExtensionError` The error thrown if the file name
112-
doesn't end with ".xlsx".
113-
114-
115-
**Throws**: `SaveCopyAsFileMayAlreadyExistError` The error thrown if
116-
the file name of the copy already exists.
117-
118-
119-
**Throws**: `SaveCopyAsFileNotOnOneDriveError` The error thrown if the
120-
document is not saved to OneDrive.
122+
the original file, with the specified file name.
121123
remarks: ''
122124

123125
isPreview: true
@@ -129,6 +131,27 @@ functions:
129131
description: >-
130132
The file name of the copied and saved file. The file name must end
131133
with ".xlsx".
134+
135+
136+
**Throws**: `InvalidExtensionError` The error thrown if the file
137+
name doesn't end with ".xlsx".
138+
139+
140+
**Throws**: `SaveCopyAsFileMayAlreadyExistError` The error
141+
thrown if the file name of the copy already exists.
142+
143+
144+
**Throws**: `SaveCopyAsErrorInvalidCharacters` The error thrown
145+
if the file name contains invalid characters.
146+
147+
148+
**Throws**: `SaveCopyAsFileNotOnOneDriveError` The error thrown
149+
if the document is not saved to OneDrive.
150+
151+
152+
**Throws**: `ExternalApiTimeout` The error thrown if the API
153+
reaches the timeout limit of 30 seconds. Note that the copy may
154+
still be created.
132155
type: string
133156
return:
134157
type: void
@@ -138,8 +161,7 @@ functions:
138161
package: OfficeScript!
139162
summary: >-
140163
Send an email with an Office Script. Use `MailProperties` to specify the
141-
content and recipients of the email. If the request body includes content,
142-
this method returns 400 Bad request.
164+
content and recipients of the email.
143165
remarks: ''
144166

145167
isPreview: true
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
### YamlMime:TSType
2+
name: OfficeScript.FileProperties
3+
uid: OfficeScript!OfficeScript.FileProperties:interface
4+
package: OfficeScript!
5+
fullName: OfficeScript.FileProperties
6+
summary: The file to download.
7+
remarks: ''
8+
9+
isPreview: true
10+
isDeprecated: false
11+
type: interface
12+
properties:
13+
- name: content
14+
uid: OfficeScript!OfficeScript.FileProperties#content:member
15+
package: OfficeScript!
16+
fullName: content
17+
summary: The content of the file.
18+
remarks: ''
19+
20+
isPreview: true
21+
isDeprecated: false
22+
syntax:
23+
content: 'content: string;'
24+
return:
25+
type: string
26+
- name: name
27+
uid: OfficeScript!OfficeScript.FileProperties#name:member
28+
package: OfficeScript!
29+
fullName: name
30+
summary: >-
31+
The name of the file once downloaded. The file extension determines the
32+
type of the file. Supported extensions are ".txt" and ".pdf". Default is
33+
".txt".
34+
remarks: ''
35+
36+
isPreview: true
37+
isDeprecated: false
38+
syntax:
39+
content: 'name: string;'
40+
return:
41+
type: string

docs/docs-ref-autogen/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,5 +653,7 @@ items:
653653
uid: OfficeScript!OfficeScript.EmailImportance:enum
654654
- name: EmailAttachment
655655
uid: OfficeScript!OfficeScript.EmailAttachment:interface
656+
- name: FileProperties
657+
uid: OfficeScript!OfficeScript.FileProperties:interface
656658
- name: MailProperties
657659
uid: OfficeScript!OfficeScript.MailProperties:interface

generate-docs/API Coverage Report.csv

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3432,6 +3432,9 @@ OfficeScript.EmailImportance,N/A,Enum,Unknown,false
34323432
OfficeScript.EmailImportance,"high",EnumField,Poor,false
34333433
OfficeScript.EmailImportance,"low",EnumField,Poor,false
34343434
OfficeScript.EmailImportance,"normal",EnumField,Fine,false
3435+
OfficeScript.FileProperties,N/A,Interface,Unknown,false
3436+
OfficeScript.FileProperties,"content",Property,Poor,false
3437+
OfficeScript.FileProperties,"name",Property,Good,false
34353438
OfficeScript.MailProperties,N/A,Interface,Unknown,false
34363439
OfficeScript.MailProperties,"attachments",Property,Great,false
34373440
OfficeScript.MailProperties,"bcc",Property,Great,false

generate-docs/api-extractor-inputs-officescript/officescript.d.ts

Lines changed: 52 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,82 @@
11
export declare namespace OfficeScript {
22
/**
33
* Saves a copy of the current workbook in OneDrive, in the same directory as the original file, with the specified file name.
4-
* The API has a timeout limit of 30 seconds. This limit is rarely exceeded.
5-
* Note: Timeout doesn't necessarily indicate that the API failed. The workbook copy may still be created, but after the timeout limit this API does not return a success or failure message.
6-
7-
* **Throws**: `ExternalApiTimeout` The error thrown if the API reaches the timeout limit of 30 seconds. Note that the copy may still be created.
4+
* @beta
5+
* @param filename - The file name of the copied and saved file. The file name must end with ".xlsx".
86
97
* **Throws**: `InvalidExtensionError` The error thrown if the file name doesn't end with ".xlsx".
108
119
* **Throws**: `SaveCopyAsFileMayAlreadyExistError` The error thrown if the file name of the copy already exists.
1210
11+
* **Throws**: `SaveCopyAsErrorInvalidCharacters` The error thrown if the file name contains invalid characters.
12+
1313
* **Throws**: `SaveCopyAsFileNotOnOneDriveError` The error thrown if the document is not saved to OneDrive.
14-
* @param filename - The file name of the copied and saved file. The file name must end with ".xlsx".
15-
* @beta
14+
15+
* **Throws**: `ExternalApiTimeout` The error thrown if the API reaches the timeout limit of 30 seconds. Note that the copy may still be created.
1616
*/
1717
export function saveCopyAs(filename: string): void;
1818

1919
/**
20-
* Return the text encoding of the document as a PDF.
21-
* If the document is empty, then the following error is shown: "We didn't find anything to print".
22-
* Some actions made prior to using this API may not be captured in the PDF in Excel on the web.
23-
* @returns The content of the workbook as a string, in PDF format.
20+
* Converts the document to a PDF and returns the text encoding of it.
21+
* Note: Recent changes made to the workbook in Excel on the web, through Office Scripts or the Excel UI, may not be captured in the PDF.
2422
* @beta
23+
* @returns The content of the workbook as a string, in PDF format.
24+
25+
* **Throws**: `ConvertToPdfEmptyWorkbook` The error thrown if the document is empty.
26+
27+
* **Throws**: `ConvertToPdfProtectedWorkbook` The error thrown if the document is protected.
28+
29+
* **Throws**: `ExternalApiTimeout` The error thrown if the API reaches the timeout limit of 30 seconds.
2530
*/
2631
export function convertToPdf(): string;
2732

2833
/**
2934
* Downloads a specified file to the default download location specified by the local machine.
30-
* @param name - The name of the file once downloaded. The file extension determines the type of the file. Supported extensions are ".txt" and ".pdf". Default is ".txt".
31-
* @param content - The content of the file.
3235
* @beta
36+
* @param fileProperties - The file to download.
37+
38+
* **Throws**: `DownloadFileNameMissing` The error thrown if the name is empty.
39+
40+
* **Throws**: `DownloadFileContentMissing` The error thrown if the content is empty.
41+
42+
* **Throws**: `DownloadFileInvalidExtension` The error thrown if the file name extension is not ".txt" or ".pdf".
43+
44+
* **Throws**: `ExternalApiTimeout` The error thrown if the API reaches the timeout limit of 30 seconds.
3345
*/
34-
export function downloadFile({
35-
name,
36-
content,
37-
}: {
46+
export function downloadFile(fileProperties: FileProperties): void;
47+
48+
/**
49+
* The file to download.
50+
* @beta
51+
*/
52+
export interface FileProperties {
53+
/**
54+
* The name of the file once downloaded. The file extension determines the type of the file. Supported extensions are ".txt" and ".pdf". Default is ".txt".
55+
* @beta
56+
*/
3857
name: string;
58+
59+
/**
60+
* The content of the file.
61+
* @beta
62+
*/
3963
content: string;
40-
}): void;
64+
}
4165

4266
/**
4367
* Send an email with an Office Script. Use `MailProperties` to specify the content and recipients of the email.
44-
* If the request body includes content, this method returns 400 Bad request.
45-
* @param message - The properties that define the content and recipients of the email.
4668
* @beta
69+
* @param message - The properties that define the content and recipients of the email.
70+
71+
* **Throws**: `SendMailErrorMaxCalls` The error thrown if the maximum number of API calls is exceeded. The limit is 100 API calls.
72+
73+
* **Throws**: `SendMailNoRecipient` The error thrown if no recipient is specified.
74+
75+
* **Throws**: `SendMailInvalidEmail` The error thrown if an invalid email address is provided.
76+
77+
* **Throws**: `SendMailExtensionNotSupported` The error thrown if the attachment name extension is not ".txt" or ".pdf".
78+
79+
* **Throws**: `ExternalApiTimeout` The error thrown if the API reaches the timeout limit of 30 seconds.
4780
*/
4881
export function sendMail(mailProperties: MailProperties): void;
4982

0 commit comments

Comments
 (0)