internal X14.ConditionalFormattingIcon ToConditionalFormattingIcon() { var cfi = new X14.ConditionalFormattingIcon(); cfi.IconSet = IconSet; cfi.IconId = IconId; return(cfi); }
internal X14.ConditionalFormattingIcon ToConditionalFormattingIcon() { X14.ConditionalFormattingIcon cfi = new X14.ConditionalFormattingIcon(); cfi.IconSet = this.IconSet; cfi.IconId = this.IconId; return cfi; }
internal void FromConditionalFormattingIcon(X14.ConditionalFormattingIcon cfi) { SetAllNull(); if (cfi.IconSet != null) { IconSet = cfi.IconSet.Value; } if (cfi.IconId != null) { IconId = cfi.IconId.Value; } }
public override void WriteOpenXml(OpenXmlWriter writer) { X14.ConditionalFormatting cf = new X14.ConditionalFormatting(); cf.AddNamespaceDeclaration("xm", "http://schemas.microsoft.com/office/excel/2006/main"); ReferenceSequence referenceSequence = new ReferenceSequence(); referenceSequence.Text = $"{SpreadsheetHelper.ExcelColumnFromNumber(RangeStart.ColumnIndex)}{RangeStart.RowIndex}:{SpreadsheetHelper.ExcelColumnFromNumber(RangeEnd.ColumnIndex)}{RangeEnd.RowIndex}"; X14.ConditionalFormattingRule conditionalFormattingRule = new X14.ConditionalFormattingRule() { Type = ConditionalFormatValues.IconSet, Priority = 1, Id = Guid.NewGuid().ToString("B").ToUpper() }; X14.IconSet iconSet1 = new X14.IconSet() { IconSetTypes = new EnumValue <IconSetTypeValues>(IconSetTypeValues.FourTrafficLights), ShowValue = false, Custom = true }; //ConditionalFormattingIcon var conditionalFormattingIcon1 = new X14.ConditionalFormattingIcon() { IconSet = X14.IconSetTypeValues.NoIcons, IconId = (UInt32Value)0U }; var conditionalFormattingIcon2 = new X14.ConditionalFormattingIcon() { IconSet = X14.IconSetTypeValues.ThreeSymbols2, IconId = (UInt32Value)2U }; var conditionalFormattingIcon3 = new X14.ConditionalFormattingIcon() { IconSet = X14.IconSetTypeValues.ThreeSymbols, IconId = (UInt32Value)1U }; var conditionalFormattingIcon4 = new X14.ConditionalFormattingIcon() { IconSet = X14.IconSetTypeValues.ThreeSymbols, IconId = (UInt32Value)0U }; X14.ConditionalFormattingValueObject conditionalFormattingValueObject1 = new X14.ConditionalFormattingValueObject() { Type = X14.ConditionalFormattingValueObjectTypeValues.Numeric }; Formula formula1 = new Formula(); formula1.Text = "0"; conditionalFormattingValueObject1.Append(formula1); X14.ConditionalFormattingValueObject conditionalFormattingValueObject2 = new X14.ConditionalFormattingValueObject() { Type = X14.ConditionalFormattingValueObjectTypeValues.Numeric }; Formula formula2 = new Formula(); formula2.Text = "1"; conditionalFormattingValueObject2.Append(formula2); X14.ConditionalFormattingValueObject conditionalFormattingValueObject3 = new X14.ConditionalFormattingValueObject() { Type = X14.ConditionalFormattingValueObjectTypeValues.Numeric }; Formula formula3 = new Formula(); formula3.Text = "2"; conditionalFormattingValueObject3.Append(formula3); X14.ConditionalFormattingValueObject conditionalFormattingValueObject4 = new X14.ConditionalFormattingValueObject() { Type = X14.ConditionalFormattingValueObjectTypeValues.Numeric }; Formula formula4 = new Formula(); formula4.Text = "3"; conditionalFormattingValueObject4.Append(formula4); iconSet1.Append( conditionalFormattingValueObject1 , conditionalFormattingValueObject2 , conditionalFormattingValueObject3 , conditionalFormattingValueObject4 , conditionalFormattingIcon1 , conditionalFormattingIcon2 , conditionalFormattingIcon3 , conditionalFormattingIcon4 ); conditionalFormattingRule.Append(iconSet1); cf.Append(conditionalFormattingRule); cf.Append(referenceSequence); writer.WriteElement(cf); }