Package org.openxmlformats.schemas.wordprocessingml.x2006.main

Examples of org.openxmlformats.schemas.wordprocessingml.x2006.main.DocumentDocument


    /**
     * @param width
     */
    public void setWidth(int width) {
        CTTblPr tblPr = getTrPr();
        CTTblWidth tblWidth = tblPr.isSetTblW() ? tblPr.getTblW() : tblPr
                .addNewTblW();
        tblWidth.setW(new BigInteger("" + width));
    }
View Full Code Here


    public void testGetText() {
        XWPFDocument doc = new XWPFDocument();
        CTTbl table = CTTbl.Factory.newInstance();
        CTRow row = table.addNewTr();
        CTTc cell = row.addNewTc();
        CTP paragraph = cell.addNewP();
        CTR run = paragraph.addNewR();
        CTText text = run.addNewT();
        text.setStringValue("finally I can write!");

        XWPFTable xtab = new XWPFTable(table, doc);
View Full Code Here

        CTTbl table = CTTbl.Factory.newInstance();
        CTRow row = table.addNewTr();
        CTTc cell = row.addNewTc();
        CTP paragraph = cell.addNewP();
        CTR run = paragraph.addNewR();
        CTText text = run.addNewT();
        text.setStringValue("finally I can write!");

        XWPFTable xtab = new XWPFTable(table, doc);
        assertEquals("finally I can write!\n", xtab.getText());
    }
View Full Code Here

        XWPFParagraph p = doc.createParagraph();

        CTP ctp = p.getCTP();
        CTPPr ppr = ctp.getPPr()== null? ctp.addNewPPr() : ctp.getPPr();

        CTTextAlignment txtAlign = ppr.addNewTextAlignment();
        txtAlign.setVal(STTextAlignment.CENTER);
        assertEquals(TextAlignment.CENTER, p.getVerticalAlignment());

        p.setVerticalAlignment(TextAlignment.BOTTOM);
        assertEquals(STTextAlignment.BOTTOM, ppr.getTextAlignment().getVal());
    }
View Full Code Here

        headers = new ArrayList<XWPFHeader>();
        footnotes = new HashMap<Integer, XWPFFootnote>();
        endnotes = new HashMap<Integer, XWPFFootnote>();

        try {
            DocumentDocument doc = DocumentDocument.Factory.parse(getPackagePart().getInputStream());
            ctDocument = doc.getDocument();

            initFootnotes();
          
           
            // parse the document with cursor and add
            // the XmlObject to its lists
        XmlCursor cursor = ctDocument.getBody().newCursor();
            cursor.selectPath("./*");
            while (cursor.toNextSelection()) {
                XmlObject o = cursor.getObject();
                if (o instanceof CTP) {
                  XWPFParagraph p = new XWPFParagraph((CTP)o, this);
                  bodyElements.add(p);
                  paragraphs.add(p);
                }
                if (o instanceof CTTbl) {
                  XWPFTable t = new XWPFTable((CTTbl)o, this);
                  bodyElements.add(t);
                  tables.add(t);
                }
            }
            cursor.dispose();
     
            // Sort out headers and footers
      if (doc.getDocument().getBody().getSectPr() != null)
        headerFooterPolicy = new XWPFHeaderFooterPolicy(this);
       
      // Create for each XML-part in the Package a PartClass
            for(POIXMLDocumentPart p : getRelations()){
                String relation = p.getPackageRelationship().getRelationshipType();
View Full Code Here

        comments = new ArrayList<XWPFComment>();
        paragraphs = new ArrayList<XWPFParagraph>();
        tables= new ArrayList<XWPFTable>();

        try {
            DocumentDocument doc = DocumentDocument.Factory.parse(getPackagePart().getInputStream());
            ctDocument = doc.getDocument();

            CTBody body = ctDocument.getBody();

            // filling paragraph list
            for (CTP p : body.getPArray())  {
View Full Code Here

        tables= new ArrayList<XWPFTable>();
        footnotes = new HashMap<Integer, XWPFFootnote>();
        endnotes = new HashMap<Integer, XWPFFootnote>();

        try {
            DocumentDocument doc = DocumentDocument.Factory.parse(getPackagePart().getInputStream());
            ctDocument = doc.getDocument();

            CTBody body = ctDocument.getBody();

            initFootnotes();

            // filling paragraph list
            for (CTP p : body.getPArray())    {
                paragraphs.add(new XWPFParagraph(p, this));
            }

            // Get any tables
            for(CTTbl table : body.getTblArray()) {
                tables.add(new XWPFTable(this, table));
            }

            // Sort out headers and footers
      if (doc.getDocument().getBody().getSectPr() != null)
        headerFooterPolicy = new XWPFHeaderFooterPolicy(this);

            for(POIXMLDocumentPart p : getRelations()){
                String relation = p.getPackageRelationship().getRelationshipType();
                if(relation.equals(XWPFRelation.COMMENT.getRelation())){
View Full Code Here

    }

    @Override
    protected void onDocumentRead() throws IOException {
        try {
            DocumentDocument doc = DocumentDocument.Factory.parse(getPackagePart().getInputStream());
            ctDocument = doc.getDocument();

            initFootnotes();

            // parse the document with cursor and add
            // the XmlObject to its lists
            XmlCursor cursor = ctDocument.getBody().newCursor();
            cursor.selectPath("./*");
            while (cursor.toNextSelection()) {
                XmlObject o = cursor.getObject();
                if (o instanceof CTP) {
                    XWPFParagraph p = new XWPFParagraph((CTP) o, this);
                    bodyElements.add(p);
                    paragraphs.add(p);
                } else if (o instanceof CTTbl) {
                    XWPFTable t = new XWPFTable((CTTbl) o, this);
                    bodyElements.add(t);
                    tables.add(t);
                } else if (o instanceof CTSdtBlock){
                   XWPFSDT c = new XWPFSDT((CTSdtBlock)o, this);
                   bodyElements.add(c);
                   contentControls.add(c);
               }
            }
            cursor.dispose();

            // Sort out headers and footers
            if (doc.getDocument().getBody().getSectPr() != null)
                headerFooterPolicy = new XWPFHeaderFooterPolicy(this);

            // Create for each XML-part in the Package a PartClass
            for (POIXMLDocumentPart p : getRelations()) {
                String relation = p.getPackageRelationship().getRelationshipType();
View Full Code Here

        headers = new ArrayList<XWPFHeader>();
        footnotes = new HashMap<Integer, XWPFFootnote>();
        endnotes = new HashMap<Integer, XWPFFootnote>();

        try {
            DocumentDocument doc = DocumentDocument.Factory.parse(getPackagePart().getInputStream());
            ctDocument = doc.getDocument();

            initFootnotes();
          
           
            // parse the document with cursor and add
            // the XmlObject to its lists
        XmlCursor cursor = ctDocument.getBody().newCursor();
            cursor.selectPath("./*");
            while (cursor.toNextSelection()) {
                XmlObject o = cursor.getObject();
                if (o instanceof CTP) {
                  XWPFParagraph p = new XWPFParagraph((CTP)o, this);
                  bodyElements.add(p);
                  paragraphs.add(p);
                }
                if (o instanceof CTTbl) {
                  XWPFTable t = new XWPFTable((CTTbl)o, this);
                  bodyElements.add(t);
                  tables.add(t);
                }
            }
     
            // Sort out headers and footers
      if (doc.getDocument().getBody().getSectPr() != null)
        headerFooterPolicy = new XWPFHeaderFooterPolicy(this);
       
      // Create for each XML-part in the Package a PartClass
            for(POIXMLDocumentPart p : getRelations()){
                String relation = p.getPackageRelationship().getRelationshipType();
View Full Code Here

    }

    @Override
    protected void onDocumentRead() throws IOException {
        try {
            DocumentDocument doc = DocumentDocument.Factory.parse(getPackagePart().getInputStream());
            ctDocument = doc.getDocument();

            initFootnotes();

            // parse the document with cursor and add
            // the XmlObject to its lists
            XmlCursor cursor = ctDocument.getBody().newCursor();
            cursor.selectPath("./*");
            while (cursor.toNextSelection()) {
                XmlObject o = cursor.getObject();
                if (o instanceof CTP) {
                    XWPFParagraph p = new XWPFParagraph((CTP) o, this);
                    bodyElements.add(p);
                    paragraphs.add(p);
                } else if (o instanceof CTTbl) {
                    XWPFTable t = new XWPFTable((CTTbl) o, this);
                    bodyElements.add(t);
                    tables.add(t);
                } else if (o instanceof CTSdtBlock){
                   XWPFSDT c = new XWPFSDT((CTSdtBlock)o, this);
                   bodyElements.add(c);
                   contentControls.add(c);
               }
            }
            cursor.dispose();

            // Sort out headers and footers
            if (doc.getDocument().getBody().getSectPr() != null)
                headerFooterPolicy = new XWPFHeaderFooterPolicy(this);

            // Create for each XML-part in the Package a PartClass
            for (POIXMLDocumentPart p : getRelations()) {
                String relation = p.getPackageRelationship().getRelationshipType();
View Full Code Here

TOP

Related Classes of org.openxmlformats.schemas.wordprocessingml.x2006.main.DocumentDocument

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.