pywpsrpc icon indicating copy to clipboard operation
pywpsrpc copied to clipboard

调用CompareDocuments进行文件比较出现参数类型错误

Open qbmzc opened this issue 3 years ago • 2 comments

Describe the bug 通过Documents.Open()方法返回的文档类型为wpsapi._Document,而CompareDocuments需要的参数类型为wpsapi.Document

To Reproduce

    def _handle_result(hr):
        if abort_on_fails and hr != S_OK:
            raise ConvertException("open file failed", hr)

    hr, ori_doc = docs.Open(original_file, PasswordDocument='xxx', ReadOnly=True)
    if hr != S_OK:
        return _handle_result(hr)
    hr, rev_doc = docs.Open(revised_file, PasswordDocument='xxx', ReadOnly=True)
    if hr != S_OK:
        return _handle_result(hr)
    print(type(ori_doc))
    hr, act_doc = app.CompareDocuments(ori_doc, rev_doc)

Expected behavior

应该怎么样才能获取正确的Document类型

Screenshots

202210191535729

Environment

  • Distribution: [Ubuntu 18.04]
  • Versions: [ pywpsrpc 1.0.2, WPS Office 11.1.0.9126]
  • Installed from pip: [yes]

qbmzc avatar Oct 19 '22 07:10 qbmzc

真的是1.0.2的版本吗,好旧了😅 看了下c++ sdk参数传的就是document,不过这个是空壳,python转成了下划线的,还得研究研究怎么处理

timxx avatar Oct 19 '22 16:10 timxx

真的是1.0.2的版本吗,好旧了😅 看了下c++ sdk参数传的就是document,不过这个是空壳,python转成了下划线的,还得研究研究怎么处理

版本是2.3.1,😅 wps是11.1.0.11664

qbmzc avatar Oct 20 '22 01:10 qbmzc

@qbmzc 搞定了么?

verydemo avatar Oct 31 '22 07:10 verydemo

@qbmzc 搞定了么?

还没有

qbmzc avatar Nov 01 '22 01:11 qbmzc

image 同样的问题, 版本 2.3.3 @timxx 有解决的办法么

verydemo avatar Nov 02 '22 06:11 verydemo

@timxx 这个issue有规避方案不?

mjTree avatar Apr 20 '23 13:04 mjTree

@timxx 看到五一节作者还在更新👍👍,不过我这边测试后虽然没有类型报错,但CompareDocuments方法好像没有驱动sdk做word文件比较,返回结果是(-2147417851, None)。 pywpsrpc版本:pypi的2.3.4/自己编译的2.3.4 ubuntu: 20.04版本 wps-version: v11.1.0.10920-release

mjTree avatar May 04 '23 03:05 mjTree

这个应该是Linux客户端的BUG,我试了C++ SDK直接调用也是不行的。。建议给官方反馈。。

timxx avatar May 04 '23 04:05 timxx

这个应该是Linux客户端的BUG,我试了C++ SDK直接调用也是不行的。。建议给官方反馈。。

尝试了其他方法也可以,谢谢作者。

mjTree avatar Aug 08 '23 08:08 mjTree