Пример #1
0
def test_wps():
    hr, rpc = createWpsRpcInstance()
    app = RpcProxy(rpc.getWpsApplication())
    docs = app.Documents

    docs.Add()
    print(len(docs))

    docs.Add()
    print(len(docs))

    # index starts from 1, not 0
    for i in range(1, len(docs) + 1):
        print("index.docName: ", docs[i].Name)

    for doc in docs:
        print("iter.docName: ", doc.Name)

    # use raw object
    for doc in RpcIter(docs.rpc_object):
        print("iter2.docName: ", doc.Name)

    # access by name
    name = docs[2].Name
    doc = docs[name]
    print("doc", doc.Name)

    doc = docs.Open(os.path.dirname(os.path.realpath(__file__)) +
                    "/../pyproject.toml",
                    ReadOnly=True)
    for para in doc.Paragraphs:
        print(para.Range.Text)

    app.Quit()
Пример #2
0
def _onAfterPresentationOpen(Pres):
    Pres.AddRef()
    print("_onAfterPresentationOpen: ", RpcProxy(Pres).Name)