Page 1 of 1

Add text to "Author" field without replacing existing text

PostPosted: Tue Dec 01, 2020 1:21 pm
by fracture62
Hello,

so I am running a script that processes a document and sets certain text inside the author field, for that I use:

Code: Select all   Expand viewCollapse view
oDoc.getDocumentProperties().Author = cPrintText

however some documents have pre-existing text in the author field, and this will overwrite it.

How would I go about keeping the existing text in the field and just adding the wanted text to it?

Re: Add text to "Author" field without replacing existing te

PostPosted: Tue Dec 01, 2020 1:34 pm
by RoryOF
Have your code read the existing text, then append the new to it and write it back.

Re: Add text to "Author" field without replacing existing te

PostPosted: Tue Dec 01, 2020 2:29 pm
by JeJe
That's done with &

Assuming you want a space " " between old and new

Code: Select all   Expand viewCollapse view
oDoc.getDocumentProperties().Author =  oDoc.getDocumentProperties().Author & " " & cPrintText