WPS 加载项开发 > 表格 API 参考 > Worksheet > 属性 > Worksheet.ConsolidationSources 属性
返回一个字符串数组,这些字符串是工作表中当前合并计算的数据源的名称。如果工作表中没有合并计算,将返回 EmptyVariant 类型,只读。

语法

表达式.ConsolidationSources

表达式   一个代表 Worksheet 对象的变量。

示例

本示例显示在工作表 Sheet1 中用于合并计算的数据源的名称。该列表将出现在本示例新建的工作表中。

示例代码
let newSheet = Worksheets.Add()
newSheet.Range("A1").Value2 = "Consolidation Sources"
let aSources = Worksheets.Item("Sheet1").ConsolidationSources
if(aSources == null){
    newSheet.Range("A2").Value2 = "none"
}
else{
    for(let i = 0; i <= aSources.length - 1; i++){
        newSheet.Cells.Item(i + 1, 1).Value2 = aSources(i)
    }
}
newSheet.Columns.Item("A:B").AutoFit()

List all sheets being used by the consolidation function? What is the source of the data for my consolidation?


请参阅