Examples of CharacterRun


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

    int[] point = findRange(_paragraphs, _parStart, Math.max(chpx.getStart(), _start),
                              chpx.getEnd());
    PAPX papx = (PAPX)_paragraphs.get(point[0]);
    short istd = papx.getIstd();

    CharacterRun chp = new CharacterRun(chpx, _doc.getStyleSheet(), istd, this);

    return chp;
  }
View Full Code Here

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

    // }

   
    for (int z = 0; z < p.numCharacterRuns(); z++) {
      // character run
      CharacterRun run = p.getCharacterRun(z);

      // No character styles defined in there??

      org.docx4j.wml.RPr rPr = null;

      if (run.isBold()) {

        // TODO - HIGH PRIORITY- handle other run properties
        // esp underline, font size
        if (rPr == null) {
          rPr = factory.createRPr();
        }

        org.docx4j.wml.BooleanDefaultTrue boldOn = factory
            .createBooleanDefaultTrue();
        boldOn.setVal(Boolean.TRUE);

        rPr.setB(boldOn);

      }

      //Process image
      if (doc instanceof HWPFDocument
          && ((HWPFDocument) doc).getPicturesTable().hasPicture(run)) {
       
        Picture picture = doc.getPicturesTable().extractPicture(run,
            true);
        Inline inline;
        try {
          BinaryPartAbstractImage imagePart = BinaryPartAbstractImage
              .createImagePart(wordMLPackage, picture.getContent());

          long cx = UnitsOfMeasurement
              .twipToEMU(Math.round((double) imagePart
                  .getImageInfo().getSize().getWidthMpt()
                  * ((double) picture
                      .getHorizontalScalingFactor() * 0.00001d))) * 2L;
          long cy = UnitsOfMeasurement
              .twipToEMU(Math.round((double) imagePart
                  .getImageInfo().getSize().getHeightMpt()
                  * ((double) picture
                      .getVerticalScalingFactor() * 0.00001d))) * 2L;

          inline = imagePart.createImageInline(null, "", ID1++,
              ID2++, cx, cy, false);

          org.docx4j.wml.R imgrun = factory.createR();
          org.docx4j.wml.Drawing drawing = factory.createDrawing();
          imgrun.getContent().add(drawing);
          drawing.getAnchorOrInline().add(inline);
          wmlP.getContent().add(imgrun);
        } catch (Exception e1) {
          // TODO Auto-generated catch block
          e1.printStackTrace();
        }

      } else {
        // character run text
        String text = run.text();

        // show us the text
        log.debug("Processing: " + text);

        String cleansed = stripNonValidXMLCharacters(text);
View Full Code Here

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

    int[] point = findRange(_paragraphs, _parStart, Math.max(chpx.getStart(), _start),
                              chpx.getEnd());
    PAPX papx = (PAPX)_paragraphs.get(point[0]);
    short istd = papx.getIstd();

    CharacterRun chp = new CharacterRun(chpx, _doc.getStyleSheet(), istd, this);

    return chp;
  }
View Full Code Here

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

       } else {
           xhtml.startElement(tas.getTag());
       }

       for(int j=0; j<p.numCharacterRuns(); j++) {
          CharacterRun cr = p.getCharacterRun(j);
         
          if(cr.text().equals("\u0013")) {
             j += handleSpecialCharacterRuns(p, j, tas.isHeading(), pictures, xhtml);
          } else if(cr.text().startsWith("\u0008")) {
             // Floating Picture(s)
             for(int pn=0; pn<cr.text().length(); pn++) {
                // Assume they're in the order from the unclaimed list...
                Picture picture = pictures.nextUnclaimed();
               
                // Output
                handlePictureCharacterRun(cr, picture, pictures, xhtml);
View Full Code Here

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

       boolean has14 = false;
      
       // Split it into before and after the 14
       int i;
       for(i=index+1; i<p.numCharacterRuns(); i++) {
          CharacterRun cr = p.getCharacterRun(i);
          if(cr.text().equals("\u0013")) {
             // Nested, oh joy...
             int increment = handleSpecialCharacterRuns(p, i+1, skipStyling, pictures, xhtml);
             i += increment;
          } else if(cr.text().equals("\u0014")) {
             has14 = true;
          } else if(cr.text().equals("\u0015")) {
             if(!has14) {
                texts = controls;
                controls = new ArrayList<CharacterRun>();
             }
             break;
View Full Code Here

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

          //  knows what else...
          nonU1based = new ArrayList<Picture>();
          nonU1based.addAll(all);
          Range r = doc.getRange();
          for(int i=0; i<r.numCharacterRuns(); i++) {
             CharacterRun cr = r.getCharacterRun(i);
             if(picturesTable.hasPicture(cr)) {
                Picture p = getFor(cr);
                int at = nonU1based.indexOf(p);
                nonU1based.set(at, null);
             }
View Full Code Here

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

            {
              Paragraph paragraph = section.getParagraph(y);
              for (int z = 0; z < paragraph.numCharacterRuns(); z++)
              {
                //character run
                CharacterRun run = paragraph.getCharacterRun(z);
                //character run text
                String text = run.text();
                // show us the text
                System.out.print(text);
              }
              // use a new line at the paragraph break
              System.out.println();
View Full Code Here

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

    int[] point = findRange(_paragraphs, _parStart, Math.max(chpx.getStart(), _start),
                              chpx.getEnd());
    PAPX papx = (PAPX)_paragraphs.get(point[0]);
    short istd = papx.getIstd();

    CharacterRun chp = new CharacterRun(chpx, _doc.getStyleSheet(), istd, this);

    return chp;
  }
View Full Code Here

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

  public List<Picture> getAllPictures() {
    ArrayList<Picture> pictures = new ArrayList<Picture>();

    Range range = _document.getOverallRange();
    for (int i = 0; i < range.numCharacterRuns(); i++) {
      CharacterRun run = range.getCharacterRun(i);

        if (run==null) {
            continue;
        }
View Full Code Here

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

    for (int i = 0; i < globalRange.numParagraphs(); i++) {
      Paragraph p = globalRange.getParagraph(i);
      out.append(p.text());
      out.append("\n");
      for (int j = 0; j < p.numCharacterRuns(); j++) {
        CharacterRun characterRun = p.getCharacterRun(j);
        characterRun.text();
      }
    }
    return out.toString();
  }
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.