View | Details | Raw Unified | Return to bug 17491
Collapse All | Expand All

(-).classpath (-2 / +31 lines)
Lines 3-10 Link Here
3
    <classpathentry kind="src" path="src/testcases"/>
3
    <classpathentry kind="src" path="src/testcases"/>
4
    <classpathentry kind="src" path="src/java"/>
4
    <classpathentry kind="src" path="src/java"/>
5
    <classpathentry kind="src" path="src/examples/src"/>
5
    <classpathentry kind="src" path="src/examples/src"/>
6
    <classpathentry kind="var" path="JRE_LIB" rootpath="JRE_SRCROOT" sourcepath="JRE_SRC"/>
6
    <classpathentry kind="var" path="JRE_LIB" sourcepath="JRE_SRC"/>
7
    <classpathentry kind="lib" path="tools/cents/junit.cent/lib/junit-3.7.jar"/>
8
    <classpathentry kind="lib" path="lib/core/commons-logging-1.0.jar"/>
7
    <classpathentry kind="lib" path="lib/core/commons-logging-1.0.jar"/>
8
    <classpathentry kind="lib" path="F:/finaleclipse/eclipse/workspace/jakarta-poi/tools/cents/junit.cent/lib/ant-junit.jar"/>
9
    <classpathentry kind="lib" path="F:/finaleclipse/eclipse/workspace/jakarta-poi/tools/cents/junit.cent/lib/junit-3.7.jar"/>
10
    <classpathentry kind="lib" path="F:/finaleclipse/eclipse/workspace/jakarta-poi/tools/cents/umldoclet.cent/lib/UMLDoclet.jar"/>
11
    <classpathentry kind="lib" path="F:/finaleclipse/eclipse/workspace/jakarta-poi/tools/cents/jdepend.cent/lib/jdepend.jar"/>
12
    <classpathentry kind="lib" path="F:/finaleclipse/eclipse/workspace/jakarta-poi/tools/cents/jdepend.cent/lib/ant-jdepend.jar"/>
13
    <classpathentry kind="lib" path="F:/finaleclipse/eclipse/workspace/jakarta-poi/tools/cents/javasrc.cent/lib/javasrc.jar"/>
14
    <classpathentry kind="lib" path="F:/finaleclipse/eclipse/workspace/jakarta-poi/tools/cents/javasrc.cent/lib/antlrall.jar"/>
15
    <classpathentry kind="lib" path="F:/finaleclipse/eclipse/workspace/jakarta-poi/tools/cents/forrest.cent/lib/resolver-20020130.jar"/>
16
    <classpathentry kind="lib" path="F:/finaleclipse/eclipse/workspace/jakarta-poi/tools/cents/forrest.cent/lib/avalon-framework-4.1.2.jar"/>
17
    <classpathentry kind="lib" path="F:/finaleclipse/eclipse/workspace/jakarta-poi/tools/cents/forrest.cent/lib/avalon-scratchpad-20020212.jar"/>
18
    <classpathentry kind="lib" path="F:/finaleclipse/eclipse/workspace/jakarta-poi/tools/cents/forrest.cent/lib/cocoon.jar"/>
19
    <classpathentry kind="lib" path="F:/finaleclipse/eclipse/workspace/jakarta-poi/tools/cents/forrest.cent/lib/cocoon-scratchpad-part.jar"/>
20
    <classpathentry kind="lib" path="F:/finaleclipse/eclipse/workspace/jakarta-poi/tools/cents/forrest.cent/lib/commons-collections-1.0.jar"/>
21
    <classpathentry kind="lib" path="F:/finaleclipse/eclipse/workspace/jakarta-poi/tools/cents/forrest.cent/lib/commons-httpclient-20011012.jar"/>
22
    <classpathentry kind="lib" path="F:/finaleclipse/eclipse/workspace/jakarta-poi/tools/cents/forrest.cent/lib/jakarta-regexp-1.2.jar"/>
23
    <classpathentry kind="lib" path="F:/finaleclipse/eclipse/workspace/jakarta-poi/tools/cents/forrest.cent/lib/logkit-1.0.1.jar"/>
24
    <classpathentry kind="lib" path="F:/finaleclipse/eclipse/workspace/jakarta-poi/tools/cents/forrest.cent/lib/avalon-excalibur-4.1.jar"/>
25
    <classpathentry kind="lib" path="F:/finaleclipse/eclipse/workspace/jakarta-poi/tools/cents/checkstyle.cent/lib/jakarta-regexp-1.2.jar"/>
26
    <classpathentry kind="lib" path="F:/finaleclipse/eclipse/workspace/jakarta-poi/tools/cents/checkstyle.cent/lib/checkstyle-2.1.jar"/>
27
    <classpathentry kind="lib" path="F:/finaleclipse/eclipse/workspace/jakarta-poi/tools/cents/checkstyle.cent/lib/antlr.jar"/>
28
    <classpathentry kind="lib" path="F:/finaleclipse/eclipse/workspace/jakarta-poi/tools/antipede/lib/krysalis-centipede.jar"/>
29
    <classpathentry kind="lib" path="F:/finaleclipse/eclipse/workspace/jakarta-poi/tools/antipede/lib/ant-contrib-0.1.jar"/>
30
    <classpathentry kind="lib" path="F:/finaleclipse/eclipse/workspace/jakarta-poi/tools/antipede/lib/ant-optional-1.5-dev-20020402.jar"/>
31
    <classpathentry kind="lib" path="F:/finaleclipse/eclipse/workspace/jakarta-poi/tools/antipede/lib/ant-taskdefs-dev-20020402.jar"/>
32
    <classpathentry kind="lib" path="F:/finaleclipse/eclipse/workspace/jakarta-poi/tools/antipede/lib/ant-xmlproperty-1.5-cvs.jar"/>
33
    <classpathentry kind="lib" path="F:/finaleclipse/eclipse/workspace/jakarta-poi/tools/antipede/lib/jjar.jar"/>
34
    <classpathentry kind="lib" path="F:/finaleclipse/eclipse/workspace/jakarta-poi/tools/antipede/lib/ant-1.5-dev-20020402.jar"/>
35
    <classpathentry kind="lib" path="F:/finaleclipse/eclipse/workspace/jakarta-poi/lib/endorsed/xml-apis.jar"/>
36
    <classpathentry kind="lib" path="F:/finaleclipse/eclipse/workspace/jakarta-poi/lib/endorsed/xerces-2.0.0.jar"/>
37
    <classpathentry kind="lib" path="F:/finaleclipse/eclipse/workspace/jakarta-poi/lib/endorsed/xalan-2.2.0.jar"/>
9
    <classpathentry kind="output" path="build"/>
38
    <classpathentry kind="output" path="build"/>
10
</classpath>
39
</classpath>
(-)src/java/org/apache/poi/hssf/model/Workbook.java (+17 lines)
Lines 428-433 Link Here
428
    // for compatibility
428
    // for compatibility
429
    public void setSheetName(int sheetnum, String sheetname ) {
429
    public void setSheetName(int sheetnum, String sheetname ) {
430
        setSheetName( sheetnum, sheetname, (byte)0 );
430
        setSheetName( sheetnum, sheetname, (byte)0 );
431
        
432
        
431
    }
433
    }
432
434
433
    public void setSheetName(int sheetnum, String sheetname, short encoding ) {
435
    public void setSheetName(int sheetnum, String sheetname, short encoding ) {
Lines 437-442 Link Here
437
        sheet.setSheetnameLength( (byte)sheetname.length() );
439
        sheet.setSheetnameLength( (byte)sheetname.length() );
438
		sheet.setCompressedUnicodeFlag( (byte)encoding );
440
		sheet.setCompressedUnicodeFlag( (byte)encoding );
439
    }
441
    }
442
443
	/**
444
	 * sets the order of appearance for a given sheet.
445
	 *
446
	 * @param sheetname the name of the sheet to reorder
447
	 * @param pos the position that we want to insert the sheet into (0 based)
448
	 */
449
    
450
	public void setSheetOrder(String sheetname, int pos ) {
451
		int sheetNumber = getSheetIndex(sheetname);
452
		
453
		//remove the sheet that needs to be reordered and place it in the spot we want
454
		boundsheets.add(pos, boundsheets.remove(sheetNumber));
455
				
456
	}
440
457
441
    /**
458
    /**
442
     * gets the name for a given sheet.
459
     * gets the name for a given sheet.
(-)src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheetSetOrder.java (+99 lines)
Added Link Here
1
/* ====================================================================
2
 * The Apache Software License, Version 1.1
3
 *
4
 * Copyright (c) 2002 The Apache Software Foundation.  All rights
5
 * reserved.
6
 *
7
 * Redistribution and use in source and binary forms, with or without
8
 * modification, are permitted provided that the following conditions
9
 * are met:
10
 *
11
 * 1. Redistributions of source code must retain the above copyright
12
 *    notice, this list of conditions and the following disclaimer.
13
 *
14
 * 2. Redistributions in binary form must reproduce the above copyright
15
 *    notice, this list of conditions and the following disclaimer in
16
 *    the documentation and/or other materials provided with the
17
 *    distribution.
18
 *
19
 * 3. The end-user documentation included with the redistribution,
20
 *    if any, must include the following acknowledgment:
21
 *       "This product includes software developed by the
22
 *        Apache Software Foundation (http://www.apache.org/)."
23
 *    Alternately, this acknowledgment may appear in the software itself,
24
 *    if and wherever such third-party acknowledgments normally appear.
25
 *
26
 * 4. The names "Apache" and "Apache Software Foundation" and
27
 *    "Apache POI" must not be used to endorse or promote products
28
 *    derived from this software without prior written permission. For
29
 *    written permission, please contact apache@apache.org.
30
 *
31
 * 5. Products derived from this software may not be called "Apache",
32
 *    "Apache POI", nor may "Apache" appear in their name, without
33
 *    prior written permission of the Apache Software Foundation.
34
 *
35
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
36
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
37
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
38
 * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
39
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
40
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
41
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
42
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
43
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
44
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
45
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
46
 * SUCH DAMAGE.
47
 * ====================================================================
48
 *
49
 * This software consists of voluntary contributions made by many
50
 * individuals on behalf of the Apache Software Foundation.  For more
51
 * information on the Apache Software Foundation, please see
52
 * <http://www.apache.org/>.
53
 */
54
55
package org.apache.poi.hssf.usermodel;
56
57
import junit.framework.TestCase;
58
59
import org.apache.poi.hssf.model.Sheet;
60
61
/**
62
 * Tests HSSFWorkbook method setSheetOrder()
63
 *
64
 *
65
 * @author Ruel Loehr (loehr1 at us.ibm.com)
66
 */
67
68
public class TestHSSFSheetSetOrder
69
        extends TestCase
70
{
71
    public TestHSSFSheetSetOrder(String s)
72
    {
73
        super(s);
74
    }
75
76
    /**
77
     * Test the sheet set order method
78
     */
79
80
    public void testBackupRecord()
81
            throws Exception
82
    {
83
        HSSFWorkbook wb = new HSSFWorkbook();
84
        
85
        for (int i=0; i < 10; i++)
86
        {
87
			HSSFSheet s = wb.createSheet("Sheet " + i);
88
			Sheet sheet = s.getSheet();
89
        }
90
91
      wb.getWorkbook().setSheetOrder("Sheet 6", 0);
92
	  wb.getWorkbook().setSheetOrder("Sheet 3", 7);
93
	  wb.getWorkbook().setSheetOrder("Sheet 1", 9);
94
	  
95
	 
96
    }
97
98
99
}

Return to bug 17491