OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

How to hide/show paragraphs programmatically?

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
Chriz
Newbie
Newbie


Joined: 08 Sep 2009
Posts: 4

PostPosted: Tue Sep 08, 2009 1:52 am    Post subject: How to hide/show paragraphs programmatically? Reply with quote

Hi all,
I am a newbie to OO and now I am working on a project in Java. I want to use the UNO API to hide the specific paragraphs in the editor view. I've already got the paras' enumeration, but dont know what to do next.
I've found a thread http://api.openoffice.org/servlets/ReadMsg?listName=dev&msgNo=8993 talking about this question. However I cannot create a TextSection instance. Below is my code snippet:
XMultiServiceFactory factory = (XMultiServiceFactory) UnoRuntime
.queryInterface(XMultiServiceFactory.class, xTDoc);
XTextSection section = factory.createInstance("com.sun.star.text.TextSection");//interrupt at this line, the factory is not null in the debug view.

So is there anything wrong with the creation of TextSection? Or is there any way to hide/show the paragraphs?
Thanks.
_________________
Chris
Back to top
View user's profile Send private message
Chriz
Newbie
Newbie


Joined: 08 Sep 2009
Posts: 4

PostPosted: Tue Sep 08, 2009 5:33 pm    Post subject: Reply with quote

I know the problem. It is because of the casting method in OO, the below code works:
XTextSection textSection = (XTextSection) UnoRuntime.queryInterface(XTextSection.class,factory.createInstance("com.sun.star.text.TextSection"));
Very Happy

However this method seems not perfect, because when I set the IsVisible property true, there comes out a border round each textsection. This is different from the original view of those paragraphs. So back to my question, is there any good way to programmatically hide/show paragraphs?

Thank you all.
_________________
Chris
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group