Hello everyboby,
I use LibreOffice 4.3.3.2 and desperatly look for a mean to add  a formatted 
field in a report made with reportbuilder. I manage to clone a field and then 
modify its properties but I don't manage to _directly_ add a formatted field in 
a report with a basic macro.
So here is what works fine (that is to say I get a new field in my report) :dim 
oConnection as object
dim aProp(2) as new com.sun.star.beans.PropertyValue
dim oReportsDocuments as object
dim oReportDesign as object
oConnection = ThisDatabaseDocument.DataSource.getconnection("","")
aProp(0).Name = "ActiveConnection"
aProp(0).Value = oConnection
aProp(1).Name = "Hidden"
aProp(1).Value = true
aProp(2).Name = "OpenMode"
aProp(2).Value = "openDesign"
oReportsDocuments = ThisDatabaseDocument.ReportDocuments
'Open report in design mode and hidden
oReportDesign = oReportsDocuments.loadComponentFromURL("Rapport1", "", 0, 
aProp())
REM ###############################
oField = oReportDesign.Detail.getbyindex(1).createclone
oField.name="toto"REM ###############################
oReportDesign.detail.add(oField)
aProp(1).Value = false
aProp(2).Value = "open"
' Now the result of the report wil be showed. and the hidden report in design 
mode is closed
oReportsDocuments.loadComponentFromURL("Rapport1", "", 23, aProp())

If I now create my "toto" field by replacing the two lines between REM 
instructions by :oField = 
createUnoService("com.sun.star.comp.report.OFormattedField")
with oField
    .name = "toto"
    .datafield = "field:[Format]"
    .positionX = 14000
    .positionY = 0
    .width = 2000
    .height = 500
end with
oReportDesign.detail.add(oField)I get no error message but I get no new field 
in my report either.So my questions are :what am I missing because I think I am 
not too far from the solution (no error)?Do I forget to set an important 
property in the oField object?I a word : how to solve this problem?
Thank you so much for your help. Really.Best regards.Felix.

-- 
To unsubscribe e-mail to: [email protected]
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

Reply via email to