我创建了一个幻灯片模板,多个团队将使用该模板创建有关各自流程的信息表。此内容旨在以标准化方式制作。
为了使事情变得更容易,我创建了一个工作表,其中可以将关键信息输入到单元格中以填充模板的元素。
我遇到的问题是我希望每个进程都有不同的配色方案。有没有办法可以将单元格设置为工作表中所需的字体或背景颜色,然后让模板以该颜色创建?甚至是配色方案?
如何挑出幻灯片的某些文本或文本框来设置背景颜色?
任何帮助深表感谢
// Add a custom menu to the active spreadsheet, including a separator and a sub-menu.
function onOpen(e) {
SpreadsheetApp.getUi()
.createMenu('Templates')
.addItem('Cheat Sheet', 'createNewCase')
.addToUi();
}
function createNewCase(input) {
var category = input
var ui = SpreadsheetApp.getUi();
// get active spreadsheet
var activeSpreadsheet = SpreadsheetApp.getActiveSpreadsheet();
var activeSheet = activeSpreadsheet.getActiveSheet();
// Check to ensure script being run from 'Option 1' sheet
if (activeSheet.getName() != "Sheet1") {
ui.alert("Active sheet must be 'Sheet1', terminating script");
return;
}
//Get active cell
var sourceRow = activeSheet.getActiveCell().getRow();
// Read case variables
var sourceProcess = activeSheet.getRange('A' + sourceRow).getValue();
var sourceName1 = activeSheet.getRange('B' + sourceRow).getValue();
var sourceName2 = activeSheet.getRange('C' + sourceRow).getValue();
var sourceTeam = activeSheet.getRange('D' + sourceRow).getValue();
var sourcePurpose = activeSheet.getRange('E' + sourceRow).getValue();
var sourceDef = activeSheet.getRange('F' + sourceRow).getValue();
var sourceColor = activeSheet.getRange('G' + sourceRow).getFontColor();
// Message prompt
var userChoice = ui.alert("You are about to generate a Cheat Sheet template for " + sourceProcess +"\n\nDo you wish to continue?\n\n",ui.ButtonSet.YES_NO);
if (userChoice == ui.Button.NO) {
ui.alert("Terminating script");
return;
}
//Set case document filename
var newFilename = sourceProcess + "Process Cheat Sheet"
//Get template folder
var templateFolder = DriveApp.getFolderById("1MCQn9_oiaaUt4_dNzr2EoDWkUGsYOH-O");
// Get case Template document
var docTemplate = DriveApp.getFileById("1cmm1ifvfRv7omGVmRhD0zunCngBcIY_qo2jpCA_sHV4");
var caseDocument = docTemplate.makeCopy(newFilename);
var caseDocumentID = caseDocument.getId();
var caseSlide = SlidesApp.openById(caseDocumentID);
var caseName1 = caseSlide.replaceAllText("%NAME1%", sourceName1);
var caseName2 = caseSlide.replaceAllText("%NAME2%", sourceName2);
var caseProcess = caseSlide.replaceAllText("%PROCESS%", sourceProcess);
var caseTeam = caseSlide.replaceAllText("%TEAM%", sourceTeam);
var casePurpose = caseSlide.replaceAllText("%PURPOSE%", sourcePurpose);
var caseDef = caseSlide.replaceAllText("%DEFINITION%", sourceDef);
// Record Case Document link
activeSheet.getRange('H' + (sourceRow)).setFormula('=HYPERLINK("' + caseDocument.getUrl() + '", "Cheat Sheet Template")');
}