【发布时间】:2016-11-09 09:49:55
【问题描述】:
我在 ODT 文档中有一个命名表,我想将包含所有内容的最后一行复制到新行(上图),然后替换此副本中的一些值。
我已经在 Word/VBA 中为 DOCX 完成了这项工作:
Dim tbl As Table
Dim rowNew As Row
Set tbl = ActiveDocument.Tables(1)
Set rowNew = tbl.Rows.Add(tbl.Rows(tbl.Rows.Count))
rowNew.Range.FormattedText = tbl.Rows(tbl.Rows.Count).Range.FormattedText
'~~~> This is required as the above code inserts a blank row in between
tbl.Rows(tbl.Rows.Count - 1).Delete
rowNew.Select
Selection.Find.Execute FindText:="xx*", ReplaceWith:="bar", MatchWildcards:=True
Selection.Collapse
这在 LibreOffice 中也可以吗?到目前为止,我有:
DIM tbl As Variant
DIM row As Variant
tbl = ThisComponent.getTextTables().getByIndex(0)
row = tbl.getRows().getByIndex(tbl.getRows().getCount()-1)
如何选择和复制整个 行 并在这个新行上运行搜索和替换?提示:该行可能包含其他对象,例如子表。
【问题讨论】:
标签: vba libreoffice libreoffice-basic libreoffice-writer