user2147674
user2147674

Reputation: 2489

docx4j move around paragraphs

Assume a document in docx4j:

Headline1
Headline2
 blebleble
  Headline3 
   subtext

All the headlines are paragraphs, how can I move headline 2 and all of it's subcontents to be in front of Headline1?

Upvotes: 1

Views: 235

Answers (1)

JasonPlutext
JasonPlutext

Reputation: 15863

The paragraph structure in docx xml is in the simplest case flat, not hierarchical/nested, so its up to you to determine what "subcontents" are. Is it everything up to your next Headline1? And are those heading styles, or outline levels, or something else?

In any case, the content is just a Java list, so once you know the start and end index of the stuff you want to move, the rest is easy.

I say the paragraph structure in docx xml is flat "in the simplest case", because tables and content controls etc change that a bit.

Upvotes: 1

Related Questions