@Override protected POIXMLFactory getChartFactory() { return XWPFFactory.getInstance(); }
public XWPFDocument(OPCPackage pkg) throws IOException { super(pkg); //build a tree of POIXMLDocumentParts, this document being the root load(XWPFFactory.getInstance()); }
public XWPFDocument(InputStream is) throws IOException { super(PackageHelper.open(is)); //build a tree of POIXMLDocumentParts, this workbook being the root load(XWPFFactory.getInstance()); }
/** * Creates an empty numbering if one does not already exist and sets the numbering member * * @return numbering */ public XWPFNumbering createNumbering() { if (numbering == null) { NumberingDocument numberingDoc = NumberingDocument.Factory.newInstance(); XWPFRelation relation = XWPFRelation.NUMBERING; int i = getRelationIndex(relation); XWPFNumbering wrapper = (XWPFNumbering) createRelationship(relation, XWPFFactory.getInstance(), i); wrapper.setNumbering(numberingDoc.addNewNumbering()); numbering = wrapper; } return numbering; }
public XWPFEndnotes createEndnotes() { if (endnotes == null) { EndnotesDocument endnotesDoc = EndnotesDocument.Factory.newInstance(); XWPFRelation relation = XWPFRelation.ENDNOTE; int i = getRelationIndex(relation); XWPFEndnotes wrapper = (XWPFEndnotes) createRelationship(relation, XWPFFactory.getInstance(), i); wrapper.setEndnotes(endnotesDoc.addNewEndnotes()); wrapper.setIdManager(footnoteIdManager); endnotes = wrapper; } return endnotes; }
/** * Creates an empty styles for the document if one does not already exist * * @return styles */ public XWPFStyles createStyles() { if (styles == null) { StylesDocument stylesDoc = StylesDocument.Factory.newInstance(); XWPFRelation relation = XWPFRelation.STYLES; int i = getRelationIndex(relation); XWPFStyles wrapper = (XWPFStyles) createRelationship(relation, XWPFFactory.getInstance(), i); wrapper.setStyles(stylesDoc.addNewStyles()); styles = wrapper; } return styles; }
/** * Create a new CTWorkbook with all values set to default */ @Override protected void onDocumentCreate() { ctDocument = CTDocument1.Factory.newInstance(); ctDocument.addNewBody(); settings = (XWPFSettings) createRelationship(XWPFRelation.SETTINGS, XWPFFactory.getInstance()); POIXMLProperties.ExtendedProperties expProps = getProperties().getExtendedProperties(); expProps.getUnderlyingProperties().setApplication(DOCUMENT_CREATOR); }
/** * Creates an empty footnotes element for the document if one does not already exist * * @return footnotes */ public XWPFFootnotes createFootnotes() { if (footnotes == null) { FootnotesDocument footnotesDoc = FootnotesDocument.Factory.newInstance(); XWPFRelation relation = XWPFRelation.FOOTNOTE; int i = getRelationIndex(relation); XWPFFootnotes wrapper = (XWPFFootnotes) createRelationship(relation, XWPFFactory.getInstance(), i); wrapper.setFootnotes(footnotesDoc.addNewFootnotes()); wrapper.setIdManager(this.footnoteIdManager); footnotes = wrapper; } return footnotes; }
/** * This method is used to create template for chart XML * no need to read MS-Word file and modify charts * * @param width width of chart in document * @param height height of chart in document * @return This method return object of XWPFChart * @throws InvalidFormatException * @throws IOException * @since POI 4.0.0 */ public XWPFChart createChart(int width, int height) throws InvalidFormatException, IOException { //get chart number int chartNumber = getNextPartNumber(XWPFRelation.CHART, charts.size() + 1); //create relationship in document for new chart RelationPart rp = createRelationship( XWPFRelation.CHART, XWPFFactory.getInstance(), chartNumber, false); // initialize xwpfchart object XWPFChart xwpfChart = rp.getDocumentPart(); xwpfChart.setChartIndex(chartNumber); xwpfChart.attach(rp.getRelationship().getId(), createParagraph().createRun()); xwpfChart.setChartBoundingBox(width, height); //add chart object to chart list charts.add(xwpfChart); return xwpfChart; }
xwpfPicData = (XWPFPictureData) createRelationship(relDesc, XWPFFactory.getInstance(), idx);
xwpfPicData = (XWPFPictureData) createRelationship(relDesc, XWPFFactory.getInstance(), idx);
/** * Creates a new header of the specified type, to which the * supplied (and previously unattached!) paragraphs are * added to. */ public XWPFHeader createHeader(Enum type, XWPFParagraph[] pars) { XWPFHeader header = getHeader(type); if (header == null) { HdrDocument hdrDoc = HdrDocument.Factory.newInstance(); XWPFRelation relation = XWPFRelation.HEADER; int i = getRelationIndex(relation); XWPFHeader wrapper = (XWPFHeader) doc.createRelationship(relation, XWPFFactory.getInstance(), i); wrapper.setXWPFDocument(doc); CTHdrFtr hdr = buildHdr(type, wrapper, pars); wrapper.setHeaderFooter(hdr); hdrDoc.setHdr(hdr); assignHeader(wrapper, type); header = wrapper; } return header; }
/** * Creates a new footer of the specified type, to which the * supplied (and previously unattached!) paragraphs are * added to. */ public XWPFFooter createFooter(Enum type, XWPFParagraph[] pars) { XWPFFooter footer = getFooter(type); if (footer == null) { FtrDocument ftrDoc = FtrDocument.Factory.newInstance(); XWPFRelation relation = XWPFRelation.FOOTER; int i = getRelationIndex(relation); XWPFFooter wrapper = (XWPFFooter) doc.createRelationship(relation, XWPFFactory.getInstance(), i); wrapper.setXWPFDocument(doc); CTHdrFtr ftr = buildFtr(type, wrapper, pars); wrapper.setHeaderFooter(ftr); ftrDoc.setFtr(ftr); assignFooter(wrapper, type); footer = wrapper; } return footer; }
public XWPFDocument(OPCPackage pkg) throws IOException { super(pkg); //build a tree of POIXMLDocumentParts, this document being the root load(XWPFFactory.getInstance()); }
public XWPFDocument(OPCPackage pkg) throws IOException { super(pkg); //build a tree of POIXMLDocumentParts, this document being the root load(XWPFFactory.getInstance()); }
public XWPFDocument(InputStream is) throws IOException { super(PackageHelper.open(is)); //build a tree of POIXMLDocumentParts, this workbook being the root load(XWPFFactory.getInstance()); }
public XWPFDocument(InputStream is) throws IOException { super(PackageHelper.open(is)); //build a tree of POIXMLDocumentParts, this workbook being the root load(XWPFFactory.getInstance()); }
public XWPFEndnotes createEndnotes() { if (endnotes == null) { EndnotesDocument endnotesDoc = EndnotesDocument.Factory.newInstance(); XWPFRelation relation = XWPFRelation.ENDNOTE; int i = getRelationIndex(relation); XWPFEndnotes wrapper = (XWPFEndnotes) createRelationship(relation, XWPFFactory.getInstance(), i); wrapper.setEndnotes(endnotesDoc.addNewEndnotes()); wrapper.setIdManager(footnoteIdManager); endnotes = wrapper; } return endnotes; }
/** * Create a new CTWorkbook with all values set to default */ @Override protected void onDocumentCreate() { ctDocument = CTDocument1.Factory.newInstance(); ctDocument.addNewBody(); settings = (XWPFSettings) createRelationship(XWPFRelation.SETTINGS, XWPFFactory.getInstance()); POIXMLProperties.ExtendedProperties expProps = getProperties().getExtendedProperties(); expProps.getUnderlyingProperties().setApplication(DOCUMENT_CREATOR); }
/** * Create a new CTWorkbook with all values set to default */ @Override protected void onDocumentCreate() { ctDocument = CTDocument1.Factory.newInstance(); ctDocument.addNewBody(); settings = (XWPFSettings) createRelationship(XWPFRelation.SETTINGS,XWPFFactory.getInstance()); POIXMLProperties.ExtendedProperties expProps = getProperties().getExtendedProperties(); expProps.getUnderlyingProperties().setApplication(DOCUMENT_CREATOR); }