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

(-)src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java (+27 lines)
Lines 514-519 Link Here
514
    }
514
    }
515
515
516
    /**
516
    /**
517
     * determines whether the output is horizontally centered on the page.
518
     * @param value true to horizontally center, false otherwise.
519
     */
520
521
    public void setHorizontallyCenter(boolean value)
522
    {
523
        HCenterRecord record =
524
                (HCenterRecord) sheet.findFirstRecordBySid(HCenterRecord.sid);
525
526
        record.setHCenter(value);
527
    }
528
529
    /**
530
     * Determine whether printed output for this sheet will be horizontally centered.
531
     */
532
533
    public boolean getHorizontallyCenter()
534
    {
535
        HCenterRecord record =
536
                (HCenterRecord) sheet.findFirstRecordBySid(HCenterRecord.sid);
537
538
        return record.getHCenter();
539
    }
540
    
541
    
542
    
543
    /**
517
     * removes a merged region of cells (hence letting them free)
544
     * removes a merged region of cells (hence letting them free)
518
     * @param index of the region to unmerge
545
     * @param index of the region to unmerge
519
     */
546
     */
(-)src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java (+21 lines)
Lines 56-61 Link Here
56
56
57
import junit.framework.TestCase;
57
import junit.framework.TestCase;
58
import org.apache.poi.hssf.model.Sheet;
58
import org.apache.poi.hssf.model.Sheet;
59
import org.apache.poi.hssf.record.HCenterRecord;
59
import org.apache.poi.hssf.record.VCenterRecord;
60
import org.apache.poi.hssf.record.VCenterRecord;
60
import org.apache.poi.hssf.record.WSBoolRecord;
61
import org.apache.poi.hssf.record.WSBoolRecord;
61
62
Lines 115-120 Link Here
115
        // wb.write(new FileOutputStream("c:\\test.xls"));
116
        // wb.write(new FileOutputStream("c:\\test.xls"));
116
    }
117
    }
117
118
119
    /**
120
     * Test horizontally centered output.
121
     */
122
123
    public void testHorizontallyCenter()
124
            throws Exception
125
    {
126
        HSSFWorkbook wb = new HSSFWorkbook();
127
        HSSFSheet s = wb.createSheet();
128
        Sheet sheet = s.getSheet();
129
        HCenterRecord record =
130
                (HCenterRecord) sheet.findFirstRecordBySid(HCenterRecord.sid);
131
132
        assertEquals(false, record.getHCenter());
133
        s.setHorizontallyCenter(true);
134
        assertEquals(true, record.getHCenter());
135
136
    }    
137
    
138
    
118
    /**
139
    /**
119
     * Test WSBboolRecord fields get set in the user model.
140
     * Test WSBboolRecord fields get set in the user model.
120
     */
141
     */

Return to bug 15677