Exemplo n.º 1
0
 private void UpdateColorNode(XmlNode node, Color color)
 {
     if (!color.IsEmpty)
     {
         ExcelSparklineGroup.SetAttribute(node, "rgb", ExcelSparklineGroup.XmlColor(color));
     }
     else if (node.Attributes.Count == 0)
     {
         this.TopNode.RemoveChild(node);
     }
     // Else: the node has an unsupported color definition (such as a theme) and should be left alone.
 }
Exemplo n.º 2
0
 private void SaveAttributes()
 {
     if (this.ManualMax != null)
     {
         ExcelSparklineGroup.SetAttribute(this.TopNode, "manualMax", this.ManualMax.ToString());
     }
     else
     {
         this.ClearAttribute(this.TopNode, "manualMax");
     }
     if (this.ManualMin != null)
     {
         ExcelSparklineGroup.SetAttribute(this.TopNode, "manualMin", this.ManualMin.ToString());
     }
     else
     {
         this.ClearAttribute(this.TopNode, "manualMin");
     }
     if (this.LineWeight != null && this.LineWeight != 0.75)
     {
         ExcelSparklineGroup.SetAttribute(this.TopNode, "lineWeight", this.LineWeight.ToString());
     }
     else
     {
         this.ClearAttribute(this.TopNode, "lineWeight");
     }
     if (this.Type != null && this.Type != SparklineType.Line)
     {
         ExcelSparklineGroup.SetAttribute(this.TopNode, "type", ExcelSparklineGroup.SparklineTypeToString(this.Type.Value));
     }
     else
     {
         this.ClearAttribute(this.TopNode, "type");
     }
     if (this.DateAxis)
     {
         ExcelSparklineGroup.SetAttribute(this.TopNode, "dateAxis", "1");
     }
     else
     {
         this.ClearAttribute(this.TopNode, "dateAxis");
     }
     if (this.DisplayEmptyCellsAs != null && this.DisplayEmptyCellsAs != DispBlanksAs.Zero)
     {
         ExcelSparklineGroup.SetAttribute(this.TopNode, "displayEmptyCellsAs", ExcelSparklineGroup.DisplayBlanksAsToString(this.DisplayEmptyCellsAs.Value));
     }
     else
     {
         this.ClearAttribute(this.TopNode, "displayEmptyCellsAs");
     }
     if (this.Markers)
     {
         ExcelSparklineGroup.SetAttribute(this.TopNode, "markers", "1");
     }
     else
     {
         this.ClearAttribute(this.TopNode, "markers");
     }
     if (this.High)
     {
         ExcelSparklineGroup.SetAttribute(this.TopNode, "high", "1");
     }
     else
     {
         this.ClearAttribute(this.TopNode, "high");
     }
     if (this.Low)
     {
         ExcelSparklineGroup.SetAttribute(this.TopNode, "low", "1");
     }
     else
     {
         this.ClearAttribute(this.TopNode, "low");
     }
     if (this.First)
     {
         ExcelSparklineGroup.SetAttribute(this.TopNode, "first", "1");
     }
     else
     {
         this.ClearAttribute(this.TopNode, "first");
     }
     if (this.Last)
     {
         ExcelSparklineGroup.SetAttribute(this.TopNode, "last", "1");
     }
     else
     {
         this.ClearAttribute(this.TopNode, "last");
     }
     if (this.Negative)
     {
         ExcelSparklineGroup.SetAttribute(this.TopNode, "negative", "1");
     }
     else
     {
         this.ClearAttribute(this.TopNode, "negative");
     }
     if (this.DisplayXAxis)
     {
         ExcelSparklineGroup.SetAttribute(this.TopNode, "displayXAxis", "1");
     }
     else
     {
         this.ClearAttribute(this.TopNode, "displayXAxis");
     }
     if (this.DisplayHidden)
     {
         ExcelSparklineGroup.SetAttribute(this.TopNode, "displayHidden", "1");
     }
     else
     {
         this.ClearAttribute(this.TopNode, "displayHidden");
     }
     if (this.MinAxisType != SparklineAxisMinMax.Individual)
     {
         ExcelSparklineGroup.SetAttribute(this.TopNode, "minAxisType", ExcelSparklineGroup.SparklineAxisMinMaxToString(this.MinAxisType));
     }
     else
     {
         this.ClearAttribute(this.TopNode, "minAxisType");
     }
     if (this.MaxAxisType != SparklineAxisMinMax.Individual)
     {
         ExcelSparklineGroup.SetAttribute(this.TopNode, "maxAxisType", ExcelSparklineGroup.SparklineAxisMinMaxToString(this.MaxAxisType));
     }
     else
     {
         this.ClearAttribute(this.TopNode, "maxAxisType");
     }
     if (this.RightToLeft)
     {
         ExcelSparklineGroup.SetAttribute(this.TopNode, "rightToLeft", "1");
     }
     else
     {
         this.ClearAttribute(this.TopNode, "rightToLeft");
     }
 }