Return-Path: X-Original-To: apmail-incubator-ooo-dev-archive@minotaur.apache.org Delivered-To: apmail-incubator-ooo-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 70309C709 for ; Thu, 24 May 2012 15:43:01 +0000 (UTC) Received: (qmail 80675 invoked by uid 500); 24 May 2012 15:43:01 -0000 Delivered-To: apmail-incubator-ooo-dev-archive@incubator.apache.org Received: (qmail 80628 invoked by uid 500); 24 May 2012 15:43:01 -0000 Mailing-List: contact ooo-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ooo-dev@incubator.apache.org Delivered-To: mailing list ooo-dev@incubator.apache.org Received: (qmail 80620 invoked by uid 99); 24 May 2012 15:43:01 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 May 2012 15:43:01 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [82.146.102.94] (HELO pmgroup.be) (82.146.102.94) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 May 2012 15:42:54 +0000 Received: from [192.168.0.37] ([192.168.0.37]) by mail.pmgroup.be (PMGroup Mailserver) with ASMTP id IUN59111 for ; Thu, 24 May 2012 17:41:11 +0200 Message-ID: <4FBE567A.3020604@pmgroup.be> Date: Thu, 24 May 2012 17:40:42 +0200 From: Fernand Vanrie User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: ooo-dev@incubator.apache.org Subject: Re: [EXT] Printing without empty pages References: <20120524145422.GA1682@localhost> In-Reply-To: <20120524145422.GA1682@localhost> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Ariel , Thanks very instructive (as always) but can you tell me why this "com.sun.star.document.Settings" are not available as a property off the document ? Greetz Fernand > 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