Javascript 打印链接到逻辑值
早上好,我需要一个可以使用逻辑值的代码的帮助示例: ```Javascript 打印链接到逻辑值,javascript,google-apps-script,google-sheets,google-sheets-macros,Javascript,Google Apps Script,Google Sheets,Google Sheets Macros,早上好,我需要一个可以使用逻辑值的代码的帮助示例: ``` 函数provaIf2(){ var A2=SpreadsheetApp.getActive().getRange('A2').getValue(); var C4=SpreadsheetApp.getActive().getRange('C4').getValue(); 如果(A2==“”)SpreadsheetApp.getActive().getRange('B2').activate(); 否则,如果(A2如果您想使用应用程序脚本
函数provaIf2(){
var A2=SpreadsheetApp.getActive().getRange('A2').getValue();
var C4=SpreadsheetApp.getActive().getRange('C4').getValue();
如果(A2==“”)SpreadsheetApp.getActive().getRange('B2').activate();
否则,如果(A2如果您想使用应用程序脚本打印文档,则必须使用谷歌云打印
如本文所述,您必须创建一个包含OAuth2库的应用程序脚本项目。然后您需要获取谷歌云打印服务,发送请求,最后但并非最不重要的是打印文档
以下代码段用于打印具有所需选项的文档:
函数printGoogleDocument(docID、printerID、docName){
var票证={
版本:“1.0”,
打印:{
颜色:{
类型:“标准颜色”,
供应商标识:“颜色”
},
双工:{
类型:“无双工”
}
}
};
var有效载荷={
“printerid”:printerid,
“标题”:文件名,
“内容”:DriveApp.getFileById(docID.getBlob(),
“contentType”:“application/pdf”,
“ticket”:JSON.stringify(ticket)
};
- 参考:
function provaIf2(){
var A2=SpreadsheetApp.getActive().getRange('A2').getValue();
var C4=SpreadsheetApp.getActive().getRange('C4').getValue();
if(A2=="") SpreadsheetApp.getActive().getRange('B2').activate();
else if(A2<C4) Print the sheet
else if(A2==C4) Print the sheet
else SpreadsheetApp.getActive().getRange('B3').activate();
}