@@ -145,6 +145,8 @@ private void writeNode(XWPFDocument document, DocumentNode node) throws Exceptio
145145 writeShapeContainer (document , shapeContainer );
146146 } else if (node instanceof ChartNode chart ) {
147147 writeChartFallback (document , chart );
148+ } else if (node instanceof com .demcha .compose .document .node .ListNode list ) {
149+ writeList (document , list );
148150 } else if (node instanceof ContainerNode || node instanceof SectionNode ) {
149151 for (DocumentNode child : node .children ()) {
150152 writeNode (document , child );
@@ -155,6 +157,41 @@ private void writeNode(XWPFDocument document, DocumentNode node) throws Exceptio
155157 // should use the PDF fixed-layout backend.
156158 }
157159
160+ /**
161+ * Semantic list mapping: each item becomes a marker-prefixed paragraph in
162+ * the list's text style; nested items indent two spaces per depth and use
163+ * their own marker when one is set.
164+ */
165+ private void writeList (XWPFDocument document ,
166+ com .demcha .compose .document .node .ListNode list ) {
167+ for (String item : list .items ()) {
168+ writeListLine (document , list .textStyle (),
169+ list .marker ().value () + " " + item , 0 );
170+ }
171+ for (com .demcha .compose .document .node .ListItem item : list .nestedItems ()) {
172+ writeNestedItem (document , list , item , 0 );
173+ }
174+ }
175+
176+ private void writeNestedItem (XWPFDocument document ,
177+ com .demcha .compose .document .node .ListNode list ,
178+ com .demcha .compose .document .node .ListItem item ,
179+ int depth ) {
180+ String marker = item .marker () != null ? item .marker ().value () : list .marker ().value ();
181+ writeListLine (document , list .textStyle (), marker + " " + item .label (), depth );
182+ for (com .demcha .compose .document .node .ListItem child : item .children ()) {
183+ writeNestedItem (document , list , child , depth + 1 );
184+ }
185+ }
186+
187+ private void writeListLine (XWPFDocument document , DocumentTextStyle style ,
188+ String text , int depth ) {
189+ XWPFParagraph para = document .createParagraph ();
190+ XWPFRun run = para .createRun ();
191+ applyStyle (run , style );
192+ run .setText (" " .repeat (depth ) + text );
193+ }
194+
158195 /**
159196 * Semantic chart fallback: the semantic export has no layout pass, so the
160197 * chart's compiled vector geometry is unavailable here. The chart's
0 commit comments