All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.docx4j.finders.SdtFinder Maven / Gradle / Ivy

Go to download

docx4j is a library which helps you to work with the Office Open XML file format as used in docx documents, pptx presentations, and xlsx spreadsheets.

There is a newer version: 11.5.0
Show newest version
package org.docx4j.finders;

import java.util.ArrayList;
import java.util.List;

import org.docx4j.XmlUtils;
import org.docx4j.TraversalUtil.CallbackImpl;
import org.docx4j.wml.SdtElement;

public class SdtFinder extends CallbackImpl {
	
	private List sdtList;
	
	public List getSdtList() {
		return sdtList;
	}

	public SdtFinder() {		
		sdtList = new ArrayList();
	}
	
	@Override
	public List apply(Object wrapped) {
		
		Object o = XmlUtils.unwrap(wrapped);		
		if (o instanceof SdtElement) {
			
			sdtList.add(((SdtElement)o));
			
		}
		return null;
	}
	

}