Pregunta

I'm using docx4j to create a docx file. I want my table border to be blue colored but it is only showing black.how to do this?

Here is my code:

            table.setTblPr(new TblPr()); 
            CTBorder border = new CTBorder();   
            border.setColor("FFF");      
            border.setSz(new BigInteger("0")); 
            border.setSpace(new BigInteger("0"));
            border.setVal(STBorder.SINGLE);  
            TblBorders borders = new TblBorders();    
            borders.setBottom(border);     
            borders.setLeft(border);   
            borders.setRight(border);   
            borders.setTop(border);    
            borders.setInsideH(border); 
            borders.setInsideV(border);

            table.getTblPr().setTblBorders(borders); 
¿Fue útil?

Solución

You need to set the color attribute of the border in question. Your example code appears to have you setting a colour of 'FFF' which obviously won't work if it needs to be blue! I would suggest trying a straight blue in hex and going from there. For example a (very) standard blue would be:

CTBorder border = new CTBorder();
border.setColor("0000FF");      
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top