Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 89 additions & 1 deletion docs/docs-ref-autogen/office/office/office.slice.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,95 @@ fullName: Office.Slice
summary: >-
Represents a slice of a document file. The Slice object is accessed with the
`File.getSliceAsync` method.
remarks: ''
remarks: >-


#### Examples


```TypeScript

// This example demonstrates how to read file slices using the Office.Slice
interface.

// Each slice represents a portion of the document file and includes the
data,

// index, and size properties.

Office.context.document.getFileAsync(Office.FileType.Compressed, { sliceSize:
65536 },
function (result) {
if (result.status === Office.AsyncResultStatus.Succeeded) {
const file = result.value;
const sliceCount = file.sliceCount;
let slicesReceived = 0;
let fileData = [];

console.log(`File sliced into ${sliceCount} parts.`);

// Get the first slice.
getSliceAsync(file, 0, sliceCount);

/**
* Recursively retrieves slices from the file.
* @param file - The Office.File object to retrieve slices from.
* @param sliceIndex - The zero-based index of the slice to retrieve.
* @param totalSlices - The total number of slices in the file.
*/
function getSliceAsync(file, sliceIndex, totalSlices) {
file.getSliceAsync(sliceIndex, function (sliceResult) {
if (sliceResult.status === Office.AsyncResultStatus.Succeeded) {
const slice: Office.Slice = sliceResult.value;

// Access the properties of the Slice.
console.log(`Processing slice ${slice.index + 1} of ${totalSlices}`);
console.log(`Slice size: ${slice.size} bytes`);

// Store the slice data.
fileData[slice.index] = slice.data;
slicesReceived++;

// Check if we've received all slices.
if (slicesReceived === totalSlices) {
file.closeAsync();
console.log("All slices received. File data complete.");

// Process the complete file data.
processFileData(fileData);
} else {
// Get the next slice.
getSliceAsync(file, sliceIndex + 1, totalSlices);
}
} else {
file.closeAsync();
console.error(`Error getting slice: ${sliceResult.error.message}`);
}
});
}

/**
* Processes the complete file data by combining all slices.
* @param data - An array of slice data arrays to combine.
*/
function processFileData(data) {
// Combine all slice data into a complete file.
let combinedData = [];
for (let i = 0; i < data.length; i++) {
combinedData.push(...data[i]);
}

console.log(`File processing complete. Total bytes: ${combinedData.length}`);
// At this point, combinedData contains the complete file content.
// You can now save it, send it to a server, or process it further.
}
} else {
console.error(`Error getting file: ${result.error.message}`);
}
}
);

```

isPreview: false
isDeprecated: false
Expand Down
90 changes: 89 additions & 1 deletion docs/docs-ref-autogen/office_release/office/office.slice.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,95 @@ fullName: Office.Slice
summary: >-
Represents a slice of a document file. The Slice object is accessed with the
`File.getSliceAsync` method.
remarks: ''
remarks: >-


#### Examples


```TypeScript

// This example demonstrates how to read file slices using the Office.Slice
interface.

// Each slice represents a portion of the document file and includes the
data,

// index, and size properties.

Office.context.document.getFileAsync(Office.FileType.Compressed, { sliceSize:
65536 },
function (result) {
if (result.status === Office.AsyncResultStatus.Succeeded) {
const file = result.value;
const sliceCount = file.sliceCount;
let slicesReceived = 0;
let fileData = [];

console.log(`File sliced into ${sliceCount} parts.`);

// Get the first slice.
getSliceAsync(file, 0, sliceCount);

/**
* Recursively retrieves slices from the file.
* @param file - The Office.File object to retrieve slices from.
* @param sliceIndex - The zero-based index of the slice to retrieve.
* @param totalSlices - The total number of slices in the file.
*/
function getSliceAsync(file, sliceIndex, totalSlices) {
file.getSliceAsync(sliceIndex, function (sliceResult) {
if (sliceResult.status === Office.AsyncResultStatus.Succeeded) {
const slice: Office.Slice = sliceResult.value;

// Access the properties of the Slice.
console.log(`Processing slice ${slice.index + 1} of ${totalSlices}`);
console.log(`Slice size: ${slice.size} bytes`);

// Store the slice data.
fileData[slice.index] = slice.data;
slicesReceived++;

// Check if we've received all slices.
if (slicesReceived === totalSlices) {
file.closeAsync();
console.log("All slices received. File data complete.");

// Process the complete file data.
processFileData(fileData);
} else {
// Get the next slice.
getSliceAsync(file, sliceIndex + 1, totalSlices);
}
} else {
file.closeAsync();
console.error(`Error getting slice: ${sliceResult.error.message}`);
}
});
}

/**
* Processes the complete file data by combining all slices.
* @param data - An array of slice data arrays to combine.
*/
function processFileData(data) {
// Combine all slice data into a complete file.
let combinedData = [];
for (let i = 0; i < data.length; i++) {
combinedData.push(...data[i]);
}

console.log(`File processing complete. Total bytes: ${combinedData.length}`);
// At this point, combinedData contains the complete file content.
// You can now save it, send it to a server, or process it further.
}
} else {
console.error(`Error getting file: ${result.error.message}`);
}
}
);

```

isPreview: false
isDeprecated: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,13 @@ properties:
**Important**


- The `errorMessageMarkdown` property is available for preview in Outlook
on Mac starting in Version 16.103 (Build 25102433). To test the property,
join the [Microsoft 365 Insider
program](https://techcommunity.microsoft.com/kb/microsoft-365-insider-kb/join-the-microsoft-365-insider-program-on-macos/4401756)
and select the **Beta Channel** option to access Office beta builds.


- The formatted error message must be 500 characters or less.


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,13 @@ properties:
**Important**


- The `errorMessageMarkdown` property is available for preview in Outlook
on Mac starting in Version 16.103 (Build 25102433). To test the property,
join the [Microsoft 365 Insider
program](https://techcommunity.microsoft.com/kb/microsoft-365-insider-kb/join-the-microsoft-365-insider-program-on-macos/4401756)
and select the **Beta Channel** option to access Office beta builds.


- The formatted error message must be 500 characters or less.


Expand Down
2 changes: 1 addition & 1 deletion generate-docs/API Coverage Report.csv
Original file line number Diff line number Diff line change
Expand Up @@ -8109,7 +8109,7 @@ office,Office.Settings,"set(name, value)",Method,Excellent,true
office,Office.SettingsChangedEventArgs,N/A,Interface,Excellent,false
office,Office.SettingsChangedEventArgs,"settings",Property,Good,false
office,Office.SettingsChangedEventArgs,"type",Property,Great,false
office,Office.Slice,N/A,Interface,Great,false
office,Office.Slice,N/A,Interface,Great,true
office,Office.Slice,"data",Property,Excellent,false
office,Office.Slice,"index",Property,Poor,false
office,Office.Slice,"size",Property,Poor,false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14943,6 +14943,10 @@ export declare namespace Office {
*
* **Important**
*
* - The `errorMessageMarkdown` property is available for preview in Outlook on Mac starting in Version 16.103 (Build 25102433). To test the property, join the
* {@link https://techcommunity.microsoft.com/kb/microsoft-365-insider-kb/join-the-microsoft-365-insider-program-on-macos/4401756 | Microsoft 365 Insider program} and
* select the **Beta Channel** option to access Office beta builds.
*
* - The formatted error message must be 500 characters or less.
*
* - For guidance on supported Markdown elements, see
Expand Down
4 changes: 4 additions & 0 deletions generate-docs/api-extractor-inputs-outlook/outlook.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15712,6 +15712,10 @@ export declare namespace Office {
*
* **Important**
*
* - The `errorMessageMarkdown` property is available for preview in Outlook on Mac starting in Version 16.103 (Build 25102433). To test the property, join the
* {@link https://techcommunity.microsoft.com/kb/microsoft-365-insider-kb/join-the-microsoft-365-insider-program-on-macos/4401756 | Microsoft 365 Insider program} and
* select the **Beta Channel** option to access Office beta builds.
*
* - The formatted error message must be 500 characters or less.
*
* - For guidance on supported Markdown elements, see
Expand Down
75 changes: 75 additions & 0 deletions generate-docs/script-inputs/local-repo-snippets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5971,6 +5971,81 @@ Office.Settings#saveAsync:member(2):
function write(message){
document.getElementById('message').innerText += message;
}
Office.Slice:interface:
- |-
// This example demonstrates how to read file slices using the Office.Slice interface.
// Each slice represents a portion of the document file and includes the data,
// index, and size properties.
Office.context.document.getFileAsync(Office.FileType.Compressed, { sliceSize: 65536 },
function (result) {
if (result.status === Office.AsyncResultStatus.Succeeded) {
const file = result.value;
const sliceCount = file.sliceCount;
let slicesReceived = 0;
let fileData = [];

console.log(`File sliced into ${sliceCount} parts.`);

// Get the first slice.
getSliceAsync(file, 0, sliceCount);

/**
* Recursively retrieves slices from the file.
* @param file - The Office.File object to retrieve slices from.
* @param sliceIndex - The zero-based index of the slice to retrieve.
* @param totalSlices - The total number of slices in the file.
*/
function getSliceAsync(file, sliceIndex, totalSlices) {
file.getSliceAsync(sliceIndex, function (sliceResult) {
if (sliceResult.status === Office.AsyncResultStatus.Succeeded) {
const slice: Office.Slice = sliceResult.value;

// Access the properties of the Slice.
console.log(`Processing slice ${slice.index + 1} of ${totalSlices}`);
console.log(`Slice size: ${slice.size} bytes`);

// Store the slice data.
fileData[slice.index] = slice.data;
slicesReceived++;

// Check if we've received all slices.
if (slicesReceived === totalSlices) {
file.closeAsync();
console.log("All slices received. File data complete.");

// Process the complete file data.
processFileData(fileData);
} else {
// Get the next slice.
getSliceAsync(file, sliceIndex + 1, totalSlices);
}
} else {
file.closeAsync();
console.error(`Error getting slice: ${sliceResult.error.message}`);
}
});
}

/**
* Processes the complete file data by combining all slices.
* @param data - An array of slice data arrays to combine.
*/
function processFileData(data) {
// Combine all slice data into a complete file.
let combinedData = [];
for (let i = 0; i < data.length; i++) {
combinedData.push(...data[i]);
}

console.log(`File processing complete. Total bytes: ${combinedData.length}`);
// At this point, combinedData contains the complete file content.
// You can now save it, send it to a server, or process it further.
}
} else {
console.error(`Error getting file: ${result.error.message}`);
}
}
);
Office.StartupBehavior:enum:
- |-
// Configure your add-in to load and start running when the document is opened.
Expand Down
4 changes: 4 additions & 0 deletions generate-docs/script-inputs/office.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23846,6 +23846,10 @@ declare namespace Office {
*
* **Important**
*
* - The `errorMessageMarkdown` property is available for preview in Outlook on Mac starting in Version 16.103 (Build 25102433). To test the property, join the
* {@link https://techcommunity.microsoft.com/kb/microsoft-365-insider-kb/join-the-microsoft-365-insider-program-on-macos/4401756 | Microsoft 365 Insider program} and
* select the **Beta Channel** option to access Office beta builds.
*
* - The formatted error message must be 500 characters or less.
*
* - For guidance on supported Markdown elements, see
Expand Down
4 changes: 4 additions & 0 deletions generate-docs/script-inputs/office_preview.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24625,6 +24625,10 @@ declare namespace Office {
*
* **Important**
*
* - The `errorMessageMarkdown` property is available for preview in Outlook on Mac starting in Version 16.103 (Build 25102433). To test the property, join the
* {@link https://techcommunity.microsoft.com/kb/microsoft-365-insider-kb/join-the-microsoft-365-insider-program-on-macos/4401756 | Microsoft 365 Insider program} and
* select the **Beta Channel** option to access Office beta builds.
*
* - The formatted error message must be 500 characters or less.
*
* - For guidance on supported Markdown elements, see
Expand Down