简体   繁体   English

Java到Word文档表颜色

[英]Java to Word Document Table Color

Hi I can write a table into a word document as the code below... I wonder how do you add table cell background colour? 嗨,我可以将表格写入Word文档中,如下代码所示。我想知道如何添加表格单元格背景色?

    IDocument myDoc = new Document2004();
    //myDoc.addEle(BreakLine.times(1).create()); 
    Table tbl = new Table();

    tbl.addTableEle(TableEle.TH, "Jira Number", "Description","asd","ee");


    myDoc.addEle(tbl);

yes you can. 是的你可以。

Try to instantiate a TableV2 rather than Table. 尝试实例化一个TableV2而不是表。

take a look at the example: 看一个例子:

http://java2word.blogspot.com.au/2012/02/huge-ms-word-documents-with-java2word.html http://java2word.blogspot.com.au/2012/02/huge-ms-word-documents-with-java2word.html

you'll have to do something like this "withStyle().bgColor("00FFFF")" in your fluent interface code. 您必须在流畅的界面代码中执行类似“ withStyle()。bgColor(“ 00FFFF”)“的操作。

cheers Leonardo Correa 欢呼莱昂纳多·科雷亚

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM