Skip to content

Instantly share code, notes, and snippets.

View lumine2008's full-sized avatar

Raymond lumine2008

  • Microsoft
  • Beijing
View GitHub Profile
@lumine2008
lumine2008 / Worksheet protection event.EXCEL.yaml
Last active August 25, 2021 14:44
Create a new snippet from a blank template.
name: Worksheet protection event
description: Create a new snippet from a blank template.
host: EXCEL
api_set: {}
script:
content: |
$("#run").click(() => tryCatch(run));
$("#protect").click(() => tryCatch(protect));
$("#unprotect").click(() => tryCatch(unprotect));
$("#run2").click(() => tryCatch(run2));
@lumine2008
lumine2008 / Worksheet protection event.EXCEL.yaml
Last active August 24, 2021 08:03
Create a new snippet from a blank template.
name: Worksheet protection event
description: Create a new snippet from a blank template.
host: EXCEL
api_set: {}
script:
content: |
$("#run").click(() => tryCatch(run));
$("#protect").click(() => tryCatch(protect));
$("#unprotect").click(() => tryCatch(unprotect));
$("#run2").click(() => tryCatch(run2));
@lumine2008
lumine2008 / addSVG test.EXCEL.yaml
Created August 17, 2021 05:57
Performs a basic Excel API call using TypeScript.
name: addSVG test
description: Performs a basic Excel API call using TypeScript.
host: EXCEL
api_set: {}
script:
content: |
$("#run").click(() => tryCatch(run));
async function run() {
await Excel.run(async (context) => {
@lumine2008
lumine2008 / workbook onActivated event.EXCEL.yaml
Created March 11, 2021 02:15
Create a new snippet from a blank template.
name: workbook onActivated event
description: Create a new snippet from a blank template.
host: EXCEL
api_set: {}
script:
content: |
$("#run").click(() => tryCatch(run));
async function run() {
await Excel.run(async (context) => {
@lumine2008
lumine2008 / DelayForCellEdit - Timer.EXCEL.yaml
Last active March 3, 2021 12:48
Performs a basic Excel API call using plain JavaScript & Promises.
name: DelayForCellEdit - Timer
description: Performs a basic Excel API call using plain JavaScript & Promises.
host: EXCEL
api_set: {}
script:
content: |
let val;
const refresh = async () => {
console.log("change detected");
name: 'Origin SAP: Issue with document settings'
description: Issue with document settings
host: EXCEL
api_set: {}
script:
content: |
$("#save").click(() => tryCatch(save));
$("#read").click(() => tryCatch(read));
async function save() {
@lumine2008
lumine2008 / PartnerCall-onFormulaChanged Event.EXCEL.yaml
Last active January 27, 2021 05:47
Performs a basic Excel API call using TypeScript.
name: PartnerCall-onFormulaChanged Event
description: Performs a basic Excel API call using TypeScript.
host: EXCEL
api_set: {}
script:
content: "$(\"#run\").click(() => tryCatch(run));\n\nasync function run() {\n await Excel.run(async (context) => {\n registerOnFormulaChangedHandler();\n\n });\n}\n\nasync function registerOnFormulaChangedHandler() {\n Excel.run(async function (context) {\n const ws = context.workbook.worksheets;\n\n let sheet = ws.getActiveWorksheet();\n sheet.onFormulaChanged.add(onFormulaChange);\n await context.sync();\n console.log(\"Added\_a\_worksheet-level\_formula changed\_event\_handler sucessfully.\");\n });\n}\n\nasync function onFormulaChange(event) {\n await Excel.run(async (context) => {\n console.log(event);\n });\n}\n\n\n/** Default helper for invoking an action and handling errors. */\nasync function tryCatch(callback) {\n try {\n await callback();\n } catch (error) {\n // Note: In a production add-in, you'd want to notify the user throug
@lumine2008
lumine2008 / onChanged on merged cells.EXCEL.yaml
Created January 19, 2021 15:39
Uses the onChanged event of a table to determine the specifics of changes.
name: onChanged on merged cells
description: Uses the onChanged event of a table to determine the specifics of changes.
host: EXCEL
api_set: {}
script:
content: >
$("#setup").click(() => tryCatch(setup));
$("#register-handler").click(() => tryCatch(registerChangeEventHandler));
@lumine2008
lumine2008 / Deloitte Add Shape.EXCEL.yaml
Created January 19, 2021 15:26
Uses the onChanged event of a table to determine the specifics of changes.
name: Deloitte Add Shape
description: Uses the onChanged event of a table to determine the specifics of changes.
host: EXCEL
api_set: {}
script:
content: >
$("#setup").click(() => tryCatch(setup));
$("#register-handler").click(() => tryCatch(registerChangeEventHandler));
@lumine2008
lumine2008 / Data change event details.EXCEL.yaml
Created January 15, 2021 02:32
Uses the onChanged event of a table to determine the specifics of changes.
name: Data change event details
description: Uses the onChanged event of a table to determine the specifics of changes.
host: EXCEL
api_set: {}
script:
content: >
$("#setup").click(() => tryCatch(setup));
$("#register-handler").click(() => tryCatch(registerChangeEventHandler));