private void traverse(Box box, TableProperties tableProperties) throws Docx4JException { setDefaultFontSize(); traverse( box, null, tableProperties); unsetDefaultFontSize(); }
/** * Convert the well formed XHTML contained in file to a list of WML objects. * * @param file * @param baseUrl * @param wordMLPackage * @return * @throws IOException */ public List<Object> convert(File file, String baseUrl) throws Docx4JException { renderer = getRenderer(); File parent = file.getAbsoluteFile().getParentFile(); try { renderer.setDocument( renderer.loadDocument(file.toURI().toURL().toExternalForm()), (parent == null ? "" : parent.toURI().toURL().toExternalForm()) ); } catch (MalformedURLException e) { throw new Docx4JException("Malformed URL", e); } renderer.layout(); traverse(renderer.getRootBox(), null); return imports.getContent(); }
renderer.layout(); traverse(renderer.getRootBox(), null);
/** * Convert the well formed XHTML found at the specified URI to a list of WML objects. * * @param url * @param wordMLPackage * @return */ public List<Object> convert(URL url) throws Docx4JException { renderer = getRenderer(); String urlString = url.toString(); Document dom =renderer.loadDocument(urlString); renderer.setDocument(dom, urlString); renderer.layout(); traverse(renderer.getRootBox(), null); return imports.getContent(); }
/** * @param node * @param baseUrl * @param wordMLPackage * @return * @throws IOException */ public List<Object> convert(Node node, String baseUrl) throws Docx4JException { renderer = getRenderer(); if (node instanceof Document) { renderer.setDocument( (Document)node, baseUrl ); } else { Document doc = XmlUtils.neww3cDomDocument(); doc.importNode(node, true); renderer.setDocument( doc, baseUrl ); } renderer.layout(); traverse(renderer.getRootBox(), null); return imports.getContent(); }
/** * @param is * @param baseUrl * @param wordMLPackage * @return * @throws IOException */ public List<Object> convert(InputStream is, String baseUrl) throws Docx4JException { renderer = getRenderer(); Document dom = XMLResource.load(is).getDocument(); renderer.setDocument(dom, baseUrl); renderer.layout(); traverse(renderer.getRootBox(), null); return imports.getContent(); }
/** * @param source * @param baseUrl * @param wordMLPackage * @return * @throws IOException */ public List<Object> convert(Source source, String baseUrl) throws Docx4JException { renderer = getRenderer(); Document dom = XMLResource.load(source).getDocument(); renderer.setDocument(dom, baseUrl); renderer.layout(); traverse(renderer.getRootBox(), null); return imports.getContent(); }
/** * @param reader * @param baseUrl * @param wordMLPackage * @return * @throws IOException */ public List<Object> convert(Reader reader, String baseUrl) throws Docx4JException { renderer = getRenderer(); Document dom = XMLResource.load(reader).getDocument(); renderer.setDocument(dom, baseUrl); renderer.layout(); traverse(renderer.getRootBox(), null); return imports.getContent(); }
/** * Convert the well formed XHTML from the specified SAX InputSource * * @param is * @param baseUrl * @param wordMLPackage * @return * @throws IOException */ public List<Object> convert(InputSource is, String baseUrl) throws Docx4JException { renderer = getRenderer(); Document dom = XMLResource.load(is).getDocument(); renderer.setDocument(dom, baseUrl); renderer.layout(); traverse(renderer.getRootBox(), null); return imports.getContent(); }