예제 #1
0
 internal void RefreshFormula()
 {
     this.Formula = SLChartTool.GetChartReferenceFormula(this.WorksheetName, this.StartRowIndex, this.StartColumnIndex, this.EndRowIndex, this.EndColumnIndex);
 }
예제 #2
0
        internal C.ValueAxis ToValueAxis(bool IsStylish = false)
        {
            C.ValueAxis va = new C.ValueAxis();
            va.AxisId = new C.AxisId()
            {
                Val = this.AxisId
            };

            va.Scaling             = new C.Scaling();
            va.Scaling.Orientation = new C.Orientation()
            {
                Val = this.Orientation
            };
            if (this.LogBase != null)
            {
                va.Scaling.LogBase = new C.LogBase()
                {
                    Val = this.LogBase.Value
                }
            }
            ;
            if (this.MaxAxisValue != null)
            {
                va.Scaling.MaxAxisValue = new C.MaxAxisValue()
                {
                    Val = this.MaxAxisValue.Value
                }
            }
            ;
            if (this.MinAxisValue != null)
            {
                va.Scaling.MinAxisValue = new C.MinAxisValue()
                {
                    Val = this.MinAxisValue.Value
                }
            }
            ;

            va.Delete = new C.Delete()
            {
                Val = this.Delete
            };

            C.AxisPositionValues axpos = this.AxisPosition;
            if (!this.ForceAxisPosition)
            {
                if (this.OtherAxisIsInReverseOrder)
                {
                    axpos = SLChartTool.GetOppositePosition(axpos);
                }
                if (this.OtherAxisCrossedAtMaximum)
                {
                    axpos = SLChartTool.GetOppositePosition(axpos);
                }
            }
            va.AxisPosition = new C.AxisPosition()
            {
                Val = axpos
            };

            if (this.ShowMajorGridlines)
            {
                va.MajorGridlines = this.MajorGridlines.ToMajorGridlines(IsStylish);
            }

            if (this.ShowMinorGridlines)
            {
                va.MinorGridlines = this.MinorGridlines.ToMinorGridlines(IsStylish);
            }

            if (this.ShowTitle)
            {
                va.Title = this.Title.ToTitle(IsStylish);
            }

            if (this.HasNumberingFormat)
            {
                va.NumberingFormat = new C.NumberingFormat()
                {
                    FormatCode   = this.FormatCode,
                    SourceLinked = this.SourceLinked
                };
            }

            va.MajorTickMark = new C.MajorTickMark()
            {
                Val = this.MajorTickMark
            };
            va.MinorTickMark = new C.MinorTickMark()
            {
                Val = this.MinorTickMark
            };
            va.TickLabelPosition = new C.TickLabelPosition()
            {
                Val = this.TickLabelPosition
            };

            if (this.ShapeProperties.HasShapeProperties)
            {
                va.ChartShapeProperties = this.ShapeProperties.ToChartShapeProperties(IsStylish);
            }

            if (this.Rotation != null || this.Vertical != null || this.Anchor != null || this.AnchorCenter != null)
            {
                va.TextProperties = new C.TextProperties();
                va.TextProperties.BodyProperties = new A.BodyProperties();
                if (this.Rotation != null)
                {
                    va.TextProperties.BodyProperties.Rotation = (int)(this.Rotation.Value * SLConstants.DegreeToAngleRepresentation);
                }
                if (this.Vertical != null)
                {
                    va.TextProperties.BodyProperties.Vertical = this.Vertical.Value;
                }
                if (this.Anchor != null)
                {
                    va.TextProperties.BodyProperties.Anchor = this.Anchor.Value;
                }
                if (this.AnchorCenter != null)
                {
                    va.TextProperties.BodyProperties.AnchorCenter = this.AnchorCenter.Value;
                }

                va.TextProperties.ListStyle = new A.ListStyle();

                A.Paragraph para = new A.Paragraph();
                para.ParagraphProperties = new A.ParagraphProperties();
                para.ParagraphProperties.Append(new A.DefaultRunProperties());
                va.TextProperties.Append(para);
            }
            else if (IsStylish)
            {
                va.TextProperties = new C.TextProperties();
                va.TextProperties.BodyProperties = new A.BodyProperties()
                {
                    Rotation            = -60000000,
                    UseParagraphSpacing = true,
                    VerticalOverflow    = A.TextVerticalOverflowValues.Ellipsis,
                    Vertical            = A.TextVerticalValues.Horizontal,
                    Wrap         = A.TextWrappingValues.Square,
                    Anchor       = A.TextAnchoringTypeValues.Center,
                    AnchorCenter = true
                };
                va.TextProperties.ListStyle = new A.ListStyle();

                A.Paragraph para = new A.Paragraph();
                para.ParagraphProperties = new A.ParagraphProperties();

                A.DefaultRunProperties defrunprops = new A.DefaultRunProperties();
                defrunprops.FontSize  = 900;
                defrunprops.Bold      = false;
                defrunprops.Italic    = false;
                defrunprops.Underline = A.TextUnderlineValues.None;
                defrunprops.Strike    = A.TextStrikeValues.NoStrike;
                defrunprops.Kerning   = 1200;
                defrunprops.Baseline  = 0;

                A.SchemeColor schclr = new A.SchemeColor()
                {
                    Val = A.SchemeColorValues.Text1
                };
                schclr.Append(new A.LuminanceModulation()
                {
                    Val = 65000
                });
                schclr.Append(new A.LuminanceOffset()
                {
                    Val = 35000
                });
                defrunprops.Append(new A.SolidFill()
                {
                    SchemeColor = schclr
                });

                defrunprops.Append(new A.LatinFont()
                {
                    Typeface = "+mn-lt"
                });
                defrunprops.Append(new A.EastAsianFont()
                {
                    Typeface = "+mn-ea"
                });
                defrunprops.Append(new A.ComplexScriptFont()
                {
                    Typeface = "+mn-cs"
                });

                para.ParagraphProperties.Append(defrunprops);
                para.Append(new A.EndParagraphRunProperties()
                {
                    Language = System.Globalization.CultureInfo.CurrentCulture.Name
                });

                va.TextProperties.Append(para);
            }

            va.CrossingAxis = new C.CrossingAxis()
            {
                Val = this.CrossingAxis
            };

            if (this.IsCrosses != null)
            {
                if (this.IsCrosses.Value)
                {
                    va.Append(new C.Crosses()
                    {
                        Val = this.Crosses
                    });
                }
                else
                {
                    va.Append(new C.CrossesAt()
                    {
                        Val = this.CrossesAt
                    });
                }
            }

            va.Append(new C.CrossBetween()
            {
                Val = this.CrossBetween
            });
            if (this.ValueMajorUnit != null)
            {
                va.Append(new C.MajorUnit()
                {
                    Val = this.ValueMajorUnit.Value
                });
            }
            if (this.ValueMinorUnit != null)
            {
                va.Append(new C.MinorUnit()
                {
                    Val = this.ValueMinorUnit.Value
                });
            }

            if (this.BuiltInUnitValues != null)
            {
                C.DisplayUnits du = new C.DisplayUnits();
                du.Append(new C.BuiltInUnit()
                {
                    Val = this.BuiltInUnitValues.Value
                });
                if (this.ShowDisplayUnitsLabel)
                {
                    C.DisplayUnitsLabel dul = new C.DisplayUnitsLabel();
                    dul.Layout = new C.Layout();
                    du.Append(dul);
                }
                va.Append(du);
            }

            return(va);
        }