Bonjour,Avec libreoffice 4.3.3.2, je cherche désespérément à ajouter un champ formaté à un rapport fait avec report builder.
J'arrive à cloner un champ puis à modifier ses propriétés mais je n'arrive pas à ajouter directement un champ formaté avec basic dans mon raport.
Voici ce qui marche (j'ai un nouveau champ toto dans mon rapport) :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_Artistes-Albums-Pistes", "", 23, aProp())
maintenant si je créé le champ toto en remplaçant les deux lignes entre commentaires par :
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)
je n'obtiens pas de message d'erreur mais je n'ai pas de nouveau champ toto dans mon rapport.Est-ce que j'oublie une propriété?Comment procéder?
Merci encore pour votre aide.