I have a template A document that people use to fill out information about new projects. Some parts of this information should also be used in a template B document. How can I select and copy specific information in a table (see screenshot) and then paste it into a new template B document in a specific location?
So far, code found from this post:
Sub findCopyPaste
dim oDoc as object, oDesc as object, oFound as object, data as object, oDoc2 as object
oDoc=ThisComponent
oDesc=oDoc.createSearchDescriptor
with oDesc
.SearchString="[:print:]{1,100} / [:digit:]{1,100} / [:digit:]{1,4}"
.SearchRegularExpression=true
end with
oFound=oDoc.findFirst(oDesc)
if NOT isNull(oFound) then 'something is found
oDoc.CurrentController.Select(oFound) 'Select
data=oDoc.currentController.getTransferable 'Copy
oDoc2=StarDesktop.LoadComponentFromUrl("private:factory/swriter", "_blank", 0, array()) 'new document
oDoc2.CurrentController.insertTransferable(data) 'Paste
end if
End Sub
