template document for Base forms via assistent (wizard)

Background: I’m new to LIbreOffice and am having a go at making a db in Base.

Basically, all of my forms have the same design, regardless of the actual functionality or form type. I find the default appearance that I get when generating forms via the assistent (or wizard) hard to read and more or less ugly (small font, ugly background color). I realize the form is generated using a Writer document. It would help me a lot and save me a lot of time if I could default for example to “light blue background, size 14 font, white letters”.

It seems according to my internet research that this not possible. Can that be? Can I define a Writer doc to be used as default appearance? Thanks.

It is, from what I understand, hardcoded in the wizard code, unfortunately.
It should however be possible to create standalone forms using one of the scripting languages, or even externally, that you could then tailor to your particular needs in terms of db connection and usage.

You can always create your own standalone form manually as well via the GUI, save it as a template, and then use that as the basis for any new forms, and adjust the DB bindings as necessary.

Hello,

You can create forms from a Writer document in Base using a small macro.

This is published in the document AndrewBase by Andrew Pitonyak found here → Database access using OpenOffice.org.

Section 2.3.2 deals with creating a form using a macro. While this entails controls as well as the basic form, the end of the routine contains code to convert the Writer document to the Base form.

As mentioned by @iplaw67 you can create the form using the GUI (or even directly with Writer). Then Save as .odt as your template.

Here is the macro:

Option Explicit

Sub Main
    dim oProps(2) as new com.sun.star.beans.PropertyValue
    dim oDocDef, oFormDocs 
    dim sFormName, sVar as string
    sFormName = InputBox("Please enter name for form:", "Form from Writer Document")
    oFormDocs = thiscomponent.FormDocuments
    If oFormDocs.hasByName(sFormName) Then
        sVar = MsgBox(Chr(10) & "Form " & sFormName & " already exists!" & Chr(10) & Chr(10) & "Yes to overwrite; No to Exit", 132, "Form Already Exists!")
        If sVar = 7 Then Exit Sub
        oFormDocs.removeByName(sFormName)
    End If
    oProps(0).Name = "Name"
    oProps(0).Value = sFormName
    oProps(1).Name = "Parent"
    oProps(1).Value = oFormDocs
    oProps(2).Name = "URL"
    oProps(2).Value = convertToUrl("/home/YOUR_DIRECTORY/MyBaseTemplate.odt")
Rem Windows:
    'oProps(2).Value = convertToUrl("C:\YOUR_DIRECTORY\MyBaseTemplate.odt")
    oDocDef = oFormDocs.createInstanceWithArguments("com.sun.star.sdb.DocumentDefinition", oProps())
    oFormDocs.insertbyName(sFormName, oDocDef)
    Print "Added " & sFormName & " to the database"
End Sub

Have slightly modified the original code to allow input of the form name you want and an escape if the form name already exists. You only need to change the line with oProps(2).Value = convertToUrl("LOCATION/NAME") to reflect your template.

The macro should be saved in My Macros & Dialogs in a module under Standard. Forms can then be created using this by executing the macro from your main Base screen menu Tools->Macros->Run Macro....

BTW - has no relation with using the Wizard. It’s either/or.