Hi Fabian, On Fri, May 18, 2012 at 12:22:15PM +0200, fabian wrote: > Hi, > > I am facing the problem that a MailMerge adds empty pages to > a document. I know to avoid those pages the user can select to don't > print empty pages in the printer settings. > > I would like to automatically don't print those pages and tried to > start the printer dialog myself with: > > PropertyValue[] propertyValueArray = new PropertyValue[1]; > propertyValueArray[0] = new PropertyValue(); > propertyValueArray[0].Name = "PrintEmptyPages"; > propertyValueArray[0].Value = new Boolean(false); > > executeDispatch(xDispatchProvider, ".uno:Print", "", 0, > propertyValueArray);
".uno:Print" only supports the following properties: * "PrinterName" String * "FileName" String * "From" Integer * "To" Integer * "Copies" Integer * "RangeText" String * "Selection" Boolean * "Asynchron" Boolean * "Collate" Boolean * "Silent" Boolean Info taken from sfx2/sdi/sfx.sdi: SfxBoolItem Print SID_PRINTDOC * SfxStringItem PrinterName SID_PRINTER_NAME * SfxStringItem FileName SID_FILE_NAME * SfxInt16Item From SID_PRINT_FIRST_PAGE * SfxInt16Item To SID_PRINT_LAST_PAGE * SfxInt16Item Copies SID_PRINT_COPIES * SfxStringItem RangeText SID_PRINT_PAGES * SfxBoolItem Selection SID_SELECTION * SfxBoolItem Asynchron SID_ASYNCHRON * SfxBoolItem Collate SID_PRINT_COLLATE * SfxBoolItem Silent SID_SILENT In AOO 3.4, setting any argument will send directly to the printer, instead of display the print dialog. I don't know if this is a feature or a bug. > Unfortunatly this has no influence on the settings in the print > dialog. I have also tried to save and load the document with the > property: > > property.Name = "IsSkipEmptyPages"; property.Value = new > Boolean(true); > > but I guess this works only in case one exports a pdf. > > > Has anybody a solution in which the user does't have to care about > empty pages himself? "PrintEmptyPages" is a property of service com::sun::star::text::PrintSettings http://www.openoffice.org/api/docs/common/ref/com/sun/star/text/PrintSettings.html#PrintEmptyPages This service is included by the service com::sun::star::text::DocumentSettings http://www.openoffice.org/api/docs/common/ref/com/sun/star/text/DocumentSettings.html com::sun::star::text::DocumentSettings has to be instanciated at the document's factory: Sub Main Dim oDoc as Object oDoc = ThisComponent Dim oDispatchProvider as Object Dim oDispatchHelper as Object oDispatchProvider = oDoc.getCurrentController().getFrame() oDispatchHelper = CreateUnoService("com.sun.star.frame.DispatchHelper") '=================================================================== ' Document Settings 'com.sun.star.text.DocumentSettings 'com.sun.star.text.PrintSettings 'com.sun.star.text.PrintPreviewSettings Dim oDocumentSettings as Object oDocumentSettings = oDoc.createInstance("com.sun.star.document.Settings") oDocumentSettings.setPropertyValue("PrintEmptyPages", False) oDispatchHelper.executeDispatch(oDispatchProvider,".uno:Print","_self",0,oArguments) End Sub In this cases, the API reference is your friend: http://www.openoffice.org/api/docs/common/ref/index-files/index-1.html Regards -- Ariel Constenla-Haile La Plata, Argentina
pgpB4kgWObsTU.pgp
Description: PGP signature
