【问题标题】:Commenting Google Sheets Custom Functions评论谷歌表格自定义功能
【发布时间】:2019-08-25 08:05:14
【问题描述】:

我有一个在 Google 表格中工作的自定义函数 - 但是,该函数有许多可选参数 - 在帮助中,我想拆分任何可选参数的描述,以便它们出现在多行上 - 可能吗?

此功能供同事使用 - 可选参数需要明确描述 - 将输入期间出现在工作表上的支持 cmets 拆分为多行非常有帮助。

这是我今天的自定义函数文本。

/**
 * Creates a section of random text based on parameters entered.
 *
 * @param {number} len The total number paragraphs to return.
 * @param {number} size Average size of paragraphs (0 - Short  >  3 - v.Long).
 * @param {string} optional TEXT I WOULD LIKE TO RETURN OVER MULTIPLE LINES: 
 * LINE 1 
 * LINE 2 
 * LINE 3
 * @return an array of random letters
 * @customfunction
 */
function HelpMePlease(len, size, optional) {

注意:我不想在这里评论代码 > 这是 CustomFunction 的 cmets > 当用户使用该函数时,我需要的文本将出现在工作表中。

【问题讨论】:

标签: google-apps-script google-sheets jsdoc custom-function


【解决方案1】:

来自 js 文档:

带属性的参数 如果期望参数具有特定属性,则可以通过提供额外的 @param 标记来记录该属性。例如,如果期望员工参数具有姓名和部门属性,您可以按如下方式记录它:


/**
 * Assign the project to an employee.
 * @param {Object} employee - The employee who is responsible for the project.
 * @param {string} employee.name - The name of the employee.
 * @param {string} employee.department - The employee's department.
 */
Project.prototype.assign = function(employee) {
    // ...
};

https://jsdoc.app/tags-param.html

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-08
    • 2020-05-26
    • 2017-04-11
    相关资源
    最近更新 更多