// Path: src/main/java/org/docx4j/convert/out/fo/FOExporterVisitor.java
// public class FOExporterVisitor extends AbstractFOExporter {
// 	protected static final FOExporterVisitorDelegate EXPORTER_DELEGATE_INSTANCE = new 
// 			FOExporterVisitorDelegate();
// 	
// 	protected static FOExporterVisitor instance = null;
// 	
// 	protected FOExporterVisitor() {
// 		super(EXPORTER_DELEGATE_INSTANCE);
// 	}
// 	
// 	public static Exporter<FOSettings> getInstance() {
// 		if (instance == null) {
// 			synchronized(FOExporterVisitor.class) {
// 				if (instance == null) {
// 					instance = new FOExporterVisitor();
// 				}
// 			}
// 		}
// 		return instance;
// 	}
// 
// }


import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import javax.xml.bind.JAXBElement;
import org.apache.commons.io.FileUtils;
import org.docx4j.Docx4J;
import org.docx4j.XmlUtils;
import org.docx4j.convert.out.FOSettings;
import org.docx4j.convert.out.common.Exporter;
import org.docx4j.convert.out.fo.FOExporterVisitor;
import org.docx4j.fonts.PhysicalFonts;
import org.docx4j.jaxb.Context;
import org.docx4j.openpackaging.exceptions.Docx4JException;
import org.docx4j.openpackaging.exceptions.InvalidFormatException;
import org.docx4j.openpackaging.packages.WordprocessingMLPackage;
import org.docx4j.openpackaging.parts.WordprocessingML.MainDocumentPart;
import org.docx4j.vml.CTPath;
import org.docx4j.vml.CTShape;
import org.docx4j.vml.CTShapetype;
import org.docx4j.vml.CTStroke;
import org.docx4j.vml.CTTextbox;
import org.docx4j.vml.wordprocessingDrawing.CTWrap;
import org.docx4j.wml.CTTxbxContent;
import org.docx4j.wml.P;
import org.docx4j.wml.Pict;
import org.docx4j.wml.R;
import org.docx4j.wml.Text;
import org.junit.Ignore;
	    
//	    style="position:absolute;margin-left:0;margin-top:0;width:186.95pt;height:110.55pt;z-index:251659264;visibility:visible;mso-wrap-style:square;mso-width-percent:400;mso-height-percent:200;mso-left-percent:600;mso-wrap-distance-left:9pt;mso-wrap-distance-top:0;mso-wrap-distance-right:9pt;mso-wrap-distance-bottom:0;mso-position-horizontal-relative:left-margin-area;mso-position-vertical:absolute;mso-position-vertical-relative:text;mso-width-percent:400;mso-height-percent:200;mso-left-percent:600;mso-width-relative:margin;mso-height-relative:margin;v-text-anchor:top" 
	    

	    
	    p.getContent().add( r); 
	    
	    p.getContent().add(addFiller());
	    
	    return wordMLPackage;
		
	}
	
	private static void execute(WordprocessingMLPackage wordMLPackage) throws Docx4JException, IOException {
		
	   	// Pretty print the main document part
		System.out.println(
				XmlUtils.marshaltoString(wordMLPackage.getMainDocumentPart().getJaxbElement(), true, true) );
		
		// Optionally save it
		if (save) {
			String filename = System.getProperty("user.dir") + "/OUT_CreateWordprocessingMLDocument.docx";
			wordMLPackage.save(new File(filename) );
			System.out.println("Saved " + filename);
		}
		
		// FO
		if (fo) {
			
			OutputStream baos = new ByteArrayOutputStream();
// Path: src/main/java/org/docx4j/convert/out/fo/FOExporterVisitor.java
// public class FOExporterVisitor extends AbstractFOExporter {
// 	protected static final FOExporterVisitorDelegate EXPORTER_DELEGATE_INSTANCE = new 
// 			FOExporterVisitorDelegate();
// 	
// 	protected static FOExporterVisitor instance = null;
// 	
// 	protected FOExporterVisitor() {
// 		super(EXPORTER_DELEGATE_INSTANCE);
// 	}
// 	
// 	public static Exporter<FOSettings> getInstance() {
// 		if (instance == null) {
// 			synchronized(FOExporterVisitor.class) {
// 				if (instance == null) {
// 					instance = new FOExporterVisitor();
// 				}
// 			}
// 		}
// 		return instance;
// 	}
// 
// }


// Path: src/test/java/org/docx4j/convert/out/XSLFO/TextBoxTest.java
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import javax.xml.bind.JAXBElement;
import org.apache.commons.io.FileUtils;
import org.docx4j.Docx4J;
import org.docx4j.XmlUtils;
import org.docx4j.convert.out.FOSettings;
import org.docx4j.convert.out.common.Exporter;
import org.docx4j.convert.out.fo.FOExporterVisitor;
import org.docx4j.fonts.PhysicalFonts;
import org.docx4j.jaxb.Context;
import org.docx4j.openpackaging.exceptions.Docx4JException;
import org.docx4j.openpackaging.exceptions.InvalidFormatException;
import org.docx4j.openpackaging.packages.WordprocessingMLPackage;
import org.docx4j.openpackaging.parts.WordprocessingML.MainDocumentPart;
import org.docx4j.vml.CTPath;
import org.docx4j.vml.CTShape;
import org.docx4j.vml.CTShapetype;
import org.docx4j.vml.CTStroke;
import org.docx4j.vml.CTTextbox;
import org.docx4j.vml.wordprocessingDrawing.CTWrap;
import org.docx4j.wml.CTTxbxContent;
import org.docx4j.wml.P;
import org.docx4j.wml.Pict;
import org.docx4j.wml.R;
import org.docx4j.wml.Text;
import org.junit.Ignore;

	    
//	    style="position:absolute;margin-left:0;margin-top:0;width:186.95pt;height:110.55pt;z-index:251659264;visibility:visible;mso-wrap-style:square;mso-width-percent:400;mso-height-percent:200;mso-left-percent:600;mso-wrap-distance-left:9pt;mso-wrap-distance-top:0;mso-wrap-distance-right:9pt;mso-wrap-distance-bottom:0;mso-position-horizontal-relative:left-margin-area;mso-position-vertical:absolute;mso-position-vertical-relative:text;mso-width-percent:400;mso-height-percent:200;mso-left-percent:600;mso-width-relative:margin;mso-height-relative:margin;v-text-anchor:top" 
	    

	    
	    p.getContent().add( r); 
	    
	    p.getContent().add(addFiller());
	    
	    return wordMLPackage;
		
	}
	
	private static void execute(WordprocessingMLPackage wordMLPackage) throws Docx4JException, IOException {
		
	   	// Pretty print the main document part
		System.out.println(
				XmlUtils.marshaltoString(wordMLPackage.getMainDocumentPart().getJaxbElement(), true, true) );
		
		// Optionally save it
		if (save) {
			String filename = System.getProperty("user.dir") + "/OUT_CreateWordprocessingMLDocument.docx";
			wordMLPackage.save(new File(filename) );
			System.out.println("Saved " + filename);
		}
		
		// FO
		if (fo) {
			
			OutputStream baos = new ByteArrayOutputStream();
			Exporter<FOSettings> exporter = FOExporterVisitor.getInstance();