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 336FED7DE for ; Thu, 23 Aug 2012 07:33:45 +0000 (UTC) Received: (qmail 95494 invoked by uid 500); 23 Aug 2012 07:33:44 -0000 Delivered-To: apmail-incubator-ooo-dev-archive@incubator.apache.org Received: (qmail 95357 invoked by uid 500); 23 Aug 2012 07:33:44 -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 95331 invoked by uid 99); 23 Aug 2012 07:33:43 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Aug 2012 07:33:43 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of tingxiaox@gmail.com designates 209.85.220.175 as permitted sender) Received: from [209.85.220.175] (HELO mail-vc0-f175.google.com) (209.85.220.175) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Aug 2012 07:33:36 +0000 Received: by vcbfy27 with SMTP id fy27so488160vcb.6 for ; Thu, 23 Aug 2012 00:33: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=rJ1Jry36lnGZWjENYW0zuoC4pq4hf8rQn8VyFuYQMU8=; b=NKA1qiB42jRUyClrc2sVRZ4bj89kQ8p1J+mfXF/hG118UwCyj6cFr/Gj+T7p7jbPYs Nns+Zoxnv3GM7j+s3RxYzQIAdQbTRZWfSMEwrZ4z+LyNXd7JvpCRHq2h+jWt3vWuc+2R GnhDT7UM6tRUwFtSXtmSU0W5cZLUbQy0Fe2gMgNhO5gugzLAI9jraMmPjO8oFrAc2uT3 fQ+LlccfUxwWTtZz78ZU9oneBkpLoOCaqZRi6O30cxyB4AIaKU4xq2cnhMW2lOhNqY5d RiLJY86/gpTtg/jTVd6s3+6zfws12rXBZA4LYcrHKufJmSTJKr37MhAuHBxCR1d89RxX uRMA== MIME-Version: 1.0 Received: by 10.58.229.166 with SMTP id sr6mr472355vec.52.1345707196020; Thu, 23 Aug 2012 00:33:16 -0700 (PDT) Received: by 10.58.143.108 with HTTP; Thu, 23 Aug 2012 00:33:15 -0700 (PDT) In-Reply-To: References: Date: Thu, 23 Aug 2012 15:33:15 +0800 Message-ID: Subject: Re: How to insert Table with AutoCaption in swriter? From: Xiao Ting Xiao To: ooo-dev@incubator.apache.org Content-Type: multipart/alternative; boundary=047d7bea411263f72704c7e9df77 X-Virus-Checked: Checked by ClamAV on apache.org --047d7bea411263f72704c7e9df77 Content-Type: text/plain; charset=ISO-8859-1 Thanks a lot, chengjh. It's very helpful. I'll not waste time on this test via UNO api. On Thu, Aug 23, 2012 at 3:04 PM, chengjh wrote: > HI Xiao Ting, > > As I know, currently, it seems not able to do as you expect..The option > settings are stored in class SwModuleOptions, which defines a variable > named by "pModuleConfig" in class SwModule,accessible > globally.Theoretically, the pair APIs "setPropertyValue" > and "getPropertyValue" provided by css::beans::XPropertySet can be used to > set/get the certain settings,such as the AutoCaption configuration > because css::beans::XPropertySet is a parent interface of > SwXTextDocument,equal position with XTextDocument mentioned in your code > segment..Developers can get its instance from the similar code segment as > below.Please double confirm because I didn't code or verify.. > > XComponent xComponent = unoApp.newDocument("swriter"); > XPropertySet xPS = ( XPropertySet )UnoRuntime.queryInterface( > XPropertySet.class, xComponent); > > > Unfortunately,the implementations of "setPropertyValue" > and "getPropertyValue" in class SwXTextDocument don't provide the code to > set/get the AutoCaption configuration value. Hope it helpful for you.. > > On Thu, Aug 23, 2012 at 9:19 AM, Xiao Ting Xiao > wrote: > > > Hi all, > > > > I want to use UNO api to verify swriter's AutoCaption configuration. > > In order to whether it is feasible, I made the following steps: > > > > Step 1, > > I manually configure swriter's AutoCaption via menu > > Tools-->Options-->OpenOffice.org Writer-->AutoCaption, check > > "OpenOffice.org Writer Table" to automatically add caption when inserting > > table. > > > > Step 2, > > I run the following script to insert table via UNO api, but caption was > not > > added automatically. > > > > XComponent xComponent = unoApp.newDocument("swriter"); > > XTextDocument xTextDocument > > =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, > xComponent); > > XText xText = xTextDocument.getText(); > > XTextCursor xTextCursor = xText.createTextCursor(); > > XMultiServiceFactory xWriterFactory > > > > > =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, > > xTextDocument); > > XTextTable xTable = > > (XTextTable)UnoRuntime.queryInterface(XTextTable.class, > > xWriterFactory.createInstance("com.sun.star.text.TextTable")); > > xText.insertTextContent(xTextCursor,xTable,false); > > > > Is there extra operation I need to do? or it is not feasible to verify > > AutoCaption configuration via UNO api? > > > > Thanks your response. > > > > > > -- > > Best Regards,Jianhong Cheng > --047d7bea411263f72704c7e9df77--