Build DOCX files from scratch

Mar 13, 2014 at 11:08 PM
I've been using NPOI (1.2.5) for a while to make XLS files, and I recently discovered the NPOI 2.0.6 which I would like to use to build DOCX files from scratch.

I've been looking for a XWPF styled table example, and found very little, I got the example Simple Table working, and found a styled Table example from POI, but calling, <tcpr.tcPrChange = new CT_TcPrChange();> whether, I make any additional calls to the tcpr object or not (<tcpr.AddNewShd().fill = "A7BFDE";>), causes the Table to render BADLY (WHOLE CELL IS BLACK). I would like to change the fill color:
tcpr.tcPrChange = new CT_TcPrChange();
tcpr.AddNewShd().fill = "A7BFDE";

The following is a summary of my success and failures:

XWPF Success:
  • Create Paragraphs
  • Set Font-Family
  • Set Font-Size
  • Set Font-Bold
  • Set Text
  • Set Run-Color
  • Create Table
  • Access Table-Cell-Paragraph
  • Create Runs in Table-Cells
  • SetInsideVBorder & SetInsideHBorder
XWPF Fail:
  • AddPicture
  • Set Table-Width
  • Set Table-Column-Width
  • Set Table-Row-Height
  • Set Table-Cell-Background-Color
  • Set Table-SetOutsideVBorder & Table-SetOutsideHBorder
  • Set Page-Header/Footer
  • Set Page-Orientation-Landscape (maybe not event supported in POI yet?)
Are any or all of these expected to work at this time?
If so, where can I find example code for each?

Apr 12, 2014 at 9:01 PM
Read this: (But it's in Chinese, you can check the code directly)
May 13, 2014 at 11:43 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
May 14, 2014 at 1:10 AM
I had managed to achieve a table of similar quality to the one shown in archive 614, and successfully created a Run in Table Cells.
However failure to set background color (this seemed really close) and inability to rotate text 90 degrees, make NPOI unsatisfactory for my project.