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 8D670D91F for ; Tue, 21 Aug 2012 07:23:45 +0000 (UTC) Received: (qmail 19760 invoked by uid 500); 21 Aug 2012 07:23:45 -0000 Delivered-To: apmail-incubator-ooo-dev-archive@incubator.apache.org Received: (qmail 19689 invoked by uid 500); 21 Aug 2012 07:23:45 -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 19669 invoked by uid 99); 21 Aug 2012 07:23:44 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 Aug 2012 07:23:44 +0000 X-ASF-Spam-Status: No, hits=1.7 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of zongdj001@gmail.com designates 209.85.210.175 as permitted sender) Received: from [209.85.210.175] (HELO mail-iy0-f175.google.com) (209.85.210.175) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 Aug 2012 07:23:37 +0000 Received: by iaky10 with SMTP id y10so3378564iak.6 for ; Tue, 21 Aug 2012 00:23:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=9JsJR6N4l0sePc3q2zjrVRPmcLBhW07Lr0ABichRWwg=; b=x73cXpi1OXUs6d60bSKN5+EO+pjcaUA/YhgKzYe4eCGcnrhbcWHwYhv9ePivkLZjaS igQvqZRJmDxZu/VkHcrvlrGUSd6Xs5xXZlHU/ijvMPUuxicS17X79hSC4KmrAMu3gkpk 3bdUBuQJtTmuhuCoiIDeMGTbIckYdnMV0k2PfY8bB6ou/SE25cqLpobGpdGxLEH5hQB9 Mmy0oxD/1nzDlZXmbHIc5Swa0yggP7cuSFVKF0dIHP3rzZCHlnr35i/IoObUMOXR9QTa VtDL6eJHswQkIU+HpTVP/6fNw4t6RvDcey0E9KZiyFhUeXLij4o3Th3hyen1RpQ0Ip/T vg/A== MIME-Version: 1.0 Received: by 10.42.60.139 with SMTP id q11mr13039393ich.53.1345533796618; Tue, 21 Aug 2012 00:23:16 -0700 (PDT) Received: by 10.50.42.99 with HTTP; Tue, 21 Aug 2012 00:23:16 -0700 (PDT) In-Reply-To: <50332CC4.3020207@pitonyak.org> References: <50332AF5.7080409@pitonyak.org> <50332CC4.3020207@pitonyak.org> Date: Tue, 21 Aug 2012 15:23:16 +0800 Message-ID: Subject: Re: Is this a UNO API bug? From: dongjun zong To: ooo-dev@incubator.apache.org, andrew@pitonyak.org Content-Type: multipart/alternative; boundary=90e6ba25dc2ffb12ba04c7c17f8f --90e6ba25dc2ffb12ba04c7c17f8f Content-Type: text/plain; charset=ISO-8859-1 The strange thing is this API can works fine for doc sample file. I guess this is a bug. 2012/8/21 Andrew Douglas Pitonyak > > OK, I had to look... > > For a text field, see if you can call update. This may not work if the > document has not finished repaginating. I have heard of cases where a > document had not finished doing that before someone tried to do stuff to > it. The solution was to tell the document to full refresh (probably using a > dispatch). > > > > On 08/21/2012 02:30 AM, Andrew Douglas Pitonyak wrote: > >> >> Did you successfully insert the text field? If yes, then after you insert >> a text field, it has probably not yet refreshed its value. Off hand, I >> don't remember exactly what you need to refresh first.... I would need to >> look it up and I really need to run but figured it might help you a bit and >> you can look for the various refresh items (I think that you can refresh >> each index and for fields I think there may be a single master field >> refresh but I don't remember... have not done it in a long time.). >> >> On 08/20/2012 03:32 AM, dongjun zong wrote: >> >>> Hi All, >>> Using UNO API I do below operation. >>> 1.Launch a odt document, >>> 2.Create a page number field and insert into this docment >>> 3.Get the document text >>> >>> But in the step3, page number is not contained in the get text. But if I >>> launch a doc document, I can get the page number in step 3. I think this >>> is >>> a UNO API bug, can some body help confirm? Below is my main code pieces. >>> >>> XMultiServiceFactory sevriceFactory = (XMultiServiceFactory) >>> UnoRuntime.queryInterface(**XMultiServiceFactory.class, document); >>> XTextField pageNumberFiled = >>> (XTextField)UnoRuntime.**queryInterface(XTextField.**class, >>> sevriceFactory.createInstance(**"com.sun.star.text.textfield.**PageNumber")); >>> >>> >>> XPropertySet props = >>> (XPropertySet)UnoRuntime.**queryInterface(XPropertySet.**class, >>> pageNumberFiled); >>> props.setPropertyValue("**NumberingType", 4);//Set page number >>> display as Arabic >>> >>> XTextCursor xTextCursor = document.getText().** >>> createTextCursor(); >>> xTextCursor.gotoEnd(false); >>> >>> document.getText().**insertTextContent(document.**getText().getEnd(), >>> pageNumberFiled, true); >>> >>> >>> String documentString = document.getText().getString()**; >>> System.out.println(**documentString); >>> >>> >> > -- > Andrew Pitonyak > My Macro Document: http://www.pitonyak.org/**AndrewMacro.odt > Info: http://www.pitonyak.org/oo.php > > --90e6ba25dc2ffb12ba04c7c17f8f--