public Object Clone() { PatternFormatting rec = new PatternFormatting(); rec.field_15_pattern_style = field_15_pattern_style; rec.field_16_pattern_color_indexes = field_16_pattern_color_indexes; return(rec); }
public CFRuleRecord(RecordInputStream in1) { field_1_condition_type = (byte)in1.ReadByte(); field_2_comparison_operator = (byte)in1.ReadByte(); int field_3_formula1_len = in1.ReadUShort(); int field_4_formula2_len = in1.ReadUShort(); field_5_options = in1.ReadInt(); field_6_not_used = in1.ReadShort(); if (ContainsFontFormattingBlock) { _fontFormatting = new FontFormatting(in1); } if (ContainsBorderFormattingBlock) { _borderFormatting = new BorderFormatting(in1); } if (ContainsPatternFormattingBlock) { _patternFormatting = new PatternFormatting(in1); } field_17_formula1 = FR.Formula.Read(field_3_formula1_len, in1); field_18_formula2 = FR.Formula.Read(field_4_formula2_len, in1); }
/** Creates new CFRuleRecord */ private CFRuleRecord(byte conditionType, ComparisonOperator comparisonOperation) { field_1_condition_type = conditionType; field_2_comparison_operator =(byte) comparisonOperation; // Set modification flags to 1: by default options are not modified field_5_options = modificationBits.SetValue(field_5_options, -1); // Set formatting block flags to 0 (no formatting blocks) field_5_options = fmtBlockBits.SetValue(field_5_options, 0); field_5_options = Undocumented.Clear(field_5_options); //TODO:: check what's this field used for field_6_not_used = unchecked((short)0x8002); // Excel seems to Write this value, but it doesn't seem to care what it Reads _fontFormatting = null; //field_8_align_text_break = 0; //field_9_align_text_rotation_angle = 0; //field_10_align_indentation = 0; //field_11_relative_indentation = 0; //field_12_not_used = 0; _borderFormatting = null; _patternFormatting = null; field_17_formula1 = FR.Formula.Create(Ptg.EMPTY_PTG_ARRAY); field_18_formula2 = FR.Formula.Create(Ptg.EMPTY_PTG_ARRAY); }
public Object Clone() { PatternFormatting rec = new PatternFormatting(); rec.field_15_pattern_style = field_15_pattern_style; rec.field_16_pattern_color_indexes = field_16_pattern_color_indexes; return rec; }
/// <summary> /// Initializes a new instance of the <see cref="HSSFPatternFormatting"/> class. /// </summary> /// <param name="cfRuleRecord">The cf rule record.</param> public HSSFPatternFormatting(CFRuleRecord cfRuleRecord) { this.cfRuleRecord = cfRuleRecord; this.patternFormatting = cfRuleRecord.PatternFormatting; }
private HSSFPatternFormatting GetPatternFormatting(bool Create) { PatternFormatting patternFormatting = cfRuleRecord.PatternFormatting; if (patternFormatting != null) { cfRuleRecord.PatternFormatting=(patternFormatting); return new HSSFPatternFormatting(cfRuleRecord); } else if (Create) { patternFormatting = new PatternFormatting(); cfRuleRecord.PatternFormatting=(patternFormatting); return new HSSFPatternFormatting(cfRuleRecord); } else { return null; } }
private void TestCFRuleRecord1(CFRuleRecord record) { FontFormatting fontFormatting = new FontFormatting(); TestFontFormattingAccessors(fontFormatting); Assert.IsFalse(record.ContainsFontFormattingBlock); record.FontFormatting = (fontFormatting); Assert.IsTrue(record.ContainsFontFormattingBlock); BorderFormatting borderFormatting = new BorderFormatting(); TestBorderFormattingAccessors(borderFormatting); Assert.IsFalse(record.ContainsBorderFormattingBlock); record.BorderFormatting = (borderFormatting); Assert.IsTrue(record.ContainsBorderFormattingBlock); Assert.IsFalse(record.IsLeftBorderModified); record.IsLeftBorderModified = (true); Assert.IsTrue(record.IsLeftBorderModified); Assert.IsFalse(record.IsRightBorderModified); record.IsRightBorderModified = (true); Assert.IsTrue(record.IsRightBorderModified); Assert.IsFalse(record.IsTopBorderModified); record.IsTopBorderModified = (true); Assert.IsTrue(record.IsTopBorderModified); Assert.IsFalse(record.IsBottomBorderModified); record.IsBottomBorderModified = (true); Assert.IsTrue(record.IsBottomBorderModified); Assert.IsFalse(record.IsTopLeftBottomRightBorderModified); record.IsTopLeftBottomRightBorderModified = (true); Assert.IsTrue(record.IsTopLeftBottomRightBorderModified); Assert.IsFalse(record.IsBottomLeftTopRightBorderModified); record.IsBottomLeftTopRightBorderModified = (true); Assert.IsTrue(record.IsBottomLeftTopRightBorderModified); PatternFormatting patternFormatting = new PatternFormatting(); TestPatternFormattingAccessors(patternFormatting); Assert.IsFalse(record.ContainsPatternFormattingBlock); record.PatternFormatting = (patternFormatting); Assert.IsTrue(record.ContainsPatternFormattingBlock); Assert.IsFalse(record.IsPatternBackgroundColorModified); record.IsPatternBackgroundColorModified = (true); Assert.IsTrue(record.IsPatternBackgroundColorModified); Assert.IsFalse(record.IsPatternColorModified); record.IsPatternColorModified = (true); Assert.IsTrue(record.IsPatternColorModified); Assert.IsFalse(record.IsPatternStyleModified); record.IsPatternStyleModified = (true); Assert.IsTrue(record.IsPatternStyleModified); }
public void TestWrite() { HSSFWorkbook workbook = new HSSFWorkbook(); HSSFSheet sheet = (HSSFSheet)workbook.CreateSheet(); CFRuleRecord rr = CFRuleRecord.Create(sheet, (byte)ComparisonOperator.Between, "5", "10"); PatternFormatting patternFormatting = new PatternFormatting(); patternFormatting.FillPattern = FillPattern.Bricks; rr.PatternFormatting=(patternFormatting); byte[] data = rr.Serialize(); Assert.AreEqual(26, data.Length); Assert.AreEqual(3, LittleEndian.GetShort(data, 6)); Assert.AreEqual(3, LittleEndian.GetShort(data, 8)); int flags = LittleEndian.GetInt(data, 10); Assert.AreEqual(0x00380000, flags & 0x00380000,"unused flags should be 111"); Assert.AreEqual(0, flags & 0x03C00000,"undocumented flags should be 0000"); // Otherwise Excel s unhappy // check all remaining flag bits (some are not well understood yet) Assert.AreEqual(0x203FFFFF, flags); }
private void TestPatternFormattingAccessors(PatternFormatting patternFormatting) { patternFormatting.FillBackgroundColor = (HSSFColor.Green.Index); Assert.AreEqual(HSSFColor.Green.Index, patternFormatting.FillBackgroundColor); patternFormatting.FillForegroundColor = (HSSFColor.Indigo.Index); Assert.AreEqual(HSSFColor.Indigo.Index, patternFormatting.FillForegroundColor); patternFormatting.FillPattern = FillPattern.Diamonds; Assert.AreEqual(FillPattern.Diamonds, patternFormatting.FillPattern); }
private void TestPatternFormattingAccessors(PatternFormatting patternFormatting) { patternFormatting.FillBackgroundColor = (HSSFColor.GREEN.index); Assert.AreEqual(HSSFColor.GREEN.index, patternFormatting.FillBackgroundColor); patternFormatting.FillForegroundColor = (HSSFColor.INDIGO.index); Assert.AreEqual(HSSFColor.INDIGO.index, patternFormatting.FillForegroundColor); patternFormatting.FillPattern = (PatternFormatting.DIAMONDS); Assert.AreEqual(PatternFormatting.DIAMONDS, patternFormatting.FillPattern); }