Questions tagged [xwpf]

XWPF is a Java API to handle Microsoft Word 2007 .docx format files. It is part of the Apache POI project.

XWPF is a Java API to handle Microsoft Word 2007 .docx format files. It is part of the project.

See the Apache POI home page for details.

231 questions
3
votes
1 answer

Add custom (extended) properties to docx and paragraphs by Apache POI

I want to use Apache POI to convert files from *.fidus (Fidus Writer) platform to *.docx format and vice versa. In *.fidus files there are some properties that I need to store them as extended or customised properties in *.docx file, then I can…
MJBZA
  • 4,796
  • 8
  • 48
  • 97
3
votes
1 answer

Insert a bulleted list from an ArrayList Apache POI XWPF

I have an array list that I want to use to create a new bullet list inside a document. I already have numbering (with numbers) and I want to have both (number and bullet) on different lists. My document is pre-populated with some data and I have…
WEGSY85
  • 291
  • 1
  • 3
  • 21
3
votes
1 answer

Insert image in a table's cell using Apache POI's xwpfd

I am working on a program that requires writing results to a .docx in a table format. I need to write images from a folder in some of the table cells, which I have been unable to figure out how to do. The solutions I have seen are to insert the…
Hajo
  • 121
  • 2
  • 14
3
votes
1 answer

Remove Header and Footer from .docx file

Can we remove header and footer of .docx file? I'm using XWPFDocument. If anyone has idea, please help me out.
Sherin
  • 349
  • 1
  • 15
3
votes
3 answers

How to create a header/footer in new docx document?

I would like to create a header and footer on a docx document (a new one and not existing one) with XWPF jars (apache poi). When I use XWPFHeaderFooterPolicy policy = document.getHeaderFooterPolicy(); policy is null, so I would know how to create it…
2
votes
1 answer

Copying and mutating row in a .docx table

I am using Apache POI to process .docx file. I have .docx with 1 row, 1 column table. XWPFTable table = document.getTables().get(0); XWPFTableRow copiedRow = table.getRow(0); table.addRow(copiedRow); The above code successfully copies the row, so…
weno
  • 804
  • 8
  • 17
2
votes
2 answers

Apache POI: ${my_placeholder} is treated as three different runs

I have a .docx template with placeholders to be filled, such as ${programming_language}, ${education}, etc. The placeholder keywords must be easily distinguished from the other plain words, hence they are enclosed with ${ }. for (XWPFTable table :…
weno
  • 804
  • 8
  • 17
2
votes
1 answer

Can XWPFDocument be converted to a Byte[] without saving it to a file first?

is it possible to convert a XWPFDocument to byte[]? I don't want to save it into a file because I don't need it. if there is a possible way to do it, it would help
SH A
  • 95
  • 1
  • 9
2
votes
1 answer

java apache poi - xwpfparagraph to string conversion

Reading the docx file and try to stored in string variable below is my code try { File file = new File(fileName); FileInputStream fileInputStream = new FileInputStream(file.getAbsolutePath()); XWPFDocument…
Prabu
  • 3,550
  • 9
  • 44
  • 85
2
votes
1 answer

Replace text templates inside .docx (Apache POI, Docx4j or other)

I want to do replacements in MS Word (.docx) document using regular expression (java RegEx): Example: …, с одной стороны, и %SOME_TEXT% именуемое в дальнейшем «Заказчик», в лице %SOME_TEXT% действующего на основании %SOME_TEXT% с другой…
kozmo
  • 4,024
  • 3
  • 30
  • 48
2
votes
0 answers

how to keep all style and layout after edit docx with NPOI

I'm working with NPOI in c#.NET then I make .docx file in MS office to make as template my word template contain content like this template.docx Name : {firstname} last name : {lastname} then I using NPOI read and edit my docx file by…
Chanom First
  • 1,136
  • 1
  • 11
  • 25
2
votes
2 answers

Apache POI Word using custom styles for titles

I am trying to create heading titles in a word (.docx) document, using apache-poi. I have a template which contains only custom styles AND example of heading titles using the custom styles. XWPFDocument document=new XWPFDocument(new…
IronRabbit
  • 185
  • 1
  • 2
  • 13
2
votes
1 answer

Apache POI get line breaks from XWPFRun

I have a problem reading whitespaces from a docx file using Apache POI 3.15. I have a Word document with line breaks in it, when reading the file via apache poi I cannot find a way to get those linebreaks. When I Call paragraph.getParagraphText()…
Martin
  • 53
  • 1
  • 9
2
votes
1 answer

How to merge cells horizontally using apache-poi

I get to do a vertically merged using this function: private static void mergeCellsVertically(XWPFTable table, int col, int fromRow, int toRow) { for (int rowIndex = fromRow; rowIndex <= toRow; rowIndex++) { XWPFTableCell cell =…
PABLO PEREZ
  • 41
  • 1
  • 7
2
votes
1 answer

How can I set background colour of a run (a word in line or a paragraph) in a docx file by using Apache POI?

I want to create a docx file by using Apache POI. I want to set background colour of a run (i.e. a word or some parts of a paragraph). How can I do this? Is in possible via Apache POI or not. Thanks in advance
MJBZA
  • 4,796
  • 8
  • 48
  • 97
1 2
3
15 16