incubator-odf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Devin Han <devin...@apache.org>
Subject Re: how can I style a list using OdfTextListStyle?
Date Sat, 31 Mar 2012 01:30:35 GMT
Please reference this demo:
http://incubator.apache.org/odftoolkit/simple/demo/demo4.html
and this description in cookbook:
http://incubator.apache.org/odftoolkit/simple/document/cookbook/Text%20Document.html#List

Now, List API support 3 types of lists, ListType.BULLET, ListType.NUMBER
and ListType.IMAGE. The default created list is ListType.BULLET, bullet
list. How to create a number list or a image list then? ListDecorator has
powerful functions that can help you. ListDecorator is an interface which
decides how to decorate a list and its list items. We supply 4
implementations of this interface, BulletDecorator, NumberDecorator,
ImageDecorator and OutlineDecorator.

     // create a number list.
        ListDecorator numberDecorator = new NumberDecorator(document1);

        List numberList1 = document1.addList(numberDecorator);

        List numberList2 = new List(document1, numberDecorator);


You can implement your own ListDecorator as need, or extend the default
four implementations.
 You can remove a list from the document, the following two methods are
same.


2012/3/31 Grzegorz Kaczor <gkaczor@e-point.pl>

> Hello,
>
> I defined some list styles in an ODT file and now I would like to
> programmatically create a list that uses one of them.
>
> I managed to access the created styles via
> TextDocument.getStylesDom().getOfficeStyles().getListStyle(styleName) but
> now I don't know how to apply it to a list or list item. Could you please
> help me?
>
> Thanks and best regards,
> GK
>



-- 
-Devin

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message