timxx / pywpsrpc

Python bindings for WPS Office RPC (for Linux)
MIT License
219 stars 44 forks source link

et如何读取某一行或者某一列的数据? #72

Closed Howard0o0 closed 1 year ago

Howard0o0 commented 1 year ago

想要获取某一列的所有有效值,返回一个list,但好像没有看到相关的接口? c++ side也没看到,想问下是c++ api只支持指定单元格的range操作吗,不能获取某一行获取某一列吗?

在win32里操作excel可以这样操作某一行

# 给第12行赋值
mySheet.Rows(12).Value = value
timxx commented 1 year ago

可以参考官方文档这里的Rows例子

/*此示例删除 Sheet1 的第三行。*/
Application.Worksheets.Item("Sheet1").Rows.Item(3).Delete()

/*此示例显示 Sheet1 选定区域中的行数。如果选择了多个子区域,此示例将对每一个子区域进行循环。*/
function test()
{
    Application.Worksheets.Item("Sheet1").Activate()
    let areaCount = Application.Selection.Areas.Count
    if(areaCount <= 1){
       alert("The selection contains " + Application.Selection.Rows.Count + " rows.")
    }
    else{
        for(let i = 1; i <= Application.Selection.Areas.Count; i++){
            alert("Area " + i + " of the selection contains " + Application.Selection.Areas.Rows.Count + " rows.")
        }
    }
}
timxx commented 1 year ago

pywpsrpc可以参考这里,需要更新版本