예제 #1
0
        public Object Clone()
        {
            BorderFormatting rec = new BorderFormatting();

            rec.field_13_border_styles1 = field_13_border_styles1;
            rec.field_14_border_styles2 = field_14_border_styles2;
            return(rec);
        }
예제 #2
0
        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);
    }
예제 #3
0
        /** 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);
        }
예제 #4
0
 public HSSFBorderFormatting(CFRuleRecord cfRuleRecord)
 {
     this.cfRuleRecord = cfRuleRecord;
     this.borderFormatting = cfRuleRecord.BorderFormatting;
 }
예제 #5
0
 public Object Clone()
 {
     BorderFormatting rec = new BorderFormatting();
     rec.field_13_border_styles1 = field_13_border_styles1;
     rec.field_14_border_styles2 = field_14_border_styles2;
     return rec;
 }
 private HSSFBorderFormatting GetBorderFormatting(bool Create)
 {
     BorderFormatting borderFormatting = cfRuleRecord.BorderFormatting;
     if (borderFormatting != null)
     {
         cfRuleRecord.BorderFormatting=(borderFormatting);
         return new HSSFBorderFormatting(cfRuleRecord);
     }
     else if (Create)
     {
         borderFormatting = new BorderFormatting();
         cfRuleRecord.BorderFormatting=(borderFormatting);
         return new HSSFBorderFormatting(cfRuleRecord);
     }
     else
     {
         return null;
     }
 }
예제 #7
0
        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);
	    }
예제 #8
0
        private void TestBorderFormattingAccessors(BorderFormatting borderFormatting)
        {
            borderFormatting.IsBackwardDiagonalOn = (false);
            Assert.IsFalse(borderFormatting.IsBackwardDiagonalOn);
            borderFormatting.IsBackwardDiagonalOn = (true);
            Assert.IsTrue(borderFormatting.IsBackwardDiagonalOn);

            borderFormatting.BorderBottom = BorderStyle.Dotted;
            Assert.AreEqual(BorderStyle.Dotted, borderFormatting.BorderBottom);

            borderFormatting.BorderDiagonal = (BorderStyle.Medium);
            Assert.AreEqual(BorderStyle.Medium, borderFormatting.BorderDiagonal);

            borderFormatting.BorderLeft = (BorderStyle.MediumDashDotDot);
            Assert.AreEqual(BorderStyle.MediumDashDotDot, borderFormatting.BorderLeft);

            borderFormatting.BorderRight = (BorderStyle.MediumDashed);
            Assert.AreEqual(BorderStyle.MediumDashed, borderFormatting.BorderRight);

            borderFormatting.BorderTop = (BorderStyle.Hair);
            Assert.AreEqual(BorderStyle.Hair, borderFormatting.BorderTop);

            borderFormatting.BottomBorderColor = (HSSFColor.Aqua.Index);
            Assert.AreEqual(HSSFColor.Aqua.Index, borderFormatting.BottomBorderColor);

            borderFormatting.DiagonalBorderColor = (HSSFColor.Red.Index);
            Assert.AreEqual(HSSFColor.Red.Index, borderFormatting.DiagonalBorderColor);

            Assert.IsFalse(borderFormatting.IsForwardDiagonalOn);
            borderFormatting.IsForwardDiagonalOn = (true);
            Assert.IsTrue(borderFormatting.IsForwardDiagonalOn);

            borderFormatting.LeftBorderColor = (HSSFColor.Black.Index);
            Assert.AreEqual(HSSFColor.Black.Index, borderFormatting.LeftBorderColor);

            borderFormatting.RightBorderColor = (HSSFColor.Blue.Index);
            Assert.AreEqual(HSSFColor.Blue.Index, borderFormatting.RightBorderColor);

            borderFormatting.TopBorderColor = (HSSFColor.Gold.Index);
            Assert.AreEqual(HSSFColor.Gold.Index, borderFormatting.TopBorderColor);
        }
예제 #9
0
        private void TestBorderFormattingAccessors(BorderFormatting borderFormatting)
        {
            borderFormatting.IsBackwardDiagonalOn = (false);
            Assert.IsFalse(borderFormatting.IsBackwardDiagonalOn);
            borderFormatting.IsBackwardDiagonalOn = (true);
            Assert.IsTrue(borderFormatting.IsBackwardDiagonalOn);

            borderFormatting.BorderBottom = (BorderFormatting.BORDER_DOTTED);
            Assert.AreEqual(BorderFormatting.BORDER_DOTTED, borderFormatting.BorderBottom);

            borderFormatting.BorderDiagonal = (BorderFormatting.BORDER_MEDIUM);
            Assert.AreEqual(BorderFormatting.BORDER_MEDIUM, borderFormatting.BorderDiagonal);

            borderFormatting.BorderLeft = (BorderFormatting.BORDER_MEDIUM_DASH_DOT_DOT);
            Assert.AreEqual(BorderFormatting.BORDER_MEDIUM_DASH_DOT_DOT, borderFormatting.BorderLeft);

            borderFormatting.BorderRight = (BorderFormatting.BORDER_MEDIUM_DASHED);
            Assert.AreEqual(BorderFormatting.BORDER_MEDIUM_DASHED, borderFormatting.BorderRight);

            borderFormatting.BorderTop = (BorderFormatting.BORDER_HAIR);
            Assert.AreEqual(BorderFormatting.BORDER_HAIR, borderFormatting.BorderTop);

            borderFormatting.BottomBorderColor = (HSSFColor.AQUA.index);
            Assert.AreEqual(HSSFColor.AQUA.index, borderFormatting.BottomBorderColor);

            borderFormatting.DiagonalBorderColor = (HSSFColor.RED.index);
            Assert.AreEqual(HSSFColor.RED.index, borderFormatting.DiagonalBorderColor);

            Assert.IsFalse(borderFormatting.IsForwardDiagonalOn);
            borderFormatting.IsForwardDiagonalOn = (true);
            Assert.IsTrue(borderFormatting.IsForwardDiagonalOn);

            borderFormatting.LeftBorderColor = (HSSFColor.BLACK.index);
            Assert.AreEqual(HSSFColor.BLACK.index, borderFormatting.LeftBorderColor);

            borderFormatting.RightBorderColor = (HSSFColor.BLUE.index);
            Assert.AreEqual(HSSFColor.BLUE.index, borderFormatting.RightBorderColor);

            borderFormatting.TopBorderColor = (HSSFColor.GOLD.index);
            Assert.AreEqual(HSSFColor.GOLD.index, borderFormatting.TopBorderColor);
        }