Package org.apache.poi.hwpf.usermodel

Examples of org.apache.poi.hwpf.usermodel.Range.replaceText()


    public void testReplaceTextAfter()
    {
        HWPFDocument doc = HWPFTestDataSamples.openSampleFile( "pageref.doc" );
        Bookmark bookmark = doc.getBookmarks().getBookmark( 0 );
        Range range = new Range( bookmark.getStart(), bookmark.getEnd(), doc );
        range.replaceText( "1destin2ation3", true );

        bookmark = doc.getBookmarks().getBookmark( 0 );
        assertEquals( "userref", bookmark.getName() );
        assertEquals( 27, bookmark.getStart() );
        assertEquals( 41, bookmark.getEnd() );
View Full Code Here


    public void testReplaceTextBefore()
    {
        HWPFDocument doc = HWPFTestDataSamples.openSampleFile( "pageref.doc" );
        Bookmark bookmark = doc.getBookmarks().getBookmark( 0 );
        Range range = new Range( bookmark.getStart(), bookmark.getEnd(), doc );
        range.replaceText( "1destin2ation3", false );

        bookmark = doc.getBookmarks().getBookmark( 0 );
        assertEquals( "userref", bookmark.getName() );
        assertEquals( 27, bookmark.getStart() );
        assertEquals( 41, bookmark.getEnd() );
View Full Code Here

    public void testUpdateText()
    {
        HWPFDocument doc = HWPFTestDataSamples.openSampleFile( "pageref.doc" );
        Bookmark bookmark = doc.getBookmarks().getBookmark( 0 );
        Range range = new Range( bookmark.getStart(), bookmark.getEnd(), doc );
        range.replaceText( "destination", "1destin2ation3" );

        bookmark = doc.getBookmarks().getBookmark( 0 );
        assertEquals( "userref", bookmark.getName() );
        assertEquals( 27, bookmark.getStart() );
        assertEquals( 41, bookmark.getEnd() );
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.