Skip to content

[Admin] main -> prod #972

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 25, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,9 @@ script:

await context.sync();

$(".conditional-formats").hide();
document.querySelectorAll(".conditional-formats").forEach(element => {
element.style.display = "none";
});
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ script:
await context.sync();

const readableXml = addLineBreaksToXML(xmlBlob.value);
$("#display-xml").text(readableXml);
document.getElementById("display-xml").textContent = readableXml;

// Store the XML part's ID in a setting.
const settings = context.workbook.settings;
Expand All @@ -50,7 +50,7 @@ script:
await context.sync();

const readableXml = addLineBreaksToXML(xmlBlob.value);
$("#display-xml").text(readableXml);
document.getElementById("display-xml").textContent = readableXml;
await context.sync();
}
});
Expand All @@ -71,14 +71,14 @@ script:
await context.sync();

if (customXmlPart.isNullObject) {
$("#display-xml").text(`The XML part with the id ${xmlPartIDSetting.value} has been deleted.`);
document.getElementById("display-xml").textContent = `The XML part with the id ${xmlPartIDSetting.value} has been deleted.`;

// Delete the unneeded setting too.
xmlPartIDSetting.delete();
} else {
const readableXml = addLineBreaksToXML(xmlBlob.value);
const strangeMessage = `This is strange. The XML part with the id ${xmlPartIDSetting.value} has not been deleted:\n${readableXml}`
$("#display-xml").text(strangeMessage);
document.getElementById("display-xml").textContent = strangeMessage;
}

await context.sync();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ script:

async function createCustomXmlPart() {
await Excel.run(async (context) => {
$("#display-xml").text("");
document.getElementById("display-xml").textContent = "";

// You must have the xmlns attribute to populate the
// CustomXml.namespaceUri property.
Expand All @@ -26,15 +26,15 @@ script:

// Make it a bit more readable.
const readableXml = xmlBlob.value.replace(/></g, ">\n<");
$("#display-xml").text(readableXml);
document.getElementById("display-xml").textContent = readableXml;

await context.sync();
});
}

async function testForUniqueNamespace() {
await Excel.run(async (context) => {
$("#display-xml").text("");
document.getElementById("display-xml").textContent = "";
const contosoNamespace = "http://schemas.contoso.com/review/1.0";
const customXmlParts = context.workbook.customXmlParts;
const filteredXmlParts = customXmlParts.getByNamespace(contosoNamespace);
Expand All @@ -51,8 +51,8 @@ script:
// Make it a bit more readable.
const readableXml = xmlBlob.value.replace(/></g, ">\n<");

$("#display-xml").text(`The only XML part in the namespace ${contosoNamespace} is:
${readableXml}`);
document.getElementById("display-xml").textContent = `The only XML part in the namespace ${contosoNamespace} is:
${readableXml}`;

} else {
console.log(`There are ${numberOfPartsInNamespace.value} XML parts with namespace ${contosoNamespace}. There should be exactly 1.`);
Expand All @@ -64,7 +64,7 @@ script:

async function deleteAllCustomXmlParts() {
await Excel.run(async (context) => {
$("#display-xml").text("");
document.getElementById("display-xml").textContent = "";
const customXmlParts = context.workbook.customXmlParts;
customXmlParts.load("items");

Expand Down
12 changes: 6 additions & 6 deletions samples/excel/20-data-types/data-types-web-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ script:
// This function inserts a web image into the currently selected cell.
await Excel.run(async (context) => {
// Retrieve image data from the task pane and then clear the input fields.
const imageUrl = $("#url").val() as string;
const imageAltText = $("#alt-text").val() as string;
const imageUrl = (document.getElementById("url") as HTMLInputElement).value;
const imageAltText = (document.getElementById("alt-text") as HTMLInputElement).value;
clearForm();

// Load the active cell.
Expand Down Expand Up @@ -65,8 +65,8 @@ script:
}

// Assign image data to corresponding input fields in the task pane.
$("#url").val(webImageUrl);
$("#alt-text").val(webImageAltText);
(document.getElementById("url") as HTMLInputElement).value = webImageUrl;
(document.getElementById("alt-text") as HTMLInputElement).value = webImageAltText;
});
}

Expand Down Expand Up @@ -95,8 +95,8 @@ script:

async function clearForm() {
// Clear the input fields in the task pane.
$("#url").val("");
$("#alt-text").val("");
(document.getElementById("url") as HTMLInputElement).value = "";
(document.getElementById("alt-text") as HTMLInputElement).value = "";
}

async function setup() {
Expand Down
8 changes: 4 additions & 4 deletions samples/excel/26-document/custom-properties.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ script:
async function setCustomDocProperty() {
await Excel.run(async (context) => {
// Get the key/value pair from the task pane.
const userKey = $("#key").text();
const userValue = $("#value").text();
const userKey = document.getElementById("key").textContent;
const userValue = document.getElementById("value").textContent;

// Add the custom property.
const customDocProperties = context.workbook.properties.custom;
Expand Down Expand Up @@ -50,8 +50,8 @@ script:
async function setCustomWorksheetProperty() {
await Excel.run(async (context) => {
// Get the key/value pair from the task pane.
const userKey = $("#key").text();
const userValue = $("#value").text();
const userKey = document.getElementById("key").textContent;
const userValue = document.getElementById("value").textContent;

// Add the custom property.
const customWorksheetProperties = context.workbook.worksheets.getActiveWorksheet().customProperties;
Expand Down
12 changes: 8 additions & 4 deletions samples/excel/26-document/get-file-in-slices-async.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ script:
console.log("Received the full contents of the file.");

let base64string = base64js.fromByteArray(byteArray);
$('#file-contents').val(base64string).show();
const fileContentsElement = document.getElementById("file-contents") as HTMLTextAreaElement;
fileContentsElement.value = base64string;
fileContentsElement.style.display = "block";

console.log("The Base64-encoded string that represents the current document has been written to the text box. To validate the string, use the \"Create workbook from string\" button.");
}
Expand Down Expand Up @@ -82,7 +84,9 @@ script:
}

async function newWorkbookFromFile() {
await Excel.createWorkbook($('#file-contents').text()).catch(function (error) {
const fileContentsElement = document.getElementById("file-contents");
const fileContentsText = fileContentsElement.textContent;
await Excel.createWorkbook(fileContentsText).catch(function (error) {
console.error(error);
});
}
Expand Down Expand Up @@ -169,8 +173,8 @@ template:
<span class="ms-Button-label">Get file</span>
</button>
<br/>
<textarea id="file-contents">
</textarea>
<textarea id="file-contents">
</textarea>
</section>
<section class="ms-Fabric samples ms-font-m">
<h3>Create a new workbook</h3>
Expand Down
6 changes: 4 additions & 2 deletions samples/excel/42-range/range-find.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ script:

// NOTE: If no match is found, an ItemNotFound error
// is thrown when Range.find is evaluated.
const foundRange = searchRange.find($("#searchText").val().toString(), {
const searchText = (document.getElementById("searchText") as HTMLTextAreaElement).value;
const foundRange = searchRange.find(searchText, {
completeMatch: isCompleteMatchToggle,
matchCase: isMatchCaseToggle,
searchDirection: searchDirectionToggle
Expand All @@ -45,7 +46,8 @@ script:
const sheet = context.workbook.worksheets.getItem("Sample");
const table = sheet.tables.getItem("ExpensesTable");
const searchRange = table.getRange();
const foundRange = searchRange.findOrNullObject($("#searchText").val().toString(), {
const searchText = (document.getElementById("searchText") as HTMLTextAreaElement).value;
const foundRange = searchRange.findOrNullObject(searchText, {
completeMatch: isCompleteMatchToggle,
matchCase: isMatchCaseToggle,
searchDirection: searchDirectionToggle
Expand Down
4 changes: 2 additions & 2 deletions samples/excel/44-shape/shape-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ api_set:
script:
content: |-
document.getElementById("setup").addEventListener("click", () => tryCatch(setup));
$("#selectedFile").on("change", () => tryCatch(readImageFromFile));
document.getElementById("selectedFile").addEventListener("change", () => tryCatch(readImageFromFile));
document.getElementById("flipImage").addEventListener("click", () => tryCatch(flipImage));
document.getElementById("getImageFormat").addEventListener("click", () => tryCatch(getImageFormat));
document.getElementById("writeOutImageString").addEventListener("click", () => tryCatch(writeOutImageString));

async function readImageFromFile() {
const myFile = <HTMLInputElement>document.getElementById("selectedFile");
const myFile = document.getElementById("selectedFile") as HTMLInputElement;
const reader = new FileReader();

reader.onload = (event) => {
Expand Down
4 changes: 2 additions & 2 deletions samples/excel/50-workbook/create-workbook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ api_set:
script:
content: |-
document.getElementById("create-new-blank-workbook").addEventListener("click", () => tryCatch(createBlankWorkbook));
$("#file").on("change", () => tryCatch(createWorkbookFromExisting));
document.getElementById("file").addEventListener("change", () => tryCatch(createWorkbookFromExisting));

async function createBlankWorkbook() {
await Excel.run(async (context) => {
Expand All @@ -18,7 +18,7 @@ script:
}

async function createWorkbookFromExisting() {
const myFile = <HTMLInputElement>document.getElementById("file");
const myFile = document.getElementById("file") as HTMLInputElement;
const reader = new FileReader();

reader.onload = ((event) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ api_set:
ExcelAPI: '1.13'
script:
content: |-
$("#file").on("change", getBase64);
document.getElementById("file").addEventListener("change", getBase64);
document.getElementById("insert-sheets").addEventListener("click", () => tryCatch(insertSheets));

let externalWorkbook;

async function getBase64() {
// Retrieve the file and set up an HTML FileReader element.
const myFile = <HTMLInputElement>document.getElementById("file");
const myFile = document.getElementById("file") as HTMLInputElement;
const reader = new FileReader();

reader.onload = (event) => {
Expand Down
Loading