Bonjour,
code définitif pour réaliser une exportation PDF d'une zone à imprimer :
Sub ExportPDF
Dim oDoc As Object , Feuille As Object, Cellule As Object, ZonePrint As Object
Dim Chemin As String, Fichier As String
Dim adressePdfURL As String
Dim propFich(1) As New com.sun.star.beans.PropertyValue
Dim filterProps(2) As New com.sun.star.beans.PropertyValue
oDoc = ThisComponent
Feuille = oDoc.Sheets.getByName("Facture")
Cellule = Feuille.getCellRangeByName ("C2")
Fichier = Cellule.getString & ".pdf"
Chemin = "D:\Libre Office\LOCalc\AFPP-Calc\Calc_spécial"
adressePdfURL = convertToURL(Chemin & "\" & Fichier)
ZonePrint = Feuille.getCellRangeByName("A1:G17")
filterProps(0).Name = "Selection"
filterProps(0).Value = ZonePrint
filterProps(1).Name = "CompressMode"
filterProps(1).Value = 1
propFich(0).Name = "FilterName"
propFich(0).Value = "calc_pdf_Export"
propFich(1).Name = "FilterData"
propFich(1).Value = filterProps()
oDoc.StoreToURL(adressePdfURL, propFich())
MsgBox("Fin export pdf")
Merci à Michel
A+