Cold_Burn Power User


Joined: 21 Apr 2008 Posts: 62
|
Posted: Fri May 11, 2012 6:36 am Post subject: ExportPDF with a specific PageRange |
|
|
To export a specific PageRange to PDF.
I think it will be useful to others.
| Code: | Boolean lb_result
string ls_docfullpath
OLEObject ioo_objPropertyValue
OLEObject ioo_objPropertyValueArray[]
OLEObject ioo_objPropertyValue1
OLEObject ioo_objPropertyValue2
OLEObject ioo_objPropertyValueArray1[]
OLEObject ioo_objDoc1
OLEObject ioo_objValueObj
if Not IsValid(ioo_obj) or IsNull(as_docfullpath) then return False
if ioo_obj.of_isalive() = FALSE then return False
ioo_objDoc1=ioo_objDesktop.getcurrentcomponent()
ioo_objPropertyValue = ioo_obj.Bridge_GetStruct("com.sun.star.beans.PropertyValue")
ioo_objPropertyValue1 = ioo_obj.Bridge_GetStruct("com.sun.star.beans.PropertyValue")
ioo_objPropertyValue2 = ioo_obj.Bridge_GetStruct("com.sun.star.beans.PropertyValue")
ioo_objPropertyValue2.Name = "PageRange"
ioo_objPropertyValue2.Value = "1-3;6;8" //will take a argument here to accommodate the various PageRange possibilities
ioo_objPropertyValueArray1[upperbound(ioo_objPropertyValueArray1)+1] = ioo_objPropertyValue2
ioo_objValueObj = ioo_objDesktop.Bridge_GetValueObject()
ioo_objValueObj.set("[]com.sun.star.beans.PropertyValue", ioo_objPropertyValueArray1)
ioo_objPropertyValue.Name= "FilterName"
ioo_objPropertyValue.Value= "writer_pdf_Export"
ioo_objPropertyValue1.Name= "FilterData"
ioo_objPropertyValue1.Value= ioo_objValueObj
ioo_objPropertyValueArray[upperbound(ioo_objPropertyValueArray)+1]=ioo_objPropertyValue
ioo_objPropertyValueArray[upperbound(ioo_objPropertyValueArray)+1]=ioo_objPropertyValue1
ls_docfullpath=of_filename2url(as_docfullpath,true)
ioo_objDoc1.storeToURL(ls_docfullpath, ioo_objPropertyValueArray)
return lb_result |
Some of the language is PowerScript but you can see the algorithm.
Cold_Burn |
|