Examples of Paragraph


Examples of org.apache.pivot.wtk.text.Paragraph

            Node descendant = document.getDescendantAt(offset);

            if (selectionLength == 0
                && descendant instanceof Paragraph) {
                // We are deleting a paragraph terminator
                Paragraph paragraph = (Paragraph)descendant;

                Element parent = paragraph.getParent();
                int index = parent.indexOf(paragraph);

                // Attempt to merge any successive content into the paragraph
                if (index < parent.getLength() - 1) {
                    // TODO This won't always be a paragraph - we'll need to
                    // find the next paragraph by walking the tree, then
                    // remove any empty nodes
                    Sequence<Node> removed = parent.remove(index + 1, 1);
                    Paragraph nextParagraph = (Paragraph)removed.get(0);
                    paragraph.insertRange(nextParagraph, paragraph.getCharacterCount() - 1);
                }
            } else {
                removeDocumentRange(offset, characterCount);
            }
        }

        // Ensure that the document remains editable
        if (document.getCharacterCount() == 0) {
            document.add(new Paragraph(""));
        }

        // Move the caret to the merge point
        if (offset >= 0) {
            setSelection(offset, 0);
View Full Code Here

Examples of org.apache.pivot.wtk.text.Paragraph

     */
    public void setText(String text) {
        Document doc = new Document();
        String[] lines = text.split("\r?\n");
        for (int i = 0; i < lines.length; i++) {
            Paragraph paragraph = new Paragraph(lines[i]);
            doc.add(paragraph);
        }
        setDocument(doc);
    }
View Full Code Here

Examples of org.apache.poi.hwpf.usermodel.Paragraph

    try {
        Range r = doc.getRange();

      ret = new String[r.numParagraphs()];
      for(int i=0; i<ret.length; i++) {
        Paragraph p = r.getParagraph(i);
        ret[i] = p.text();
       
        // Fix the line ending
        if(ret[i].endsWith("\r")) {
          ret[i] = ret[i] + "\n";
        }
View Full Code Here

Examples of org.apache.poi.hwpf.usermodel.Paragraph

    parProps.setTableLevel((byte)1);

    int columns = props.getItcMac();
    for (int x = 0; x < rows; x++)
    {
      Paragraph cell = this.insertBefore(parProps, StyleSheet.NIL_STYLE);
      cell.insertAfter(String.valueOf('\u0007'));
      for(int y = 1; y < columns; y++)
      {
        cell = cell.insertAfter(parProps, StyleSheet.NIL_STYLE);
        cell.insertAfter(String.valueOf('\u0007'));
      }
      cell = cell.insertAfter(parProps, StyleSheet.NIL_STYLE, String.valueOf('\u0007'));
      cell.setTableRowEnd(props);
    }
    return new Table(_start, _start + (rows * (columns + 1)), this, 1);
  }
View Full Code Here

Examples of org.apache.poi.hwpf.usermodel.Paragraph

  {
    initParagraphs();
    PAPX papx = (PAPX)_paragraphs.get(index + _parStart);

    ParagraphProperties props = papx.getParagraphProperties(_doc.getStyleSheet());
    Paragraph pap = null;
    if (props.getIlfo() > 0)
    {
      pap = new ListEntry(papx, this, _doc.getListTables());
    }
    else
    {
      pap = new Paragraph(papx, this);
    }

    return pap;
  }
View Full Code Here

Examples of org.apache.poi.hwpf.usermodel.Paragraph

    public void testExtractFromModel() {
      Range r = doc.getRange();
     
      String[] text = new String[r.numParagraphs()];
      for(int i=0; i < r.numParagraphs(); i++) {
        Paragraph p = r.getParagraph(i);
        text[i] = p.text();
      }
     
      assertEquals(p_text.length, text.length);
      for(int i=0; i<p_text.length; i++) {
        assertEquals(p_text[i], text[i]);
View Full Code Here

Examples of org.apache.poi.hwpf.usermodel.Paragraph

        handleHeaderFooter(headers, "header", document, pictures, pictureTable, xhtml);

        // Do the main paragraph text
        Range r = document.getRange();
        for(int i=0; i<r.numParagraphs(); i++) {
           Paragraph p = r.getParagraph(i);
           i += handleParagraph(p, 0, r, document, FieldsDocumentPart.MAIN, pictures, pictureTable, xhtml);
        }

        // Do everything else
        for (String paragraph: wordExtractor.getMainTextboxText()) {
View Full Code Here

Examples of org.apache.poi.hwpf.usermodel.Paragraph

        if (countParagraphs(ranges) > 0) {
            xhtml.startElement("div", "class", type);
            for (Range r : ranges) {
                if (r != null) {
                    for(int i=0; i<r.numParagraphs(); i++) {
                        Paragraph p = r.getParagraph(i);
                       
                        String text = p.text();
                        if (text.replaceAll("[\\r\\n\\s]+", "").isEmpty()) {
                            // Skip empty header or footer paragraphs
                        } else {
                            i += handleParagraph(p, 0, r, document,
                                    FieldsDocumentPart.HEADER, pictures, pictureTable, xhtml);
View Full Code Here

Examples of org.apache.poi.hwpf.usermodel.Paragraph

             for(int cn=0; cn<row.numCells(); cn++) {
                TableCell cell = row.getCell(cn);
                xhtml.startElement("td");

                for(int pn=0; pn<cell.numParagraphs(); pn++) {
                   Paragraph cellP = cell.getParagraph(pn);
                   handleParagraph(cellP, p.getTableLevel(), cell, document, docPart, pictures, pictureTable, xhtml);
                }
                xhtml.endElement("td");
             }
             xhtml.endElement("tr");
View Full Code Here

Examples of org.apache.poi.hwpf.usermodel.Paragraph

    public void testExtractFromModel() {
      Range r = doc.getRange();

      String[] text = new String[r.numParagraphs()];
      for(int i=0; i < r.numParagraphs(); i++) {
        Paragraph p = r.getParagraph(i);
        text[i] = p.text();
      }

      assertEquals(p_text.length, text.length);
      for(int i=0; i<p_text.length; i++) {
        assertEquals(p_text[i], text[i]);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.