oliverbass Newbie

Joined: 25 Jan 2006 Posts: 3
|
Posted: Thu Feb 02, 2006 2:09 am Post subject: PDF export for Calc - sheet/range selection |
|
|
Hello all,
The following macro saves my Calc file as .ini file and exports it as a PDF file
I would like to export only a specified sheet or a specified range but I don't manage to adapt the macro the proper way.
Could someone help ?
Thanks,
Olivier
Sub smalltest
dim nomfichier as String
dim document as object
dim feuille as Object
document = StarDesktop.getCurrentComponent()
feuille = document.Sheets.getByName ("Feuille1")
nomfichier = feuille.getCellRangeByName("B30").String
msgbox (nomfichier)
rem
rem -------------Enregistrement du fichier .ini
rem
dim args1(2) as new com.sun.star.beans.PropertyValue
args1(0).Name = "FilterName"
args1(0).Value = "Text - txt - csv (StarCalc)"
args1(1).Name = "FilterOptions"
args1(1).Value = "9,34,ANSI"
args1(2).Name = "SelectionOnly"
args1(2).Value = true
document.storeToURL("file:///C:/"+Nomfichier+".ini",args1())
rem
rem -------------Enregistrement du fichier PDF--------------------------
rem
document.storeToURL("file:///C:/"+Nomfichier+".pdf", Array(MakePropertyValue("FilterName", "calc_pdf_Export"))
End Sub
Function MakePropertyValue( Optional cName As String, Optional uValue ) As com.sun.star.beans.PropertyValue
Dim oPropertyValue As New com.sun.star.beans.PropertyValue
If Not IsMissing( cName ) Then
oPropertyValue.Name = cName
EndIf
If Not IsMissing( uValue ) Then
oPropertyValue.Value = uValue
EndIf
MakePropertyValue() = oPropertyValue
End Function |
|