Page 1 of 1

How to Format Table With Dotted Line Borders & Blue Color

PostPosted: Fri Apr 13, 2018 4:12 am
by arthurw
So I am trying to figure out how to format a table with dotted lines borders where the dotted lines are blue in color.

But since there is no API I am not sure where to begin.

Thank goodness for code completion I was able to resolve this by trial and error but any API and some documentation would help, perhaps? (solution: STBorder.DASHED for CTBorder.setVal...)

Re: How to Format Table With Dotted Line Borders & Blue Colo

PostPosted: Fri Apr 13, 2018 3:20 pm
by jason
Create the content you want in Word, then use the docx4j Helper Word AddIn, or the docx4j webapp, to generate corresponding code.

Re: How to Format Table With Dotted Line Borders & Blue Colo

PostPosted: Tue Apr 17, 2018 4:25 pm
by arthurw
jason wrote:Create the content you want in Word, then use the docx4j Helper Word AddIn, or the docx4j webapp, to generate corresponding code.



Pardon me but I checked out the webapp and the addin.

I am still unsure about how precisely this is supposed to work.

Ok I tested it with a simple word file containing a simple table with borders and a cell called Test inside.
Test.docx
Test File with simple table
(13.38 KiB) Downloaded 263 times


I would like to see how to create a table like this in a docx file.

Ofcourse I know the code because there are sample examples on various websites but if I knew the API it would be helpful also.

I go to the webapp link on the top right hand corner of the page (I had to search for that).

Then I upload the file and get the following screen shot :
Table For Docx4j.JPG
Table Docx File Output
Table For Docx4j.JPG (229.02 KiB) Viewed 1500 times


When I click on the links I see xml.
I do not see how to create a table code. Which I am expecting.

I am expecting code like this (well actually this is so difficult a task that people are asking in other forums and getting responses):

https://stackoverflow.com/questions/199 ... ith-docx4j


So I know you are repeating yourself in various places on this forum since 2008 . Would it not be great if there were some easily accessible user friendly (developer friendly mind you) docs that allow us to see what to do ?

Maybe I am missing something in the steps you outlined for us? Is there something we can do to help?

Re: How to Format Table With Dotted Line Borders & Blue Colo

PostPosted: Tue Apr 17, 2018 4:43 pm
by jason
After you have clicked on the Main Document Part, click on the element name for which you want to generate content (eg w:tbl)

Re: How to Format Table With Dotted Line Borders & Blue Colo

PostPosted: Wed Apr 18, 2018 3:54 am
by arthurw
jason wrote:After you have clicked on the Main Document Part, click on the element name for which you want to generate content (eg w:tbl)


It took some effort deciphering what you meant in the above but once I clicked on the hyperlink (I did not notice the hyperlink before) I was like WOW! :
1) should this not be mentioned somewhere prominent? perhaps its a little inaccessible?
2) the code generated is massive for a simple table . I just perused it but I will go over it again but you told me to click on w:tbl and I did because I know about the Tbl class. But any newcomer would take a long time to figure this out, perhaps?

It is odd to get generated code - when most of our lives we try to look at the documented API.

Nonetheless thanks for this document and this API and library.

Sincerely and respectfully,