Access/Update Mail Merge Field in Writer form

Creating and using forms
Post Reply
dreamquartz
Posts: 918
Joined: Mon May 30, 2011 4:02 am

Access/Update Mail Merge Field in Writer form

Post by dreamquartz »

Hello All,

Need to be able to access/update Mail Merge Fields in a Writer document where the is no form.

I am trying to modify a simple Basic Macro, we use for opening forms with Filtered info, but I get stuck on the form issue.

Code: Select all

REM  *****  BASIC  *****
Const cDoc = "!fUpdateProjectInfo"
Const cForm = "fProjectNumber"
Const cHere = "FKProjectNumberID"
Const cThere = "ProjectNumber"

sub fUpdateProjectInfo(ev)
GlobalScope.BasicLibraries.loadLibrary("Tools")
sPath = DirectoryNameoutofPath(ThisComponent.URL, "/")
sPath = sPath &"/"& cDoc &".odt"
thisForm = ev.Source.Model.Parent
i = thisForm.findColumn(cHere)
var = thisForm.getString(i)
doc = StarDesktop.loadComponentFromURL(sPath, "_default", 0, Array())
form = doc.DrawPage.Forms.getByName(cForm)
form.Filter = ""& cThere &" = "& var &""
form.reload()
End Sub
As is shown above, there is the Constant cForm, This macro runs without a problem, because the form does exist.
Now I am trying to use a modified version of this macro where there is no cForm.

Using the Mail Merge function on a pre-formatted background in Writer, the ResultSet of Queries are easily placed. The forms are always forwarded in pdf-format.
When creating these type of forms, there are no forms needed. Using the 'Form Navigator' no forms are shown.

Now my question is how use access/update cThere if there are no forms.

Any suggestions are highly appreciated.

Dream
LO 7.x, HSQLDB 2.7.x & Ubuntu 24.04 LTS.
Bidouille
Volunteer
Posts: 700
Joined: Mon Nov 19, 2007 10:58 am
Location: France

Re: Access/Update Mail Merge Field in Writer form

Post by Bidouille »

Save our time and provide a sample document.

NB: This question should have been posted in the forum dedicated to macros
Post Reply