Package org.apache.poi.hwpf.model

Examples of org.apache.poi.hwpf.model.TextPiece


  public CharacterRun insertBefore(String text)
  // throws UnsupportedEncodingException
  {
    initAll();

    TextPiece tp = _text.get(_textStart);
    StringBuffer sb = tp.getStringBuffer();

    // Since this is the first item in our list, it is safe to assume that
    // _start >= tp.getStart()
    int insertIndex = _start - tp.getStart();
    sb.insert(insertIndex, text);

    int adjustedLength = _doc.getTextTable().adjustForInsert(_textStart, text.length());
    _doc.getCharacterTable().adjustForInsert(_charStart, adjustedLength);
    _doc.getParagraphTable().adjustForInsert(_parStart, adjustedLength);
View Full Code Here


   */
  public CharacterRun insertAfter(String text) {
    initAll();

    int listIndex = _textEnd - 1;
    TextPiece tp = _text.get(listIndex);
    StringBuffer sb = tp.getStringBuffer();

    int insertIndex = _end - tp.getStart();

    if (tp.getStringBuffer().charAt(_end - 1) == '\r' && text.charAt(0) != '\u0007') {
      insertIndex--;
    }
    sb.insert(insertIndex, text);
    int adjustedLength = _doc.getTextTable().adjustForInsert(listIndex, text.length());
    _doc.getCharacterTable().adjustForInsert(_charEnd - 1, adjustedLength);
View Full Code Here

      // System.err.println("Section " + x + " is now " + sepx.getStart()
      // + " -> " + sepx.getEnd());
    }

    for (int x = _textStart; x < numTextPieces; x++) {
      TextPiece piece = _text.get(x);
      piece.adjustForDelete(_start, _end - _start);
    }

    // update the FIB.CCPText + friends field
    adjustFIB(-(_end - _start));
  }
View Full Code Here

    Iterator textIt = textPieces.iterator();

    int length = 0;
    while(textIt.hasNext())
    {
      TextPiece tp = (TextPiece)textIt.next();
      length += tp.characterLength();
    }
    return length;
  }
View Full Code Here

        }
        if ( !preserveTextTable )
        {
            _cft = new ComplexFileTable();
            _tpt = _cft.getTextPieceTable();
            final TextPiece textPiece = new SinglentonTextPiece( _text );
            _tpt.add( textPiece );
            _text = textPiece.getStringBuilder();
        }

        // Read FSPA and Escher information
        // _fspa = new FSPATable(_tableStream, _fib.getFcPlcspaMom(),
        // _fib.getLcbPlcspaMom(), getTextTable().getTextPieces());
View Full Code Here

            // Generate a single Text Piece Table, with a single Text Piece
            //  which covers all the (8 bit only) text in the file
            tpt = new TextPieceTable();
            byte[] textData = new byte[_fib.getFcMac()-_fib.getFcMin()];
            System.arraycopy(_mainStream, _fib.getFcMin(), textData, 0, textData.length);
            TextPiece tp = new TextPiece(
                    0, textData.length, textData, pd
            );
            tpt.add(tp);
           
            text.append(tp.getStringBuilder());
        }
       
        _text = tpt.getText();

        // Now we can fetch the character and paragraph properties
View Full Code Here

TOP

Related Classes of org.apache.poi.hwpf.model.TextPiece

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.