internal C.Title ToTitle(bool IsStylish = false)
        {
            var t = new C.Title();

            var bHasText = rst.ToPlainString().Length > 0;

            if (bHasText || (Rotation != null) || (Vertical != null) || (Anchor != null) || (AnchorCenter != null))
            {
                t.ChartText          = new C.ChartText();
                t.ChartText.RichText = new C.RichText();
                t.ChartText.RichText.BodyProperties = new A.BodyProperties();

                if ((Rotation != null) || (Vertical != null) || (Anchor != null) || (AnchorCenter != null))
                {
                    if (Rotation != null)
                    {
                        t.ChartText.RichText.BodyProperties.Rotation =
                            (int)(Rotation.Value * SLConstants.DegreeToAngleRepresentation);
                    }
                    if (Vertical != null)
                    {
                        t.ChartText.RichText.BodyProperties.Vertical = Vertical.Value;
                    }
                    if (Anchor != null)
                    {
                        t.ChartText.RichText.BodyProperties.Anchor = Anchor.Value;
                    }
                    if (AnchorCenter != null)
                    {
                        t.ChartText.RichText.BodyProperties.AnchorCenter = AnchorCenter.Value;
                    }
                }

                t.ChartText.RichText.ListStyle = new A.ListStyle();

                if (bHasText)
                {
                    t.ChartText.RichText.Append(rst.ToParagraph());
                }
            }

            t.Layout  = new C.Layout();
            t.Overlay = new C.Overlay {
                Val = Overlay
            };
            if (ShapeProperties.HasShapeProperties)
            {
                t.ChartShapeProperties = ShapeProperties.ToChartShapeProperties(IsStylish);
            }

            return(t);
        }
示例#2
0
        internal C.Legend ToLegend(bool IsStylish = false)
        {
            var l = new C.Legend();

            l.LegendPosition = new C.LegendPosition {
                Val = LegendPosition
            };

            l.Append(new C.Layout());
            l.Append(new C.Overlay {
                Val = Overlay
            });

            if (ShapeProperties.HasShapeProperties)
            {
                l.Append(ShapeProperties.ToChartShapeProperties(IsStylish));
            }

            if (IsStylish)
            {
                var tp = new C.TextProperties();
                tp.BodyProperties = new A.BodyProperties
                {
                    Rotation            = 0,
                    UseParagraphSpacing = true,
                    VerticalOverflow    = A.TextVerticalOverflowValues.Ellipsis,
                    Vertical            = A.TextVerticalValues.Horizontal,
                    Wrap         = A.TextWrappingValues.Square,
                    Anchor       = A.TextAnchoringTypeValues.Center,
                    AnchorCenter = true
                };
                tp.ListStyle = new A.ListStyle();

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

                var 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;

                var 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 = CultureInfo.CurrentCulture.Name
                });

                tp.Append(para);

                l.Append(tp);
            }

            return(l);
        }
        internal C.DataTable ToDataTable(bool IsStylish = false)
        {
            var dt = new C.DataTable();

            if (ShowHorizontalBorder)
            {
                dt.ShowHorizontalBorder = new C.ShowHorizontalBorder {
                    Val = true
                }
            }
            ;
            if (ShowVerticalBorder)
            {
                dt.ShowVerticalBorder = new C.ShowVerticalBorder {
                    Val = true
                }
            }
            ;
            if (ShowOutlineBorder)
            {
                dt.ShowOutlineBorder = new C.ShowOutlineBorder {
                    Val = true
                }
            }
            ;
            if (ShowLegendKeys)
            {
                dt.ShowKeys = new C.ShowKeys {
                    Val = true
                }
            }
            ;

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

            if (Font != null)
            {
                dt.TextProperties = new C.TextProperties();
                dt.TextProperties.BodyProperties = new A.BodyProperties();
                dt.TextProperties.ListStyle      = new A.ListStyle();

                dt.TextProperties.Append(Font.ToParagraph());
            }
            else if (IsStylish)
            {
                dt.TextProperties = new C.TextProperties();
                dt.TextProperties.BodyProperties = new A.BodyProperties
                {
                    Rotation            = 0,
                    UseParagraphSpacing = true,
                    VerticalOverflow    = A.TextVerticalOverflowValues.Ellipsis,
                    Vertical            = A.TextVerticalValues.Horizontal,
                    Wrap         = A.TextWrappingValues.Square,
                    Anchor       = A.TextAnchoringTypeValues.Center,
                    AnchorCenter = true
                };
                dt.TextProperties.ListStyle = new A.ListStyle();

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

                var 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;

                var 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 = CultureInfo.CurrentCulture.Name
                });

                dt.TextProperties.Append(para);
            }

            return(dt);
        }