Package org.apache.poi.hwpf.model

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


  // update the FIB.CCPText field (this should happen once per adjustment, so we don't want it in
  // 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

  CPSplitCalculator cpS = _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


    );
    l.dumpFIB();
  }

  public void dumpFIB() throws Exception {
    FileInformationBlock fib = doc.getFileInformationBlock();
    System.out.println(fib.toString());
  }
View Full Code Here

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

    directory.createDocumentInputStream(STREAM_WORD_DOCUMENT).read(_mainStream);

    // Create our FIB, and check for the doc being encrypted
    _fib = new FileInformationBlock(_mainStream);

    DirectoryEntry objectPoolEntry;
    try {
      objectPoolEntry = (DirectoryEntry) directory
              .getEntry(STREAM_OBJECT_POOL);
View Full Code Here

        System.out.println( ( (HWPFDocument) _doc ).getEscherRecordHolder() );
    }

    public void dumpFIB()
    {
        FileInformationBlock fib = _doc.getFileInformationBlock();
        System.out.println( fib );

    }
View Full Code Here

        // 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

                    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

        // 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

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

    directory.createDocumentInputStream(STREAM_WORD_DOCUMENT).read(_mainStream);

    // Create our FIB, and check for the doc being encrypted
    _fib = new FileInformationBlock(_mainStream);

    DirectoryEntry objectPoolEntry;
    try {
      objectPoolEntry = (DirectoryEntry) directory
              .getEntry(STREAM_OBJECT_POOL);
View Full Code Here

        System.out.println( ( (HWPFDocument) _doc ).getEscherRecordHolder() );
    }

    public void dumpFIB()
    {
        FileInformationBlock fib = _doc.getFileInformationBlock();
        System.out.println( fib );

    }
View Full Code Here

                    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

TOP

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

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.