/** * Bind the content controls of the passed document to the xml. */ public static void bind(WordprocessingMLPackage wmlPackage, Document xmlDocument, int flags, DocxFetcher docxFetcher) throws Docx4JException { bind( wmlPackage, xmlDocument, flags, docxFetcher, null, null, null); // no final formatting step }
/** * Bind the content controls of the passed document to the xml. */ public static void bind(WordprocessingMLPackage wmlPackage, Document xmlDocument, int flags) throws Docx4JException { bind( wmlPackage, xmlDocument, flags, null); }
/** * Bind the content controls of the passed document to the xml. */ public static void bind(WordprocessingMLPackage wmlPackage, String xmlDocument, int flags) throws Docx4JException { ByteArrayInputStream xmlStream = null; if (flags == FLAG_NONE) { //do everything flags = (FLAG_BIND_INSERT_XML | FLAG_BIND_BIND_XML | FLAG_BIND_REMOVE_SDT | FLAG_BIND_REMOVE_XML); } if ((flags & FLAG_BIND_INSERT_XML) == FLAG_BIND_INSERT_XML) { try { xmlStream = new ByteArrayInputStream(xmlDocument.getBytes("UTF-8")); } catch (UnsupportedEncodingException e1) { xmlStream = new ByteArrayInputStream(xmlDocument.getBytes()); } } bind(wmlPackage, xmlStream, flags); }
/** * Bind the content controls of the passed document to the xml. */ public static void bind(WordprocessingMLPackage wmlPackage, InputStream xmlDocument, int flags) throws Docx4JException { if (flags == FLAG_NONE) { //do everything flags = (FLAG_BIND_INSERT_XML | FLAG_BIND_BIND_XML | FLAG_BIND_REMOVE_SDT | FLAG_BIND_REMOVE_XML); } Document xmlDoc = null; if ((flags & FLAG_BIND_INSERT_XML) == FLAG_BIND_INSERT_XML) { try { xmlDoc = XmlUtils.getNewDocumentBuilder().parse(xmlDocument); } catch (Exception e) { throw new Docx4JException("Problems creating a org.w3c.dom.Document for the passed input stream.", e); } } bind(wmlPackage, xmlDoc, flags); }
/** * Bind the content controls of the passed document to the xml (here using optional standardised Answers format). */ public static void bind(WordprocessingMLPackage wmlPackage, Answers answers, int flags) throws Docx4JException { if (flags == FLAG_NONE) { //do everything flags = (FLAG_BIND_INSERT_XML | FLAG_BIND_BIND_XML | FLAG_BIND_REMOVE_SDT | FLAG_BIND_REMOVE_XML); } Document xmlDoc = null; if ((flags & FLAG_BIND_INSERT_XML) == FLAG_BIND_INSERT_XML) { try { xmlDoc = XmlUtils.marshaltoW3CDomDocument(answers); } catch (Exception e) { throw new Docx4JException("Problems creating a org.w3c.dom.Document from Answers", e); } } bind(wmlPackage, xmlDoc, flags); }
/** * Bind the content controls of the passed document to the xml. */ public static void bind(WordprocessingMLPackage wmlPackage, Document xmlDocument, int flags, DocxFetcher docxFetcher) throws Docx4JException { bind( wmlPackage, xmlDocument, flags, docxFetcher, null, null, null); // no final formatting step }
/** * Bind the content controls of the passed document to the xml. */ public static void bind(WordprocessingMLPackage wmlPackage, Document xmlDocument, int flags) throws Docx4JException { bind( wmlPackage, xmlDocument, flags, null); }
/** * Bind the content controls of the passed document to the xml. */ public static void bind(WordprocessingMLPackage wmlPackage, String xmlDocument, int flags) throws Docx4JException { ByteArrayInputStream xmlStream = null; if (flags == FLAG_NONE) { //do everything flags = (FLAG_BIND_INSERT_XML | FLAG_BIND_BIND_XML | FLAG_BIND_REMOVE_SDT | FLAG_BIND_REMOVE_XML); } if ((flags & FLAG_BIND_INSERT_XML) == FLAG_BIND_INSERT_XML) { try { xmlStream = new ByteArrayInputStream(xmlDocument.getBytes("UTF-8")); } catch (UnsupportedEncodingException e1) { xmlStream = new ByteArrayInputStream(xmlDocument.getBytes()); } } bind(wmlPackage, xmlStream, flags); }
/** * Bind the content controls of the passed document to the xml. */ public static void bind(WordprocessingMLPackage wmlPackage, InputStream xmlDocument, int flags) throws Docx4JException { if (flags == FLAG_NONE) { //do everything flags = (FLAG_BIND_INSERT_XML | FLAG_BIND_BIND_XML | FLAG_BIND_REMOVE_SDT | FLAG_BIND_REMOVE_XML); } Document xmlDoc = null; if ((flags & FLAG_BIND_INSERT_XML) == FLAG_BIND_INSERT_XML) { try { xmlDoc = XmlUtils.getNewDocumentBuilder().parse(xmlDocument); } catch (Exception e) { throw new Docx4JException("Problems creating a org.w3c.dom.Document for the passed input stream.", e); } } bind(wmlPackage, xmlDoc, flags); }
/** * Bind the content controls of the passed document to the xml (here using optional standardised Answers format). */ public static void bind(WordprocessingMLPackage wmlPackage, Answers answers, int flags) throws Docx4JException { if (flags == FLAG_NONE) { //do everything flags = (FLAG_BIND_INSERT_XML | FLAG_BIND_BIND_XML | FLAG_BIND_REMOVE_SDT | FLAG_BIND_REMOVE_XML); } Document xmlDoc = null; if ((flags & FLAG_BIND_INSERT_XML) == FLAG_BIND_INSERT_XML) { try { xmlDoc = XmlUtils.marshaltoW3CDomDocument(answers); } catch (Exception e) { throw new Docx4JException("Problems creating a org.w3c.dom.Document from Answers", e); } } bind(wmlPackage, xmlDoc, flags); }