thuliobuarque / java2word

Automatically exported from code.google.com/p/java2word
0 stars 0 forks source link

bulleted lists #86

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago

Bullets are pretty important to me.  How hard is it to get them working?

Thanks!

Original issue reported on code.google.com by bherrma...@gmail.com on 16 Feb 2012 at 8:23

GoogleCodeExporter commented 8 years ago
A work around is to simply use

- bla1
- bla2 

as separate paragraphs.   However when the text is longer than a single line - 
it looks pretty ugly as the subsequent lines aren't indented.

Original comment by bherrma...@gmail.com on 16 Feb 2012 at 8:52

GoogleCodeExporter commented 8 years ago
yes I know what you mean, because it is missing some margin to give the 
identation. 
I have tried but not too hard. 
http://rep.oio.dk/microsoft.com/officeschemas/wordprocessingml_article.htm#wordp
rocessingml_article_section4documentcomponents

I will try again as soon as I have time to read that page and make some 
experiments.

cheers
Leonardo

Original comment by leonardo...@gmail.com on 16 Feb 2012 at 10:45

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Try adding in the bullet point using the HTML hash code. So if u want to add a 
bullet character to the beginning of the string:

sText = "•" + sText;
myCreateHTML = 
ParagraphPiece.with(sText).withStyle().font(Font.ARIAL_NARROW).textColor(strColo
r).fontSize(strSize).create();

Hope it works for you... :)

Original comment by mohammed...@gmail.com on 21 Feb 2012 at 1:26

GoogleCodeExporter commented 8 years ago
Thanks for the tip on the HTML Code.    Although the primary thing I was after 
wasnt just the "look" of the bullet but also the margin.    For example.

   1. yada yada yada yada yada yada yada yada yada yada yada yada prewrap
      wrap yada yada yada yada yada yada 
   2. yada yada yada yada yada yada 

The wrapping and margin are important to make the document readable.

Original comment by bherrma...@gmail.com on 21 Feb 2012 at 2:10

GoogleCodeExporter commented 8 years ago
I am really impressed with the collaboration on the open source community. 
Thanks mohammedv8775 for the discovery. I have been trying to do this bullet 
thing for a while and never found a way to do the actual bulllets mark "•"

I was gonna sleep and checked this email. So decide to post at least a 
guideline how to get this done with margin and bullet points (the workaround). 
It is almost 3am here...

Ok... this is the structure of element:

String myList = "<w:p>
   <w:pPr>
      <w:listPr>
         <w:ilvl w:val="0" /> 
         <w:ilfo w:val="1" /> 
      </w:listPr>
   </w:pPr>
   <w:r>
      <w:t>• {placeholder for item 1}</w:t> 
   </w:r>
</w:p>
<w:p>
   <w:pPr>
      <w:listPr>
         <w:ilvl w:val="0" /> 
         <w:ilfo w:val="1" /> 
      </w:listPr>
   </w:pPr>
   <w:r>
      <w:t>• {placeholder for item 1}</w:t> 
   </w:r>
</w:p>";

When I built java2word, I applied the composite pattern. So elements are 
composited by other elements. This happens when you use the method:

 myDoc.addEle(some IElement);

But thinking about situation when you found out how to do something on your 
own, I created:

myDoc.addEle(some String); 

There is a String version of this method that you can pass anything that 
represents some element. So if you pass "myList" this should create the list in 
your document.

By the way I never doubt creativity of human being. This method above give you 
all you need to go insane and create your own elements.

Obviously this is the workaround as this element doesn't exist yet. And you 
have to replace the place holder and do the look to create as many middle 
blocks you need. 

This would be an easy IElement to be created. If you guys feel like, just go 
for. 

ListItem list = new ListItem(); //implements IElement
list.add("my first line");
list.add("my second line");
myDoc.addEle(list);

Maybe name "ListItem" is not the best... don't know... I m about to sleep 
now... Unit tests should be easy as well. 

thanks a lot guys. 

Leonardo Correa

Original comment by leonardo...@gmail.com on 21 Feb 2012 at 3:08