Skip to content

Instantly share code, notes, and snippets.

@LucasSgarbi
LucasSgarbi / Ex 4 Revisão .EXCEL.yaml
Created November 18, 2021 18:06
Create a new snippet from a blank template.
name: 'Ex 4 Revisão '
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) => {
@LucasSgarbi
LucasSgarbi / Ex 3 Revisão .EXCEL.yaml
Last active November 18, 2021 17:58
Create a new snippet from a blank template.
name: 'Ex 3 Revisão '
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) => {
@LucasSgarbi
LucasSgarbi / Ex 2 Revisão .EXCEL.yaml
Created November 18, 2021 17:43
Create a new snippet from a blank template.
name: 'Ex 2 Revisão '
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) => {
@LucasSgarbi
LucasSgarbi / EX1 Revisão .EXCEL.yaml
Created November 18, 2021 17:37
Create a new snippet from a blank template.
name: 'EX1 Revisão '
description: Create a new snippet from a blank template.
host: EXCEL
api_set: {}
script:
content: |
show.addEventListener("click", async () => {
await Excel.run(async function(context) {
let sheet = context.workbook.worksheets.getActiveWorksheet();
let table = sheet.tables.add("A1:B1", true);
name: EX2 Lista 3
description: EX2 Lista 3
host: EXCEL
api_set: {}
script:
content: |
button.addEventListener("click", async () => {
await Excel.run(async function(context) {
let sheet = context.workbook.worksheets.getActiveWorksheet();
@LucasSgarbi
LucasSgarbi / EX1 Lista 3.EXCEL.yaml
Last active November 11, 2021 19:08
EX1 Lista 3
name: EX1 Lista 3
description: EX1 Lista 3
host: EXCEL
api_set: {}
script:
content: >
const student = document.getElementById("Nome") as HTMLInputElement;
const nota1 = document.getElementById("field") as HTMLInputElement;
@LucasSgarbi
LucasSgarbi / EX3 L2.EXCEL.yaml
Created November 3, 2021 20:20
Create a new snippet from a blank template.
name: EX3 L2
description: Create a new snippet from a blank template.
host: EXCEL
api_set: {}
script:
content: |
run.addEventListener("click", () => {
Excel.run(function(context) {
let sheet = context.workbook.worksheets.getActiveWorksheet();
sheet.getUsedRange().clear();;
@LucasSgarbi
LucasSgarbi / EX2 L2.EXCEL.yaml
Created November 3, 2021 20:11
Create a new snippet from a blank template.
name: EX2 L2
description: Create a new snippet from a blank template.
host: EXCEL
api_set: {}
script:
content: |
$("#mostrar").click(() => tryCatch(run));
async function run() {
await Excel.run(async (context) => {
@LucasSgarbi
LucasSgarbi / EX1 L2 .EXCEL.yaml
Created November 3, 2021 19:56
Create a new snippet from a blank template.
name: 'EX1 L2 '
description: Create a new snippet from a blank template.
host: EXCEL
api_set: {}
script:
content: "const Animal = [];\r\n\r\nsave.addEventListener(\"click\", () => {\r\n const Pet = {\r\n Nome: field1.value,\r\n Data: field2.valueAsDate,\r\n Especie: field3.value,\r\n Raca: field4.value,\r\n Sexo: field5.value\r\n };\r\n\r\n Animal.push(Pet);\r\n\r\n field1.value = \"\";\r\n field2.value = \"\";\r\n field3.value = \"\";\r\n field4.value = \"\";\r\n field5.value = \"\";\r\n});\r\n\r\nshow.addEventListener(\"click\", () => {\r\n Excel.run(function(context) {\r\n const sheet = context.workbook.worksheets.getActiveWorksheet();\r\n sheet.getUsedRange().clear();\r\n sheet.getRange(\"A1:E1\").values = [[\"Nome\", \"Nascimento\", \"Especie\", \"Raça\", \"Sexo\"]];\r\n for (let i = 2; i <= Animal.length + 1; i++) {\r\n const pet = Animal[i - 2];\r\n sheet.getRange(`A${i}:E${i}`).values = [[pet.Nome, pet.Data, pet.Especie, pet.Raca, pet.Sexo]];\r\n }\r\
@LucasSgarbi
LucasSgarbi / Exercício 5.WORD.yaml
Created September 16, 2021 22:29
Create a new snippet from a blank template.
name: Exercício 5
description: Create a new snippet from a blank template.
host: WORD
api_set: {}
script:
content: "but_Add.addEventListener(\"click\", bot_Add);\r\nbut_Med.addEventListener(\"click\", bot_Media);\r\n\r\nvar l_media = [];\r\n\r\nfunction bot_Add() {\r\n Word.run(function(context) {\r\n let docBody = context.document.body;\r\n let n1 = nun1.value;\r\n docBody.clear();\r\n if (isNaN(n1)) {\r\n docBody.insertParagraph(\"Apenas permitido números\", \"End\");\r\n } else {\r\n n1 = parseFloat(n1);\r\n l_media.push(n1);\r\n docBody.insertParagraph(\"Item adicionado com sucesso.\", \"End\");\r\n nun1.value = \"\";\r\n }\r\n return context.sync();\r\n });\r\n}\r\nfunction bot_Media() {\r\n Word.run(function(context) {\r\n let docBody = context.document.body;\r\n docBody.clear();\r\n if (l_media.length) {\r\n const soma = l_media.reduce((a, b) => a + b, 0);\r\n const med = soma / l_media.length || 0;\r\n docBody.insertParagraph(`