Examples of FileInformationBlock


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

    // has a parent)
    // without this, OpenOffice.org (v. 2.2.x) does not see all the text in
    // the document

    CPSplitCalculator cpS = ((HWPFDocument)_doc).getCPSplitCalculator();
    FileInformationBlock fib = _doc.getFileInformationBlock();

    // Do for each affected part
    if (_start < cpS.getMainDocumentEnd()) {
      fib.setCcpText(fib.getCcpText() + adjustment);
    }

    if (_start < cpS.getCommentsEnd()) {
      fib.setCcpAtn(fib.getCcpAtn() + adjustment);
    }
    if (_start < cpS.getEndNoteEnd()) {
      fib.setCcpEdn(fib.getCcpEdn() + adjustment);
    }
    if (_start < cpS.getFootnoteEnd()) {
      fib.setCcpFtn(fib.getCcpFtn() + adjustment);
    }
    if (_start < cpS.getHeaderStoryEnd()) {
      fib.setCcpHdd(fib.getCcpHdd() + adjustment);
    }
    if (_start < cpS.getHeaderTextboxEnd()) {
      fib.setCcpHdrTxtBx(fib.getCcpHdrTxtBx() + adjustment);
    }
    if (_start < cpS.getMainTextboxEnd()) {
      fib.setCcpTxtBx(fib.getCcpTxtBx() + adjustment);
    }
  }
View Full Code Here

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

    _mainStream = new byte[documentProps.getSize()];

    directory.createDocumentInputStream("WordDocument").read(_mainStream);

    // Create our FIB, and check for the doc being encrypted
    _fib = new FileInformationBlock(_mainStream);
    if(_fib.isFEncrypted()) {
      throw new EncryptedDocumentException("Cannot process encrypted word files!");
    }
  }
View Full Code Here

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

                    charRun.replaceText( text, "added" );
            }
        }

        doc = HWPFTestDataSamples.writeOutAndReadBack( doc );
        final FileInformationBlock fileInformationBlock = doc
                .getFileInformationBlock();

        int totalLength = 0;
        for ( SubdocumentType type : SubdocumentType.values() )
        {
            final int partLength = fileInformationBlock
                    .getSubdocumentTextStreamLength( type );
            assert ( partLength >= 0 );

            totalLength += partLength;
        }
View Full Code Here

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

        return "test-fields.doc";
    }

    public void testReadFields()
    {
        FileInformationBlock fib = _hWPFDocFixture._fib;
        byte[] tableStream = _hWPFDocFixture._tableStream;

        FieldsTables fieldsTables = new FieldsTables( tableStream, fib );

        for ( int i = 0; i < FieldsDocumentPart.values().length; i++ )
View Full Code Here

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

        (DocumentEntry) filesystem.getRoot().getEntry("WordDocument");
      _mainStream = new byte[documentProps.getSize()];
      filesystem.createDocumentInputStream("WordDocument").read(_mainStream);

      // use the fib to determine the name of the table stream.
      _fib = new FileInformationBlock(_mainStream);

      String name = "0Table";
      if (_fib.getFibBase().isFWhichTblStm())
      {
        name = "1Table";
View Full Code Here

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

    return "test-fields.doc";
  }
 
  public void testReadFields()
  {
    FileInformationBlock fib = _hWPFDocFixture._fib;
    byte[] tableStream = _hWPFDocFixture._tableStream;
   
    FieldsTables fieldsTables = new FieldsTables(tableStream, fib);
   
    for (int i = 0; i < ALL_TYPES.length; i++)
View Full Code Here

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

        (DocumentEntry) filesystem.getRoot().getEntry("WordDocument");
      _mainStream = new byte[documentProps.getSize()];
      filesystem.createDocumentInputStream("WordDocument").read(_mainStream);

      // use the fib to determine the name of the table stream.
      _fib = new FileInformationBlock(_mainStream);

      String name = "0Table";
      if (_fib.isFWhichTblStm())
      {
        name = "1Table";
View Full Code Here

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

        // adjustForInsert() or it would get updated multiple times if the range
        // has a parent)
        // without this, OpenOffice.org (v. 2.2.x) does not see all the text in
        // the document

        FileInformationBlock fib = _doc.getFileInformationBlock();

        // // Do for each affected part
        // if (_start < cpS.getMainDocumentEnd()) {
        // fib.setCcpText(fib.getCcpText() + adjustment);
        // }
        //
        // if (_start < cpS.getCommentsEnd()) {
        // fib.setCcpAtn(fib.getCcpAtn() + adjustment);
        // }
        // if (_start < cpS.getEndNoteEnd()) {
        // fib.setCcpEdn(fib.getCcpEdn() + adjustment);
        // }
        // if (_start < cpS.getFootnoteEnd()) {
        // fib.setCcpFtn(fib.getCcpFtn() + adjustment);
        // }
        // if (_start < cpS.getHeaderStoryEnd()) {
        // fib.setCcpHdd(fib.getCcpHdd() + adjustment);
        // }
        // if (_start < cpS.getHeaderTextboxEnd()) {
        // fib.setCcpHdrTxtBx(fib.getCcpHdrTxtBx() + adjustment);
        // }
        // if (_start < cpS.getMainTextboxEnd()) {
        // fib.setCcpTxtBx(fib.getCcpTxtBx() + adjustment);
        // }

        // much simple implementation base on SubdocumentType --sergey

        int currentEnd = 0;
        for ( SubdocumentType type : SubdocumentType.ORDERED )
        {
            int currentLength = fib.getSubdocumentTextStreamLength( type );
            currentEnd += currentLength;

            // do we need to shift this part?
            if ( _start > currentEnd )
                continue;

            fib.setSubdocumentTextStreamLength( type, currentLength
                    + adjustment );

            break;
        }
    }
View Full Code Here

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

  private boolean stripFields = false;

  public HeaderStories(HWPFDocument doc) {
    this.headerStories = doc.getHeaderStoryRange();
    FileInformationBlock fib = doc.getFileInformationBlock();

//        // If there's no PlcfHdd, nothing to do
//        if(fib.getCcpHdd() == 0) {
//            return;
//        }

        if (fib.getSubdocumentTextStreamLength( SubdocumentType.HEADER ) == 0)
        return;
   
    if(fib.getPlcfHddSize() == 0) {
      return;
    }

        // Handle the PlcfHdd
        /*
         * Page 88:
         *
         * "The plcfhdd, a table whose location and length within the file is
         * stored in fib.fcPlcfhdd and fib.cbPlcfhdd, describes where the text
         * of each header/footer begins. If there are n headers/footers stored
         * in the Word file, the plcfhdd consists of n+2 CP entries. The
         * beginning CP of the ith header/footer is the ith CP in the plcfhdd.
         * The limit CP (the CP of character 1 position past the end of a
         * header/footer) of the ith header/footer is the i+1st CP in the
         * plcfhdd. Note: at the limit CP - 1, Word always places a chEop as a
         * placeholder which is never displayed as part of the header/footer.
         * This allows Word to change an existing header/footer to be empty.
         *
         * If there are n header/footers, the n+2nd CP entry value is always 1
         * greater than the n+1st CP entry value. A paragraph end (ASCII 13) is
         * always stored at the file position marked by the n+1st CP value.
         *
         * The transformation in a full saved file from a header/footer CP to an
         * offset from the beginning of a file (fc) is
         * fc=fib.fcMin+ccpText+ccpFtn+cp."
         */
        plcfHdd = new PlexOfCps( doc.getTableStream(), fib.getPlcfHddOffset(),
                fib.getPlcfHddSize(), 0 );
    }
View Full Code Here

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

    // has a parent)
    // without this, OpenOffice.org (v. 2.2.x) does not see all the text in
    // the document

    CPSplitCalculator cpS = ((HWPFDocument)_doc).getCPSplitCalculator();
    FileInformationBlock fib = _doc.getFileInformationBlock();

    // Do for each affected part
    if (_start < cpS.getMainDocumentEnd()) {
      fib.setCcpText(fib.getCcpText() + adjustment);
    }

    if (_start < cpS.getCommentsEnd()) {
      fib.setCcpAtn(fib.getCcpAtn() + adjustment);
    }
    if (_start < cpS.getEndNoteEnd()) {
      fib.setCcpEdn(fib.getCcpEdn() + adjustment);
    }
    if (_start < cpS.getFootnoteEnd()) {
      fib.setCcpFtn(fib.getCcpFtn() + adjustment);
    }
    if (_start < cpS.getHeaderStoryEnd()) {
      fib.setCcpHdd(fib.getCcpHdd() + adjustment);
    }
    if (_start < cpS.getHeaderTextboxEnd()) {
      fib.setCcpHdrTxtBx(fib.getCcpHdrTxtBx() + adjustment);
    }
    if (_start < cpS.getMainTextboxEnd()) {
      fib.setCcpTxtBx(fib.getCcpTxtBx() + adjustment);
    }
  }
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.