Coder Social home page Coder Social logo

pywpsrpc's People

Contributors

geeming avatar ljhrot avatar qbmzc avatar shanehh avatar timxx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pywpsrpc's Issues

我想用这个来在linux上操作excel

所以想知道是否能够 比如打开一个excel,复制到另外一个excel,然后公式不丢

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

尝试用pywpsrpc打开app时弹出空白的许可协议导致打开进程失败

Describe the bug
尝试用pywpsrpc打开app时弹出空白的许可协议导致打开进程失败
To Reproduce

from pywpsrpc.rpcwpsapi import (createWpsRpcInstance, wpsapi)
from pywpsrpc import RpcIter
hr, rpc = createWpsRpcInstance()
hr, app = rpc.getWpsApplication() [弹出无内容的金山用户许可协议和隐私协议无法接受]
# hr = -2147483640

Expected behavior
打开wps进程并且使用wps创建空白文档
Screenshots
Screen Shot 2020-07-13 at 7 07 46 PM

Environment
OS : Ubuntu 20.04 LTS
Python: 3.8.2
Qt: qt5-default
WPS 2019 11.1.0.9604

非root用户不能运行

Describe the bug
非root用户,wps已经打开,但是app.Documents为空
root用户下可以跑

To Reproduce
Steps to reproduce the behavior

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment

  • Distribution: [e.g. Ubuntu 18.04]
  • Versions: [e.g. pywpsrpc 1.0.2, WPS Office 11.1.0.9126]
  • Installed from pip: [yes/build from source]

getWppApplication 使用 app.Visible = False 报错

hr, rpc = createWppRpcInstance()
if hr != S_OK:
    raise ConvertException("Can't create the rpc instance", hr)

hr, app = rpc.getWppApplication()
if hr != S_OK:
    raise ConvertException("Can't get the application", hr)
# we don't need the gui
app.Visible = False

根据word 转pdf的项目修改为 ppt转pdf 目前已经完成了转化的demo不过在打来wps 后使用Visible 参数设置时出现错误。内容如下:
AttributeError: Call 'put_Visible()' failed with 0x80010105
使用app.setVisible(False) 也会抛出同样的错误

在docker不稳定

使用ubuntu 20.04 server,在虚拟机下,很稳定。但是在docker下,和虚拟机完全一样,但是现象很奇怪,

调用方法: hr,app = rpc.getWpsApplication()

可能这次成功,然后就失败几十次,然后又成功一次。

这点不太能够理解,如果有错,应该一次都不能够成功。在这个过程中,没有执行任何的其他程序。

已经解决

image请问有老哥碰到过这个问题吗 已经编译好了.这个怎么运行呢

libQt5Core.so.5: cannot open shared object file: No such file or directory

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment

  • Distribution: [e.g. Ubuntu 18.04]
  • Versions: [e.g. pywpsrpc 1.0.2, WPS Office 11.1.0.9126]
  • Installed from pip: [yes/build from source]

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

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 2.3.1, WPS Office 11.1.0.11664]
  • Installed from pip: [yes]

Call 'get_Documents()' failed with 0x80000008

Describe the bug

  1. 我实在docker里面运行的,线上跑一段时间后,就会报错 Call 'get_Documents()' failed with 0x80000008,后来发现是因为wps进程不知道怎么关掉了,很神奇。
  2. 上面的问题很好解决。后来又遇到wps进程没关掉,但是app变量又不是none,好像rpc失联了一样。
  3. app变量没有quit,一直在内存里,为了节省启动wps的时间。
  4. 感谢大佬,希望大佬帮忙中提供一些方案~~

arm64系统上使用pip3 install pywpsrpc安装失败,有没有解决办法?

Describe the bug
arm64系统上使用pip3 install pywpsrpc安装失败

usr/local/lib/python3.8/dist-packages/pkg_resources/init.py:116: PkgResourcesDeprecationWarning: 2.0.0kylin2 is an invalid version and will not be supported in a future release

warnings.warn(

/usr/local/lib/python3.8/dist-packages/pkg_resources/init.py:116: PkgResourcesDeprecationWarning: 0.23kylin1 is an invalid version and will not be supported in a future release

warnings.warn(

Collecting pywpsrpc

Using cached pywpsrpc-2.3.1.tar.gz (2.3 MB)

Installing build dependencies ... done

Getting requirements to build wheel ... done

Preparing wheel metadata ... error

ERROR: Command errored out with exit status 1:

 command: /usr/bin/python3 /tmp/tmpxjwi6tdv prepare_metadata_for_build_wheel /tmp/tmpep7_qjjq

     cwd: /tmp/pip-install-7tcy8lj3/pywpsrpc

Complete output (3 lines):

These bindings will be built: common, rpcwpsapi, rpcwppapi, rpcetapi.

Generating the common bindings...

tmpxjwi6tdv: /tmp/pip-install-7tcy8lj3/pywpsrpc/sip/common/common.sip: line 50 column 10: 'typedef' is unexpected

----------------------------------------

ERROR: Command errored out with exit status 1: /usr/bin/python3 /tmp/tmpxjwi6tdv prepare_metadata_for_build_wheel /tmp/tmpep7_qjjq Check the logs for full command output.

遇到一个错误ImportError: libQt5Xml.so.5

**Describe the bug**
File “convertto.py” ,line 19, in
from pywpsrpc.rpcwpsapi import (createWpsRpcInstance,wpsapi)
ImportError: libQt5Xml.so.5: cannot open shared object file: No such file or [directory]

Environment

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

看了一下,没有可以编辑excel和powerpoint的api,而且编辑word的api和例程感觉好简单啊!

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

excel PageSetup设置属性无效果

from pywpsrpc.rpcetapi import etapi

page_setup = etapi.PageSetup

excel列数较多时,通过ExportAsFixedFormat转换pdf文件会出现截取,对 page_setup的Zoom,FitToPagesWide等参数进行设置时,再转换也无法生效。

您好,这个支持arm架构吗?

我有一台ARM架构的服务器,是UOS系统,使用pip安装这个模块的时候会报错,报错信息如下图:
image
我想问一下是不支持arm架构吗,还是系统缺少了什么库?

{AttributeError}Call 'get_DistanceFrom()' failed with 0x80010105

Describe the bug
在使用wps解析word文件时,通过Range类的Borders获取文本框与页面边缘距离时报错。
code: document.Sections.Item(1)[1].Headers.Item(1)[1].Range.Borders.DistanceFrom
error: {AttributeError}Call 'get_DistanceFrom()' failed with 0x80010105

Expected behavior
应该通过设置wdBorderDistanceFromPageEdge获取文本框与页面距离。

Screenshots
20220308195346

Environment
ubuntu20
pywpsrpc: pip, 2.3.1
wps: 11.1.0.10920_amd64

ImportError: /lib/x86_64-linux-gnu/libQt5Network.so.5

报错位置:
from pywpsrpc.rpcwpsapi import (createWpsRpcInstance, wpsapi)
报错信息:
ImportError: /lib/x86_64-linux-gnu/libQt5Network.so.5: symbol _ZN15QIPAddressUtils8toStringER7QStringPh version Qt_5 not defined in file libQt5Core.so.5 with link time reference

比较奇怪的是,我只有在安装了pyqt5的环境中才会出现这个问题,其他环境使用正常。请问我该怎么解决?

excel文件转换pdf文件存在问题

Describe the bug
excel文件转换pdf文件时,代码执行完毕后pdf文件并没有生成.

To Reproduce
result, excel_rpc = createEtRpcInstance()
result, excel_app = excel_rpc.getEtApplication()
workbooks = app_excel.Workbooks
result, workbook = workbooks.Open('1.xls')
workbook.SaveAs(Filename='1.pdf, FileFormat=etapi.xlTypePDF)

Expected behavior
我使用workbook的SaveAs实现了xls xlsx csv等文件格式转换,但是pdf文件却无法生成。

Screenshots
If applicable, add screenshots to help explain your problem.

Environment

  • Distribution: [docker Ubuntu 20]
  • Versions: [e.g. pywpsrpc 2.3.1, WPS Office 11.1.0.9126]
  • Installed from pip: [yes]

AttributeError: 'NoneType' object has no attribute 'put_Visible'

使用例子 convertto 报错

root@a3e30ee72ca8:/home/root# python3 conv.py --format "pdf" test.md
Traceback (most recent call last):
  File "conv.py", line 104, in <module>
    main()
  File "conv.py", line 94, in main
    convert_to(args.path, args.format, args.abort)
  File "conv.py", line 41, in convert_to
    app.Visible = False
  File "/usr/local/lib/python3.6/dist-packages/pywpsrpc/utils.py", line 120, in __setattr__
    hr = getattr(self._object, "put_" + name)(value)
AttributeError: 'NoneType' object has no attribute 'put_Visible'

试用报错

用 deepin V20 装了WPS (通过商店安装)。用 pip3 install pywpsrpc 安装后,试用,报错如下:
icevi@icevi-deepin20:~/downloads/pywpsrpc-master$ python3
Python 3.7.3 (default, Apr 3 2019, 05:39:12)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

from pywpsrpc.rpcwpsapi import (createWpsRpcInstance, wpsapi)
Traceback (most recent call last):
File "", line 1, in
ImportError: librpcwpsapi_sysqt5.so: cannot open shared object file: No such file or directory

如何安装 librpcwpsapi_sysqt5.so 文件?

读取wps内容

问一下 是否存在读取 .wps .et 等wps特定格式的文件方法,相关文档太少,找不到。

AttributeError: 'NoneType' object has no attribute 'Documents'

运行demo在Debian\Centos\Ubuntu出现如下报错:

Traceback (most recent call last):
  File "2.py", line 25, in <module>
    hr, doc = app.Documents.Add()
AttributeError: 'NoneType' object has no attribute 'Documents'

是什么原因造成的呢?

excel转pdf没有文件生成

使用createEtRpcInstance, etapi,将workbook另存为etapi中的pdf格式发现代码运行正常但是没有相应文件生成。

不能获取app

您好,请问我

hr, rpc = createWpsRpcInstance()
rpc.getWpsApplication()```

返回一个负数和None请问是为什么应该如何解决

getWpsApplication() fail

I build wheel on mips64 and install it. It gets err when using getWpsApplication()

part of code is
def openwpsapp(self, visible):
if(self.wpsapp!=None):
return
print("openwpsapp")
hr, wpsrpc = createWpsRpcInstance()
if hr != S_OK:
raise self.ConvertException("Can't create the rpc instance", hr)
hr, self.wpsapp = wpsrpc.getWpsApplication()
if hr != S_OK:
raise self.ConvertException("Can't get the application", hr)

@timxx

Failed to build and prompting " cannot find -lrpcwpsapi_sysqt5“

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
sip-build

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
![Uploading image.png…](build error message)

Environment

  • Distribution: [e.g. Ubuntu 18.04]
  • Versions: [e.g. pywpsrpc 1.0.2, WPS Office 11.1.0.9126]
  • Installed from pip: [yes/build from source]

资源没有释放

当调用:hr, app = rpc.getWpsApplication()
失败的时候,wps进程不会被自动杀死。

所以,如果因为某些原因无法成功执行上面的操作,系统就会存在越来越多的wps进程,但是因为app==None,所以
调用者无法释放。

请问大佬

Linux直接可以用命令行 将word或excel 转换为pdf吗?

How to run on server

Please note that you have to accept the EULA display by WPS Office, otherwise you may failed to run pywpsrpc. You can find how to accept it without showing the WPS Office interface.

请问在没有界面的Ubantu上面如何接受EULA,我没有找到解决方法,此前我已经执行了

  1. apt install xserver-xorg-video-dummy

2.create a configuration file

3.start the Xorg (with root):

执行convertto.py README.md -f pdf的时候报错了

Traceback (most recent call last): File "test.py", line 11, in <module> hr, doc = app.Documents.Add() AttributeError: 'NoneType' object has no attribute 'Documents'

我认为这是我没有接受EULA导致的

Failed to build and prompting " cannot find -lrpcwpsapi_sysqt5“

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
sip-build

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment

  • Distribution: [e.g. os:Kylin V10, arch:mips64 kernel:Linux 4.4.131-20200429.kylin.desktop-generic]
  • Versions: [e.g. pywpsrpc 2.2.0, WPS Office 11.1.0.10161_mips64el]
  • Installed from pip: [no/build from source]
    qmake -v
    qmake version 2.01a
    using qt version 4.8.7 in /usr/lib/mips64el-linux-gnu

arm64架构下安装失败

Describe the bug
arm64架构下执行 pip install pywpsrpc 失败

Screenshots
截图录屏_选择区域_20211228180159

Environment

  • Distribution: 统信uos
  • Versions: 20

怎样无界面运行?

ssh登录到linux服务器上面,只有开启x11-forward,wps界面能弹出来的情况下才能运行成功。怎么样才能不弹出wps的窗口,完全在命令行下面运行呢?

docker container 提示 wps: cannot connect to X server

非常感谢您对上一个issue的回答,这几天又开始使用wps4linux, 我参考了https://code.aliyun.com/zouyingfeng/wps/tree/master/cpp 上的demo,写了一个小的可执行程序并且准备用带桌面的ubuntu docker image来安装wps, 按照dockerfile的过程结束后,我进入container并且执行我写的小工具,结果提示无法连接xserver,但是当我进入container的vnc桌面,在桌面里的命令行执行时,小工具正常运行,请问有什么解决办法吗
我注意到demo里BSTR StrWpsAddress = SysAllocString(__X("/opt/kingsoft/wps-office/office6/wps"));这句话,这个应用是否是必须要在桌面被显示出来才能够被调用,可以换成其他.a 或者.o吗
ps 我得程序就是简单把一个.wps另存成.docx pdf等格式

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.