incubator-ooo-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 120625] [UNO API]can't get the text of "TextField PageNumber" by XTextDocument.getText()
Date Wed, 22 Aug 2012 07:16:27 GMT
https://issues.apache.org/ooo/show_bug.cgi?id=120625

--- Comment #8 from zong dong jun <zongdj001@gmail.com> ---
Java Code as below. I have found the reason of this problem, if I add a sleep
after inert page number field, I can get the page number value.

public void createPageNumber(XComponent component) {
        XMultiServiceFactory sevriceFactory = (XMultiServiceFactory)
UnoRuntime.queryInterface(XMultiServiceFactory.class, component);
        XTextField pageNumberFiled;
        try {
            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", NumberingType.ARABIC);//Set
page number display as Arabic
            props.setPropertyValue("SubType", PageNumberType.CURRENT);


             document.getText().insertTextContent(document.getText().getEnd(),
                     pageNumberFiled, true);
//             try {
//                Thread.sleep(1000);
//            } catch (InterruptedException e) {
//                e.printStackTrace();
//            }

             System.out.println(document.getText().getString());

        } catch (com.sun.star.uno.Exception e) {
            e.printStackTrace();
        }

-- 
You are receiving this mail because:
You are the assignee for the bug.

Mime
View raw message