removed incorrect test case methods
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@642880 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
05fb78c5d4
commit
9f66b9c5f4
@ -17,14 +17,6 @@
|
||||
|
||||
package org.apache.poi.hssf.usermodel;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.apache.poi.hssf.record.CFRuleRecord.ComparisonOperator;
|
||||
@ -36,7 +28,7 @@ import org.apache.poi.hssf.util.Region;
|
||||
*/
|
||||
public final class TestHSSFConfditionalFormatting extends TestCase
|
||||
{
|
||||
public void XtestLastAndFirstColumns()
|
||||
public void testLastAndFirstColumns()
|
||||
{
|
||||
HSSFWorkbook workbook = new HSSFWorkbook();
|
||||
HSSFSheet sheet = workbook.createSheet();
|
||||
@ -95,109 +87,4 @@ public final class TestHSSFConfditionalFormatting extends TestCase
|
||||
assertEquals("2",rule2.getFormula2());
|
||||
assertEquals("1",rule2.getFormula1());
|
||||
}
|
||||
|
||||
public void XtestOutput() {
|
||||
|
||||
HSSFWorkbook wb = new HSSFWorkbook();
|
||||
HSSFSheet sheet = wb.createSheet();
|
||||
String formula = "7";
|
||||
|
||||
HSSFFontFormatting fontFmt = new HSSFFontFormatting();
|
||||
fontFmt.setFontStyle(true, false);
|
||||
|
||||
HSSFBorderFormatting bordFmt = new HSSFBorderFormatting();
|
||||
bordFmt.setBorderBottom(HSSFBorderFormatting.BORDER_THIN);
|
||||
bordFmt.setBorderTop(HSSFBorderFormatting.BORDER_THICK);
|
||||
bordFmt.setBorderLeft(HSSFBorderFormatting.BORDER_DASHED);
|
||||
bordFmt.setBorderRight(HSSFBorderFormatting.BORDER_DOTTED);
|
||||
|
||||
HSSFPatternFormatting patternFmt = new HSSFPatternFormatting();
|
||||
patternFmt.setFillBackgroundColor(HSSFColor.RED.index);
|
||||
|
||||
HSSFConditionalFormattingRule [] cfRules =
|
||||
{
|
||||
sheet.createConditionalFormattingRule(formula, fontFmt, bordFmt, patternFmt),
|
||||
sheet.createConditionalFormattingRule(ComparisonOperator.BETWEEN, "1", "2", fontFmt, bordFmt, patternFmt)
|
||||
};
|
||||
|
||||
short col = 1;
|
||||
Region [] regions =
|
||||
{
|
||||
new Region(0,col,-1,col)
|
||||
};
|
||||
|
||||
sheet.addConditionalFormatting(regions, cfRules);
|
||||
|
||||
try {
|
||||
OutputStream os = new FileOutputStream("C:/josh/temp/cfExample.xls");
|
||||
wb.write(os);
|
||||
os.close();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void testReadWrite() {
|
||||
|
||||
HSSFWorkbook wb;
|
||||
try {
|
||||
InputStream is = new FileInputStream("C:/josh/temp/cfEx.xls");
|
||||
wb = new HSSFWorkbook(is);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
HSSFSheet sheet = wb.getSheetAt(0);
|
||||
|
||||
int nCFs = sheet.getNumConditionalFormattings();
|
||||
HSSFConditionalFormatting cf = sheet.getConditionalFormattingAt(0);
|
||||
Region[] regions = cf.getFormattingRegions();
|
||||
|
||||
sheet.removeConditionalFormatting(0);
|
||||
|
||||
HSSFFontFormatting fontFmt = new HSSFFontFormatting();
|
||||
fontFmt.setFontStyle(false, true);
|
||||
HSSFConditionalFormattingRule rule1 = cf.getRule(0);
|
||||
HSSFConditionalFormattingRule rule = sheet.createConditionalFormattingRule(ComparisonOperator.BETWEEN, "5", "10", fontFmt, null, null);
|
||||
|
||||
byte[] rawRecord1 = rule1.getCfRuleRecord().getFontFormatting().getRawRecord();
|
||||
for (int i = 0; i < rawRecord1.length; i++) {
|
||||
System.out.print(rawRecord1[i] + ",");
|
||||
}
|
||||
System.out.println();
|
||||
|
||||
byte[] rawRecord = fontFmt.getFontFormattingBlock().getRawRecord();
|
||||
for (int i = 0; i < rawRecord.length; i++) {
|
||||
System.out.print(rawRecord[i]+ ",");
|
||||
}
|
||||
System.out.println();
|
||||
|
||||
rule.getCfRuleRecord().setFontFormatting(rule1.getCfRuleRecord().getFontFormatting());
|
||||
|
||||
sheet.addConditionalFormatting(regions, new HSSFConditionalFormattingRule[] { rule, });
|
||||
|
||||
|
||||
HSSFWorkbook wb2;
|
||||
if(false) try {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
wb.write(baos);
|
||||
|
||||
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
|
||||
|
||||
wb2 = new HSSFWorkbook(bais);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
OutputStream os = new FileOutputStream("C:/josh/temp/cfEx3.xls");
|
||||
wb.write(os);
|
||||
os.close();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user