删除libre或openoffice的python宏中的回车符

2024-05-21 00:33:26 发布

您现在位置:Python中文网/ 问答频道 /正文

我尝试用python为libre/openoffice编写宏。你知道吗

我用它来替换一些字符串,它是工作的:

document = XSCRIPTCONTEXT.getDocument()
search = document.createSearchDescriptor()
search.SearchString = "\:\Z"
search.SearchAll = True
search.SearchCaseSensitive = False
search.SearchRegularExpression = True
selsFound = document.findAll(search)

if selsFound.getCount() == 0:
    return
for selIndex in range(0, selsFound.getCount()):
    selFound = selsFound.getByIndex(selIndex)

    selFound.setString("")

但现在我想把一辆马车移走,却找不到办法。 例如:

Mister Dean :
blablablalblal lbbla

Mister Dean : blablablablabla

我尝试使用\n或\r,但libre office不识别该术语。你知道吗

谢谢大家:)


Tags: 字符串truesearchdocumentopenofficelibremisterdean
1条回答
网友
1楼 · 发布于 2024-05-21 00:33:26

我的(lo4.1.6.2/Linux)联机帮助告诉我使用\n搜索用Ctrl+Enter输入的newline character。你知道吗

如果没有给出替换指令,我就得到你想要的。 我很确定这将适用于Python(实际上我用StarBasic测试了它)。你知道吗

编辑:更正的键盘组合

相关问题 更多 >