timxx / pywpsrpc Goto Github PK
View Code? Open in Web Editor NEWPython bindings for WPS Office RPC (for Linux)
License: MIT License
Python bindings for WPS Office RPC (for Linux)
License: MIT License
Linux直接可以用命令行 将word或excel 转换为pdf吗?
使用createEtRpcInstance, etapi,将workbook另存为etapi中的pdf格式发现代码运行正常但是没有相应文件生成。
open函数支持打开文件输入保护密码的操作吗 或者有返回值不可以告知程序处于输入保护密码状态
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获取文本框与页面距离。
Environment
ubuntu20
pywpsrpc: pip, 2.3.1
wps: 11.1.0.10920_amd64
Qt5 (C++ SDK依赖),这个SDK可以到qt4上运行吗?还是需要必须在qt5才行
单个线程文件转换没有问题,并发执行的时候会报错获取不到application,请问能是什么原因
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
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
比如说,我想在新的tab里面打开另外一个word文件,这个改代码该怎么写?
比如说,关闭一个标签代码怎么写?
I need pywpsrpc aarch64 wheels and mips64el wheels based on python35, but I have no enviroment to build them from source code, Is there anyone has built the wheel? please share me. thank you!
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
使用例子 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'
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
Environment
OS : Ubuntu 20.04 LTS
Python: 3.8.2
Qt: qt5-default
WPS 2019 11.1.0.9604
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
把标尺设置成纸张的宽度,或者页边距的宽度。
这里有一个excel文件,但是打开Workbooks.Open('Charts.xlsx').Charts 为空。
不清楚是不是因为对应的sip文件没有定义,这边可以增加加吗?或者告知如何加我这边完成也可以。
https://github.com/timxx/pywpsrpc/blob/master/sip/rpcetapi/Charts.sip
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,我没有找到解决方法,此前我已经执行了
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导致的
**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
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.
执行conbertto.py 会弹出许可窗口,怎样可一在没有手工介入的情况下完成脚本运行呢
当调用:hr, app = rpc.getWpsApplication()
失败的时候,wps进程不会被自动杀死。
所以,如果因为某些原因无法成功执行上面的操作,系统就会存在越来越多的wps进程,但是因为app==None,所以
调用者无法释放。
执行时会弹出wps ui然后手动关闭的话就会返回 can't get the application 错误。
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) 也会抛出同样的错误
ssh登录到linux服务器上面,只有开启x11-forward,wps界面能弹出来的情况下才能运行成功。怎么样才能不弹出wps的窗口,完全在命令行下面运行呢?
Describe the bug
发现只能在Ubuntu等具有sudo权限的用户下才能正确打开程序
报错
Convert failed:
Details: Can not get the application
ErrCode: 0x80000008
感谢您的工作!
您好,请问我
hr, rpc = createWpsRpcInstance()
rpc.getWpsApplication()```
返回一个负数和None,请问是为什么?应该如何解决
是迁移到其他地方了吗?
用wps界面打开应该是启用了兼容模式,api里能处理吗
这个接口能控制无痕吗,不往office.config里写,看了下wps的设置现在版本好像不能配置,程序可以实现吗
Describe the bug
非常感谢您对上一个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等格式
x86 centos7下执行示例py新建docx文件报错,弹出的wpsUI有wps和新建两个页签,wps页签下空白页,手动再点击下wps正常
手动运行wps正常
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.
所以想知道是否能够 比如打开一个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.
使用ubuntu 20.04 server,在虚拟机下,很稳定。但是在docker下,和虚拟机完全一样,但是现象很奇怪,
调用方法: hr,app = rpc.getWpsApplication()
可能这次成功,然后就失败几十次,然后又成功一次。
这点不太能够理解,如果有错,应该一次都不能够成功。在这个过程中,没有执行任何的其他程序。
用 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 文件?
报错位置:
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的环境中才会出现这个问题,其他环境使用正常。请问我该怎么解决?
问一下 是否存在读取 .wps .et 等wps特定格式的文件方法,相关文档太少,找不到。
运行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'
是什么原因造成的呢?
需要onDocumentBeforeSave()在rpc.registerEvent中调用时提前定义
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)
from pywpsrpc.rpcetapi import etapi
page_setup = etapi.PageSetup
excel列数较多时,通过ExportAsFixedFormat转换pdf文件会出现截取,对 page_setup的Zoom,FitToPagesWide等参数进行设置时,再转换也无法生效。
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
Environment
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.