我在 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)
如何选择和复制整行并在新行上运行搜索和替换?提示:该行可能包含其他对象,例如子表。