Modifying textfield font attributes via Basic macro

The Application Programming Interface and the OASIS Open Document Format

Modifying textfield font attributes via Basic macro

Postby PairOdachs » Fri May 03, 2013 8:17 pm

Is it possible to programatically (via Basic macro) change the font attributes (e.g., bold, italics) of a textbox created in the Dialog editor? If so, (a) please point me to an example, (b) please point me to the API documentation, and (c) pretty, pretty please tell me the logic that you used to figure out how to do it (I feel like I'm in a Macro/Dialog noob information maze).
OOo 3.4.1 on Mac OS X 10.6.8
PairOdachs
 
Posts: 31
Joined: Mon Aug 11, 2008 1:10 pm

Re: Modifying textfield font attributes via Basic macro

Postby hanya » Tue May 14, 2013 7:36 pm

a:
Code: Select all   Expand viewCollapse view
Sub DialogTest
  d = CreateUnoDialog(DialogLibraries.Standard.Dialog1)
  oFieldModel = d.getControl("TextField1").getModel()
  oFieldModel.FontWeight = com.sun.star.awt.FontWeight.BOLD
  oFieldModel.FontSlant = com.sun.star.awt.FontSlant.ITALIC
  d.execute()
  d.dispose()
End Sub

b: http://www.openoffice.org/api/docs/comm ... Model.html
Property values starting with "Font" are not listed in the document, they are generated from member of css.awt.FontDescriptor.
c: http://wiki.openoffice.org/wiki/Documen ... /UNO_Tools
Please, edit this thread's initial post and add "[Solved]" to the subject line if your problem has been solved.
Apache OpenOffice 4-dev on Xubuntu 14.04
hanya
Volunteer
 
Posts: 885
Joined: Fri Nov 23, 2007 9:27 am
Location: Japan


Return to UNO API and ODF

Who is online

Users browsing this forum: No registered users and 1 guest