/// <summary>
        /// Set custom label text.
        /// </summary>
        /// <param name="Text">The custom text.</param>
        public void SetLabelText(string Text)
        {
            SLRstType rst = new SLRstType();

            rst.AppendText(Text);
            this.RichText = rst.Clone();
        }
Esempio n. 2
0
        private void SetAllNull()
        {
            sAuthor           = string.Empty;
            rst               = new SLRstType();
            HasSetPosition    = false;
            Top               = 0;
            Left              = 0;
            UsePositionMargin = false;
            TopMargin         = 0;
            LeftMargin        = 0;
            AutoSize          = false;
            fWidth            = SLConstants.DefaultCommentBoxWidth;
            fHeight           = SLConstants.DefaultCommentBoxHeight;

            Fill = new SLFill(listThemeColors);
            Fill.SetSolidFill(Color.FromArgb(255, 255, 225), 0);
            bFromTransparency = 0;
            bToTransparency   = 0;

            LineColor               = null;
            fLineWeight             = null;
            LineStyle               = StrokeLineStyleValues.Single;
            vLineDashStyle          = null;
            vEndCap                 = null;
            HorizontalTextAlignment = SLHorizontalTextAlignmentValues.Left;
            VerticalTextAlignment   = SLVerticalTextAlignmentValues.Top;
            Orientation             = SLCommentOrientationValues.Horizontal;
            TextDirection           = SLAlignmentReadingOrderValues.ContextDependent;

            HasShadow   = true;
            ShadowColor = Color.Black;

            Visible = false;
        }
Esempio n. 3
0
        /// <summary>
        ///     Get existing shared strings. WARNING: This is only a snapshot. Any changes made to the returned result are not
        ///     used.
        /// </summary>
        /// <returns>A list of existing shared strings.</returns>
        public List <SLRstType> GetSharedStrings()
        {
            var result = new List <SLRstType>();
            var rst    = new SLRstType();

            for (var i = 0; i < listSharedString.Count; ++i)
            {
                rst.FromHash(listSharedString[i]);
                result.Add(rst.Clone());
            }

            return(result);
        }
        internal SLTitle(List <Color> ThemeColors, bool IsStylish = false)
        {
            // just put in the theme colors, even though it's probably not needed.
            // Memory optimisations? Take it out.
            rst = new SLRstType(SLConstants.OfficeThemeMajorLatinFont, SLConstants.OfficeThemeMinorLatinFont,
                                ThemeColors, new List <Color>());
            Overlay         = false;
            ShapeProperties = new SLShapeProperties(ThemeColors);

            if (IsStylish)
            {
                ShapeProperties.Fill.SetNoFill();
                ShapeProperties.Outline.SetNoLine();
            }

            RemoveTextAlignment();
        }
        //For each sheet in the publishing form folder, create a metadata sheet by deleting the unneeded columns
        public void createMetadata()
        {
            listFileNames(folderPath);
            foreach (var f in pubforms)
            {
                SLDocument sl = new SLDocument(folderPath + "\\" + f.Value);

                //Select Publishing tab
                sl.SelectWorksheet(MetaPresTab);

                //Try and rename something in the header row
                //Big "Source"
                //Small "Global master slides or locally developed slides that maintain the main message of that slide = GL; otherwise set to LO"
                //D34
                SLRstType Heading1 = new SLRstType();
                SLFont    Big      = new SLFont();
                SLFont    Small    = new SLFont();
                Big.Bold = true;
                Big.SetFont("Calibri", 14);
                Small.SetFont("Calibri", 9);
                Heading1.AppendText("PBSource", Big);
                Heading1.AppendText("Global PB master slides or locally developed slides that maintain the main message of that slide = GL; otherwise set to LO", Small);
                sl.SetCellValue("D" + (metakeymessagestartrow - 1), Heading1);

                /*
                 * // delete 1 column at column 6 - sl.DeleteColumn(6, 1);
                 * foreach (var i in NonMetadataColumns)
                 * {
                 *  sl.DeleteColumn(i, 1);
                 * }
                 *
                 * foreach (var i in NonMetadataRows)
                 * {
                 *  sl.DeleteRow(i, 1);
                 * }
                 */


                sl.SaveAs(folderPath + "\\METADATATEST-" + f.Value + ".xlsx");
            }
        }
Esempio n. 6
0
        /// <summary>
        ///     Get existing comments in the currently selected worksheet. WARNING: This is only a snapshot. Any changes made to
        ///     the returned result are not used.
        /// </summary>
        /// <returns>A Dictionary of existing comments.</returns>
        public Dictionary <SLCellPoint, SLRstType> GetCommentText()
        {
            var result = new Dictionary <SLCellPoint, SLRstType>();

            // we don't add to existing comments, so it's either get existing comments
            // or use the newly inserted comments.
            if (!string.IsNullOrEmpty(gsSelectedWorksheetRelationshipID))
            {
                var wsp = (WorksheetPart)wbp.GetPartById(gsSelectedWorksheetRelationshipID);
                if (wsp.WorksheetCommentsPart != null)
                {
                    Comment comm;
                    int     iRowIndex, iColumnIndex;
                    var     rst = new SLRstType();
                    using (var oxr = OpenXmlReader.Create(wsp.WorksheetCommentsPart.Comments.CommentList))
                    {
                        while (oxr.Read())
                        {
                            if (oxr.ElementType == typeof(Comment))
                            {
                                comm = (Comment)oxr.LoadCurrentElement();
                                SLTool.FormatCellReferenceToRowColumnIndex(comm.Reference.Value, out iRowIndex,
                                                                           out iColumnIndex);
                                rst.FromCommentText(comm.CommentText);
                                result[new SLCellPoint(iRowIndex, iColumnIndex)] = rst.Clone();
                            }
                        }
                    }
                }
                else
                {
                    var pts = slws.Comments.Keys.ToList();
                    foreach (var pt in pts)
                    {
                        result[pt] = slws.Comments[pt].rst.Clone();
                    }
                }
            }

            return(result);
        }
Esempio n. 7
0
        /// <summary> создаение списка критериев </summary>
        protected void CreateCriteriaList(Dictionary <string, string> criteria, int width)
        {
            foreach (var key in criteria.Keys)
            {
                SLFont captionFont = Document.CreateFont();
                captionFont.FontName = FontName;
                captionFont.FontSize = FontSize;
                captionFont.Bold     = true;

                SLFont valueFont = Document.CreateFont();
                valueFont.FontName = FontName;
                valueFont.FontSize = FontSize;

                SLRstType rstType = Document.CreateRstType();

                rstType.AppendText(key + ": ", captionFont);
                rstType.AppendText(criteria[key], valueFont);

                Document.SetCellValue(LineNum, 1, rstType.ToInlineString());

                Document.MergeWorksheetCells(LineNum, 1, LineNum, width);
                LineNum++;
            }
        }
Esempio n. 8
0
 /// <summary>
 /// Set the title with a rich text string.
 /// </summary>
 /// <param name="RichText">The rich text.</param>
 public void SetTitle(SLRstType RichText)
 {
     this.rst = RichText.Clone();
 }
 /// <summary>
 /// Reset the label text. This removes any custom label text.
 /// </summary>
 public void ResetLabelText()
 {
     this.RichText = null;
 }
Esempio n. 10
0
 /// <summary>
 ///     Set the comment text given rich text content.
 /// </summary>
 /// <param name="RichText">The rich text content</param>
 public void SetText(SLRstType RichText)
 {
     rst = new SLRstType();
     rst = RichText.Clone();
 }
Esempio n. 11
0
        /// <summary>
        /// Set a stock chart using one of the built-in stock chart types.
        /// </summary>
        /// <param name="ChartType">A built-in stock chart type.</param>
        /// <param name="Options">Chart customization options.</param>
        public void SetChartType(SLStockChartType ChartType, SLStockChartOptions Options)
        {
            this.Is3D = SLChartTool.Is3DChart(ChartType);

            int i;
            int iBarChartType;

            SLDataSeriesChartType vType;
            int iChartType;
            switch (ChartType)
            {
                case SLStockChartType.HighLowClose:
                    vType = SLDataSeriesChartType.StockChart;
                    this.IsCombinable = SLChartTool.IsCombinationChartFriendly(vType);
                    iChartType = (int)vType;
                    this.PlotArea.UsedChartTypes[iChartType] = true;
                    if (Options != null) this.PlotArea.UsedChartOptions[iChartType].MergeOptions(Options);

                    for (i = 0; i < this.PlotArea.DataSeries.Count; ++i)
                    {
                        this.PlotArea.DataSeries[i].ChartType = vType;
                        if (this.IsStylish)
                        {
                            this.PlotArea.DataSeries[i].Options.Line.Width = 2.25m;
                            this.PlotArea.DataSeries[i].Options.Line.CapType = DocumentFormat.OpenXml.Drawing.LineCapValues.Round;
                            this.PlotArea.DataSeries[i].Options.Line.SetNoLine();
                            this.PlotArea.DataSeries[i].Options.Line.JoinType = SLA.SLLineJoinValues.Round;
                            this.PlotArea.DataSeries[i].Options.Marker.Symbol = C.MarkerStyleValues.None;
                        }
                    }

                    // this is for Close
                    if (this.PlotArea.DataSeries.Count > 2)
                    {
                        this.PlotArea.DataSeries[2].Options.Marker.Symbol = C.MarkerStyleValues.Dot;
                        this.PlotArea.DataSeries[2].Options.Marker.Size = 3;
                        if (IsStylish)
                        {
                            this.PlotArea.DataSeries[2].Options.Marker.Fill.SetSolidFill(A.SchemeColorValues.Accent3, 0, 0);
                            this.PlotArea.DataSeries[2].Options.Marker.Line.Width = 0.75m;
                            this.PlotArea.DataSeries[2].Options.Marker.Line.SetSolidLine(A.SchemeColorValues.Accent3, 0, 0);
                        }
                    }

                    this.PlotArea.UsedChartOptions[iChartType].HasHighLowLines = true;
                    if (this.IsStylish)
                    {
                        this.PlotArea.UsedChartOptions[iChartType].HighLowLines.Line.Width = 0.75m;
                        this.PlotArea.UsedChartOptions[iChartType].HighLowLines.Line.CapType = A.LineCapValues.Flat;
                        this.PlotArea.UsedChartOptions[iChartType].HighLowLines.Line.CompoundLineType = A.CompoundLineValues.Single;
                        this.PlotArea.UsedChartOptions[iChartType].HighLowLines.Line.Alignment = A.PenAlignmentValues.Center;
                        this.PlotArea.UsedChartOptions[iChartType].HighLowLines.Line.SetSolidLine(A.SchemeColorValues.Text1, 0.25m, 0);
                        this.PlotArea.UsedChartOptions[iChartType].HighLowLines.Line.JoinType = SLA.SLLineJoinValues.Round;
                    }

                    this.PlotArea.HasPrimaryAxes = true;
                    this.PlotArea.PrimaryTextAxis.AxisPosition = C.AxisPositionValues.Bottom;
                    this.PlotArea.PrimaryValueAxis.AxisPosition = C.AxisPositionValues.Left;
                    this.PlotArea.PrimaryValueAxis.CrossBetween = C.CrossBetweenValues.Between;

                    if (this.IsStylish)
                    {
                        this.PlotArea.PrimaryTextAxis.ShowMajorGridlines = false;
                        this.PlotArea.PrimaryTextAxis.Fill.SetNoFill();
                        // 2.25 pt width
                        this.PlotArea.PrimaryTextAxis.Line.Width = 0.75m;
                        this.PlotArea.PrimaryTextAxis.Line.CapType = A.LineCapValues.Flat;
                        this.PlotArea.PrimaryTextAxis.Line.CompoundLineType = A.CompoundLineValues.Single;
                        this.PlotArea.PrimaryTextAxis.Line.Alignment = A.PenAlignmentValues.Center;
                        this.PlotArea.PrimaryTextAxis.Line.SetSolidLine(A.SchemeColorValues.Text1, 0.85m, 0);
                        this.PlotArea.PrimaryTextAxis.Line.JoinType = SLA.SLLineJoinValues.Round;
                        SLRstType rst = new SLRstType();
                        rst.AppendText(" ", new SLFont()
                        {
                            FontScheme = DocumentFormat.OpenXml.Spreadsheet.FontSchemeValues.Minor,
                            FontSize = 9,
                            Bold = false,
                            Italic = false,
                            Underline = DocumentFormat.OpenXml.Spreadsheet.UnderlineValues.None,
                            Strike = false
                        });
                        this.PlotArea.PrimaryTextAxis.Title.SetTitle(rst);
                        this.PlotArea.PrimaryTextAxis.Title.Fill.SetSolidFill(A.SchemeColorValues.Text1, 0.35m, 0);

                        this.PlotArea.PrimaryValueAxis.MinorTickMark = C.TickMarkValues.None;
                    }

                    if (this.IsStylish) this.Legend.LegendPosition = C.LegendPositionValues.Bottom;
                    this.PlotArea.SetDataSeriesAutoAxisType();
                    this.ShowEmptyCellsAs = C.DisplayBlanksAsValues.Gap;
                    break;
                case SLStockChartType.OpenHighLowClose:
                    vType = SLDataSeriesChartType.StockChart;
                    this.IsCombinable = SLChartTool.IsCombinationChartFriendly(vType);
                    iChartType = (int)vType;
                    this.PlotArea.UsedChartTypes[iChartType] = true;
                    if (Options != null) this.PlotArea.UsedChartOptions[iChartType].MergeOptions(Options);

                    for (i = 0; i < this.PlotArea.DataSeries.Count; ++i)
                    {
                        this.PlotArea.DataSeries[i].ChartType = vType;
                        if (this.IsStylish)
                        {
                            // 2.25 pt width
                            this.PlotArea.DataSeries[i].Options.Line.Width = 2.25m;
                            this.PlotArea.DataSeries[i].Options.Line.CapType = DocumentFormat.OpenXml.Drawing.LineCapValues.Round;
                            this.PlotArea.DataSeries[i].Options.Line.SetNoLine();
                            this.PlotArea.DataSeries[i].Options.Line.JoinType = SLA.SLLineJoinValues.Round;
                            this.PlotArea.DataSeries[i].Options.Marker.Symbol = C.MarkerStyleValues.None;
                        }
                    }

                    this.PlotArea.UsedChartOptions[iChartType].HasHighLowLines = true;
                    this.PlotArea.UsedChartOptions[iChartType].HasUpDownBars = true;
                    if (this.IsStylish)
                    {
                        this.PlotArea.UsedChartOptions[iChartType].HighLowLines.Line.Width = 0.75m;
                        this.PlotArea.UsedChartOptions[iChartType].HighLowLines.Line.CapType = A.LineCapValues.Flat;
                        this.PlotArea.UsedChartOptions[iChartType].HighLowLines.Line.CompoundLineType = A.CompoundLineValues.Single;
                        this.PlotArea.UsedChartOptions[iChartType].HighLowLines.Line.Alignment = A.PenAlignmentValues.Center;
                        this.PlotArea.UsedChartOptions[iChartType].HighLowLines.Line.SetSolidLine(A.SchemeColorValues.Text1, 0.25m, 0);
                        this.PlotArea.UsedChartOptions[iChartType].HighLowLines.Line.JoinType = SLA.SLLineJoinValues.Round;

                        this.PlotArea.UsedChartOptions[iChartType].UpDownBars.GapWidth = 150;
                        this.PlotArea.UsedChartOptions[iChartType].UpDownBars.UpBars.Fill.SetSolidFill(A.SchemeColorValues.Light1, 0, 0);
                        this.PlotArea.UsedChartOptions[iChartType].UpDownBars.UpBars.Border.Width = 0.75m;
                        this.PlotArea.UsedChartOptions[iChartType].UpDownBars.UpBars.Border.CapType = A.LineCapValues.Flat;
                        this.PlotArea.UsedChartOptions[iChartType].UpDownBars.UpBars.Border.CompoundLineType = A.CompoundLineValues.Single;
                        this.PlotArea.UsedChartOptions[iChartType].UpDownBars.UpBars.Border.Alignment = A.PenAlignmentValues.Center;
                        this.PlotArea.UsedChartOptions[iChartType].UpDownBars.UpBars.Border.SetSolidLine(A.SchemeColorValues.Text1, 0.35m, 0);
                        this.PlotArea.UsedChartOptions[iChartType].UpDownBars.UpBars.Border.JoinType = SLA.SLLineJoinValues.Round;
                        this.PlotArea.UsedChartOptions[iChartType].UpDownBars.DownBars.Fill.SetSolidFill(A.SchemeColorValues.Dark1, 0.25m, 0);
                        this.PlotArea.UsedChartOptions[iChartType].UpDownBars.DownBars.Border.Width = 0.75m;
                        this.PlotArea.UsedChartOptions[iChartType].UpDownBars.DownBars.Border.CapType = A.LineCapValues.Flat;
                        this.PlotArea.UsedChartOptions[iChartType].UpDownBars.DownBars.Border.CompoundLineType = A.CompoundLineValues.Single;
                        this.PlotArea.UsedChartOptions[iChartType].UpDownBars.DownBars.Border.Alignment = A.PenAlignmentValues.Center;
                        this.PlotArea.UsedChartOptions[iChartType].UpDownBars.DownBars.Border.SetSolidLine(A.SchemeColorValues.Text1, 0.35m, 0);
                        this.PlotArea.UsedChartOptions[iChartType].UpDownBars.DownBars.Border.JoinType = SLA.SLLineJoinValues.Round;
                    }

                    this.PlotArea.HasPrimaryAxes = true;
                    this.PlotArea.PrimaryTextAxis.AxisPosition = C.AxisPositionValues.Bottom;
                    this.PlotArea.PrimaryValueAxis.AxisPosition = C.AxisPositionValues.Left;
                    this.PlotArea.PrimaryValueAxis.CrossBetween = C.CrossBetweenValues.Between;

                    if (this.IsStylish) this.Legend.LegendPosition = C.LegendPositionValues.Bottom;
                    this.PlotArea.SetDataSeriesAutoAxisType();
                    this.ShowEmptyCellsAs = C.DisplayBlanksAsValues.Gap;
                    break;
                case SLStockChartType.VolumeHighLowClose:
                    vType = SLDataSeriesChartType.StockChart;
                    this.IsCombinable = SLChartTool.IsCombinationChartFriendly(vType);
                    iChartType = (int)vType;
                    this.PlotArea.UsedChartTypes[iChartType] = true;
                    if (Options != null) this.PlotArea.UsedChartOptions[iChartType].MergeOptions(Options);

                    iBarChartType = (int)SLDataSeriesChartType.BarChartColumnPrimary;
                    for (i = 0; i < this.PlotArea.DataSeries.Count; ++i)
                    {
                        if (i == 0)
                        {
                            this.PlotArea.DataSeries[i].ChartType = SLDataSeriesChartType.BarChartColumnPrimary;
                            if (this.IsStylish)
                            {
                                this.PlotArea.DataSeries[i].Options.Fill.SetSolidFill(A.SchemeColorValues.Accent1, 0, 0);
                                // 2.25 pt width
                                this.PlotArea.DataSeries[i].Options.Line.Width = 2.25m;
                                this.PlotArea.DataSeries[i].Options.Line.SetNoLine();
                            }

                            this.PlotArea.UsedChartTypes[iBarChartType] = true;
                            this.PlotArea.UsedChartOptions[iBarChartType].BarDirection = C.BarDirectionValues.Column;
                            this.PlotArea.UsedChartOptions[iBarChartType].BarGrouping = C.BarGroupingValues.Clustered;
                            if (Options != null)
                            {
                                this.PlotArea.UsedChartOptions[iBarChartType].GapWidth = Options.GapWidth;
                                this.PlotArea.UsedChartOptions[iBarChartType].Overlap = Options.Overlap;
                                this.PlotArea.DataSeries[i].Options.ShapeProperties.Fill = Options.Fill.Clone();
                                this.PlotArea.DataSeries[i].Options.ShapeProperties.Outline = Options.Border.Clone();
                                this.PlotArea.DataSeries[i].Options.ShapeProperties.EffectList.Shadow = Options.Shadow.Clone();
                                this.PlotArea.DataSeries[i].Options.ShapeProperties.EffectList.Glow = Options.Glow.Clone();
                                this.PlotArea.DataSeries[i].Options.ShapeProperties.EffectList.SoftEdge = Options.SoftEdge.Clone();
                                this.PlotArea.DataSeries[i].Options.ShapeProperties.Format3D = Options.Format3D.Clone();
                            }
                        }
                        else
                        {
                            this.PlotArea.DataSeries[i].ChartType = vType;
                            if (this.IsStylish)
                            {
                                // 2.25 pt width
                                this.PlotArea.DataSeries[i].Options.Line.Width = 2.25m;
                                this.PlotArea.DataSeries[i].Options.Line.CapType = DocumentFormat.OpenXml.Drawing.LineCapValues.Round;
                                this.PlotArea.DataSeries[i].Options.Line.SetNoLine();
                                this.PlotArea.DataSeries[i].Options.Line.JoinType = SLA.SLLineJoinValues.Round;
                                this.PlotArea.DataSeries[i].Options.Marker.Symbol = C.MarkerStyleValues.None;
                            }
                        }
                    }

                    // this is for Close
                    if (this.PlotArea.DataSeries.Count > 3)
                    {
                        this.PlotArea.DataSeries[3].Options.Marker.Symbol = C.MarkerStyleValues.Dot;
                        this.PlotArea.DataSeries[3].Options.Marker.Size = 5;
                        if (IsStylish)
                        {
                            this.PlotArea.DataSeries[3].Options.Marker.Fill.SetSolidFill(A.SchemeColorValues.Accent4, 0, 0);
                            this.PlotArea.DataSeries[3].Options.Marker.Line.Width = 0.75m;
                            this.PlotArea.DataSeries[3].Options.Marker.Line.SetSolidLine(A.SchemeColorValues.Accent4, 0, 0);
                        }
                    }

                    this.PlotArea.UsedChartOptions[iChartType].HasHighLowLines = true;
                    if (this.IsStylish)
                    {
                        this.PlotArea.UsedChartOptions[iChartType].HighLowLines.Line.Width = 0.75m;
                        this.PlotArea.UsedChartOptions[iChartType].HighLowLines.Line.CapType = A.LineCapValues.Flat;
                        this.PlotArea.UsedChartOptions[iChartType].HighLowLines.Line.CompoundLineType = A.CompoundLineValues.Single;
                        this.PlotArea.UsedChartOptions[iChartType].HighLowLines.Line.Alignment = A.PenAlignmentValues.Center;
                        this.PlotArea.UsedChartOptions[iChartType].HighLowLines.Line.SetSolidLine(A.SchemeColorValues.Text1, 0.25m, 0);
                        this.PlotArea.UsedChartOptions[iChartType].HighLowLines.Line.JoinType = SLA.SLLineJoinValues.Round;
                    }

                    this.PlotArea.HasPrimaryAxes = true;
                    this.PlotArea.PrimaryTextAxis.AxisPosition = C.AxisPositionValues.Bottom;
                    this.PlotArea.PrimaryValueAxis.AxisPosition = C.AxisPositionValues.Left;
                    this.PlotArea.PrimaryValueAxis.CrossBetween = C.CrossBetweenValues.Between;
                    this.PlotArea.HasSecondaryAxes = true;
                    this.PlotArea.SecondaryValueAxis.AxisPosition = C.AxisPositionValues.Right;
                    this.PlotArea.SecondaryValueAxis.ForceAxisPosition = true;
                    this.PlotArea.SecondaryValueAxis.IsCrosses = true;
                    this.PlotArea.SecondaryValueAxis.Crosses = C.CrossesValues.Maximum;
                    this.PlotArea.SecondaryValueAxis.CrossBetween = C.CrossBetweenValues.Between;
                    //this.PlotArea.SecondaryValueAxis.OtherAxisIsCrosses = true;
                    //this.PlotArea.SecondaryValueAxis.OtherAxisCrosses = C.CrossesValues.AutoZero;
                    this.PlotArea.SecondaryTextAxis.AxisPosition = C.AxisPositionValues.Bottom;
                    this.PlotArea.SecondaryTextAxis.TickLabelPosition = C.TickLabelPositionValues.NextTo;
                    //this.PlotArea.SecondaryTextAxis.IsCrosses = true;
                    //this.PlotArea.SecondaryTextAxis.Crosses = C.CrossesValues.AutoZero;
                    this.PlotArea.SecondaryTextAxis.OtherAxisIsCrosses = true;
                    this.PlotArea.SecondaryTextAxis.OtherAxisCrosses = C.CrossesValues.Maximum;

                    if (this.IsStylish)
                    {
                        this.PlotArea.SecondaryValueAxis.ShowMajorGridlines = true;
                        this.PlotArea.SecondaryValueAxis.MajorGridlines.Line.Width = 0.75m;
                        this.PlotArea.SecondaryValueAxis.MajorGridlines.Line.CapType = A.LineCapValues.Flat;
                        this.PlotArea.SecondaryValueAxis.MajorGridlines.Line.CompoundLineType = A.CompoundLineValues.Single;
                        this.PlotArea.SecondaryValueAxis.MajorGridlines.Line.Alignment = A.PenAlignmentValues.Center;
                        this.PlotArea.SecondaryValueAxis.MajorGridlines.Line.SetSolidLine(A.SchemeColorValues.Text1, 0.85m, 0);
                        this.PlotArea.SecondaryValueAxis.MajorGridlines.Line.JoinType = SLA.SLLineJoinValues.Round;

                        this.PlotArea.SecondaryTextAxis.ClearShapeProperties();
                    }

                    if (this.IsStylish) this.Legend.LegendPosition = C.LegendPositionValues.Bottom;
                    this.PlotArea.SetDataSeriesAutoAxisType();
                    this.ShowEmptyCellsAs = C.DisplayBlanksAsValues.Gap;
                    break;
                case SLStockChartType.VolumeOpenHighLowClose:
                    vType = SLDataSeriesChartType.StockChart;
                    this.IsCombinable = SLChartTool.IsCombinationChartFriendly(vType);
                    iChartType = (int)vType;
                    this.PlotArea.UsedChartTypes[iChartType] = true;
                    if (Options != null) this.PlotArea.UsedChartOptions[iChartType].MergeOptions(Options);

                    iBarChartType = (int)SLDataSeriesChartType.BarChartColumnPrimary;
                    for (i = 0; i < this.PlotArea.DataSeries.Count; ++i)
                    {
                        if (i == 0)
                        {
                            this.PlotArea.DataSeries[i].ChartType = SLDataSeriesChartType.BarChartColumnPrimary;
                            if (this.IsStylish)
                            {
                                this.PlotArea.DataSeries[i].Options.Fill.SetSolidFill(A.SchemeColorValues.Accent1, 0, 0);
                                // 2.25 pt width
                                this.PlotArea.DataSeries[i].Options.Line.Width = 2.25m;
                                this.PlotArea.DataSeries[i].Options.Line.SetNoLine();
                            }

                            iBarChartType = (int)SLDataSeriesChartType.BarChartColumnPrimary;
                            this.PlotArea.UsedChartTypes[iBarChartType] = true;
                            this.PlotArea.UsedChartOptions[iBarChartType].BarDirection = C.BarDirectionValues.Column;
                            this.PlotArea.UsedChartOptions[iBarChartType].BarGrouping = C.BarGroupingValues.Clustered;
                            if (Options != null)
                            {
                                this.PlotArea.UsedChartOptions[iBarChartType].GapWidth = Options.GapWidth;
                                this.PlotArea.UsedChartOptions[iBarChartType].Overlap = Options.Overlap;
                                this.PlotArea.DataSeries[i].Options.ShapeProperties.Fill = Options.Fill.Clone();
                                this.PlotArea.DataSeries[i].Options.ShapeProperties.Outline = Options.Border.Clone();
                                this.PlotArea.DataSeries[i].Options.ShapeProperties.EffectList.Shadow = Options.Shadow.Clone();
                                this.PlotArea.DataSeries[i].Options.ShapeProperties.EffectList.Glow = Options.Glow.Clone();
                                this.PlotArea.DataSeries[i].Options.ShapeProperties.EffectList.SoftEdge = Options.SoftEdge.Clone();
                                this.PlotArea.DataSeries[i].Options.ShapeProperties.Format3D = Options.Format3D.Clone();
                            }
                        }
                        else
                        {
                            this.PlotArea.DataSeries[i].ChartType = vType;
                            if (this.IsStylish)
                            {
                                // 2.25 pt width
                                this.PlotArea.DataSeries[i].Options.Line.Width = 2.25m;
                                this.PlotArea.DataSeries[i].Options.Line.CapType = DocumentFormat.OpenXml.Drawing.LineCapValues.Round;
                                this.PlotArea.DataSeries[i].Options.Line.SetNoLine();
                                this.PlotArea.DataSeries[i].Options.Line.JoinType = SLA.SLLineJoinValues.Round;
                                this.PlotArea.DataSeries[i].Options.Marker.Symbol = C.MarkerStyleValues.None;
                            }
                        }
                    }

                    this.PlotArea.UsedChartOptions[iChartType].HasHighLowLines = true;
                    this.PlotArea.UsedChartOptions[iChartType].HasUpDownBars = true;
                    if (this.IsStylish)
                    {
                        this.PlotArea.UsedChartOptions[iChartType].HighLowLines.Line.Width = 0.75m;
                        this.PlotArea.UsedChartOptions[iChartType].HighLowLines.Line.CapType = A.LineCapValues.Flat;
                        this.PlotArea.UsedChartOptions[iChartType].HighLowLines.Line.CompoundLineType = A.CompoundLineValues.Single;
                        this.PlotArea.UsedChartOptions[iChartType].HighLowLines.Line.Alignment = A.PenAlignmentValues.Center;
                        this.PlotArea.UsedChartOptions[iChartType].HighLowLines.Line.SetSolidLine(A.SchemeColorValues.Text1, 0.25m, 0);
                        this.PlotArea.UsedChartOptions[iChartType].HighLowLines.Line.JoinType = SLA.SLLineJoinValues.Round;

                        this.PlotArea.UsedChartOptions[iChartType].UpDownBars.GapWidth = 150;
                        this.PlotArea.UsedChartOptions[iChartType].UpDownBars.UpBars.Fill.SetSolidFill(A.SchemeColorValues.Light1, 0, 0);
                        this.PlotArea.UsedChartOptions[iChartType].UpDownBars.UpBars.Border.Width = 0.75m;
                        this.PlotArea.UsedChartOptions[iChartType].UpDownBars.UpBars.Border.CapType = A.LineCapValues.Flat;
                        this.PlotArea.UsedChartOptions[iChartType].UpDownBars.UpBars.Border.CompoundLineType = A.CompoundLineValues.Single;
                        this.PlotArea.UsedChartOptions[iChartType].UpDownBars.UpBars.Border.Alignment = A.PenAlignmentValues.Center;
                        this.PlotArea.UsedChartOptions[iChartType].UpDownBars.UpBars.Border.SetSolidLine(A.SchemeColorValues.Text1, 0.35m, 0);
                        this.PlotArea.UsedChartOptions[iChartType].UpDownBars.UpBars.Border.JoinType = SLA.SLLineJoinValues.Round;
                        this.PlotArea.UsedChartOptions[iChartType].UpDownBars.DownBars.Fill.SetSolidFill(A.SchemeColorValues.Dark1, 0.25m, 0);
                        this.PlotArea.UsedChartOptions[iChartType].UpDownBars.DownBars.Border.Width = 0.75m;
                        this.PlotArea.UsedChartOptions[iChartType].UpDownBars.DownBars.Border.CapType = A.LineCapValues.Flat;
                        this.PlotArea.UsedChartOptions[iChartType].UpDownBars.DownBars.Border.CompoundLineType = A.CompoundLineValues.Single;
                        this.PlotArea.UsedChartOptions[iChartType].UpDownBars.DownBars.Border.Alignment = A.PenAlignmentValues.Center;
                        this.PlotArea.UsedChartOptions[iChartType].UpDownBars.DownBars.Border.SetSolidLine(A.SchemeColorValues.Text1, 0.35m, 0);
                        this.PlotArea.UsedChartOptions[iChartType].UpDownBars.DownBars.Border.JoinType = SLA.SLLineJoinValues.Round;
                    }

                    this.PlotArea.HasPrimaryAxes = true;
                    this.PlotArea.PrimaryTextAxis.AxisPosition = C.AxisPositionValues.Bottom;
                    this.PlotArea.PrimaryValueAxis.AxisPosition = C.AxisPositionValues.Left;
                    this.PlotArea.PrimaryValueAxis.CrossBetween = C.CrossBetweenValues.Between;
                    this.PlotArea.HasSecondaryAxes = true;
                    this.PlotArea.SecondaryValueAxis.AxisPosition = C.AxisPositionValues.Right;
                    this.PlotArea.SecondaryValueAxis.ForceAxisPosition = true;
                    this.PlotArea.SecondaryValueAxis.IsCrosses = true;
                    this.PlotArea.SecondaryValueAxis.Crosses = C.CrossesValues.Maximum;
                    this.PlotArea.SecondaryValueAxis.CrossBetween = C.CrossBetweenValues.Between;
                    //this.PlotArea.SecondaryValueAxis.OtherAxisIsCrosses = true;
                    //this.PlotArea.SecondaryValueAxis.OtherAxisCrosses = C.CrossesValues.AutoZero;
                    this.PlotArea.SecondaryTextAxis.AxisPosition = C.AxisPositionValues.Bottom;
                    this.PlotArea.SecondaryTextAxis.TickLabelPosition = C.TickLabelPositionValues.NextTo;
                    //this.PlotArea.SecondaryTextAxis.IsCrosses = true;
                    //this.PlotArea.SecondaryTextAxis.Crosses = C.CrossesValues.AutoZero;
                    this.PlotArea.SecondaryTextAxis.OtherAxisIsCrosses = true;
                    this.PlotArea.SecondaryTextAxis.OtherAxisCrosses = C.CrossesValues.Maximum;

                    if (this.IsStylish)
                    {
                        this.PlotArea.SecondaryValueAxis.ShowMajorGridlines = true;
                        this.PlotArea.SecondaryValueAxis.MajorGridlines.Line.Width = 0.75m;
                        this.PlotArea.SecondaryValueAxis.MajorGridlines.Line.CapType = A.LineCapValues.Flat;
                        this.PlotArea.SecondaryValueAxis.MajorGridlines.Line.CompoundLineType = A.CompoundLineValues.Single;
                        this.PlotArea.SecondaryValueAxis.MajorGridlines.Line.Alignment = A.PenAlignmentValues.Center;
                        this.PlotArea.SecondaryValueAxis.MajorGridlines.Line.SetSolidLine(A.SchemeColorValues.Text1, 0.85m, 0);
                        this.PlotArea.SecondaryValueAxis.MajorGridlines.Line.JoinType = SLA.SLLineJoinValues.Round;

                        this.PlotArea.SecondaryTextAxis.ClearShapeProperties();
                    }

                    if (this.IsStylish) this.Legend.LegendPosition = C.LegendPositionValues.Bottom;
                    this.PlotArea.SetDataSeriesAutoAxisType();
                    this.ShowEmptyCellsAs = C.DisplayBlanksAsValues.Gap;
                    break;
            }
        }
 /// <summary>
 /// Set custom label text.
 /// </summary>
 /// <param name="RichText">The custom text in rich text format.</param>
 public void SetLabelText(SLRstType RichText)
 {
     this.RichText = RichText.Clone();
 }
Esempio n. 13
0
 /// <summary>
 /// Reset the label text. This removes any custom label text.
 /// </summary>
 public void ResetLabelText()
 {
     this.RichText = null;
 }
 internal SLDataLabelOptions(List <System.Drawing.Color> ThemeColors, bool ThrowExceptionsIfAny)
     : base(ThemeColors, ThrowExceptionsIfAny)
 {
     this.RichText = null;
 }
Esempio n. 15
0
 /// <summary>
 /// Set custom label text.
 /// </summary>
 /// <param name="Text">The custom text.</param>
 public void SetLabelText(string Text)
 {
     SLRstType rst = new SLRstType();
     rst.AppendText(Text);
     this.RichText = rst.Clone();
 }
Esempio n. 16
0
 /// <summary>
 /// Set custom label text.
 /// </summary>
 /// <param name="RichText">The custom text in rich text format.</param>
 public void SetLabelText(SLRstType RichText)
 {
     this.RichText = RichText.Clone();
 }
Esempio n. 17
0
 internal SLDataLabelOptions(List<System.Drawing.Color> ThemeColors) : base(ThemeColors)
 {
     this.RichText = null;
 }
Esempio n. 18
0
 /// <summary>
 ///     Set the comment text.
 /// </summary>
 /// <param name="Text">The comment text.</param>
 public void SetText(string Text)
 {
     rst = new SLRstType();
     rst.SetText(Text);
 }
 internal SLDataLabelOptions(List <System.Drawing.Color> ThemeColors) : base(ThemeColors)
 {
     this.RichText = null;
 }
 /// <summary>
 /// Set the title with a rich text string.
 /// </summary>
 /// <param name="RichText">The rich text.</param>
 public void SetTitle(SLRstType RichText)
 {
     this.rst = RichText.Clone();
 }
Esempio n. 21
0
        /// <summary>
        ///     Sort data either by column or row.
        /// </summary>
        /// <param name="StartRowIndex">The row index of the start row. This is typically the top row.</param>
        /// <param name="StartColumnIndex">The column index of the start column. This is typically the left-most column.</param>
        /// <param name="EndRowIndex">The row index of the end row. This is typically the bottom row.</param>
        /// <param name="EndColumnIndex">The column index of the end column. This is typically the right-most column.</param>
        /// <param name="SortByColumn">True to sort by column. False to sort by row.</param>
        /// <param name="SortByIndex">
        ///     The row or column index of the row or column to be sorted by, depending on
        ///     <paramref name="SortByColumn" />
        /// </param>
        /// <param name="SortAscending">True to sort in ascending order. False to sort in descending order.</param>
        public void Sort(int StartRowIndex, int StartColumnIndex, int EndRowIndex, int EndColumnIndex, bool SortByColumn,
                         int SortByIndex, bool SortAscending)
        {
            int iStartRowIndex = 1, iEndRowIndex = 1, iStartColumnIndex = 1, iEndColumnIndex = 1;

            if (StartRowIndex < EndRowIndex)
            {
                iStartRowIndex = StartRowIndex;
                iEndRowIndex   = EndRowIndex;
            }
            else
            {
                iStartRowIndex = EndRowIndex;
                iEndRowIndex   = StartRowIndex;
            }

            if (StartColumnIndex < EndColumnIndex)
            {
                iStartColumnIndex = StartColumnIndex;
                iEndColumnIndex   = EndColumnIndex;
            }
            else
            {
                iStartColumnIndex = EndColumnIndex;
                iEndColumnIndex   = StartColumnIndex;
            }

            if (iStartRowIndex < 1)
            {
                iStartRowIndex = 1;
            }
            if (iStartColumnIndex < 1)
            {
                iStartColumnIndex = 1;
            }
            if (iEndRowIndex > SLConstants.RowLimit)
            {
                iEndRowIndex = SLConstants.RowLimit;
            }
            if (iEndColumnIndex > SLConstants.ColumnLimit)
            {
                iEndColumnIndex = SLConstants.ColumnLimit;
            }

            // if the given index is out of the data range, then don't have to sort.
            if (SortByColumn)
            {
                if ((SortByIndex < iStartColumnIndex) || (SortByIndex > iEndColumnIndex))
                {
                    return;
                }
            }
            else
            {
                if ((SortByIndex < iStartRowIndex) || (SortByIndex > iEndRowIndex))
                {
                    return;
                }
            }

            var         datacells = new Dictionary <SLCellPoint, SLCell>();
            SLCellPoint pt;
            int         i, j;

            for (i = iStartRowIndex; i <= iEndRowIndex; ++i)
            {
                for (j = iStartColumnIndex; j <= iEndColumnIndex; ++j)
                {
                    pt = new SLCellPoint(i, j);
                    if (slws.Cells.ContainsKey(pt))
                    {
                        datacells[pt] = slws.Cells[pt].Clone();
                        slws.Cells.Remove(pt);
                    }
                }
            }

            var listNumbers = new List <SLSortItem>();
            var listText    = new List <SLSortItem>();
            var listBoolean = new List <SLSortItem>();
            var listEmpty   = new List <SLSortItem>();

            var       bValue = false;
            var       fValue = 0.0;
            var       sText  = string.Empty;
            SLRstType rst;
            var       index       = 0;
            var       iStartIndex = -1;
            var       iEndIndex   = -1;

            if (SortByColumn)
            {
                iStartIndex = iStartRowIndex;
                iEndIndex   = iEndRowIndex;
            }
            else
            {
                iStartIndex = iStartColumnIndex;
                iEndIndex   = iEndColumnIndex;
            }

            for (i = iStartIndex; i <= iEndIndex; ++i)
            {
                if (SortByColumn)
                {
                    pt = new SLCellPoint(i, SortByIndex);
                }
                else
                {
                    pt = new SLCellPoint(SortByIndex, i);
                }

                if (datacells.ContainsKey(pt))
                {
                    if (datacells[pt].DataType == CellValues.Number)
                    {
                        if (datacells[pt].CellText != null)
                        {
                            if (double.TryParse(datacells[pt].CellText, out fValue))
                            {
                                listNumbers.Add(new SLSortItem {
                                    Number = fValue, Index = i
                                });
                            }
                            else
                            {
                                listText.Add(new SLSortItem {
                                    Text = datacells[pt].CellText, Index = i
                                });
                            }
                        }
                        else
                        {
                            listNumbers.Add(new SLSortItem {
                                Number = datacells[pt].NumericValue, Index = i
                            });
                        }
                    }
                    else if (datacells[pt].DataType == CellValues.SharedString)
                    {
                        index = -1;

                        if (datacells[pt].CellText != null)
                        {
                            if (int.TryParse(datacells[pt].CellText, out index) &&
                                (index >= 0) && (index < listSharedString.Count))
                            {
                                rst = new SLRstType(SLConstants.OfficeThemeMajorLatinFont,
                                                    SLConstants.OfficeThemeMinorLatinFont, new List <Color>(), new List <Color>());
                                rst.FromSharedStringItem(new SharedStringItem {
                                    InnerXml = listSharedString[index]
                                });
                                listText.Add(new SLSortItem {
                                    Text = rst.ToPlainString(), Index = i
                                });
                            }
                            else
                            {
                                listText.Add(new SLSortItem {
                                    Text = datacells[pt].CellText, Index = i
                                });
                            }
                        }
                        else
                        {
                            index = Convert.ToInt32(datacells[pt].NumericValue);
                            if ((index >= 0) && (index < listSharedString.Count))
                            {
                                rst = new SLRstType(SLConstants.OfficeThemeMajorLatinFont,
                                                    SLConstants.OfficeThemeMinorLatinFont, new List <Color>(), new List <Color>());
                                rst.FromSharedStringItem(new SharedStringItem {
                                    InnerXml = listSharedString[index]
                                });
                                listText.Add(new SLSortItem {
                                    Text = rst.ToPlainString(), Index = i
                                });
                            }
                            else
                            {
                                listText.Add(new SLSortItem
                                {
                                    Text  = datacells[pt].NumericValue.ToString(CultureInfo.InvariantCulture),
                                    Index = i
                                });
                            }
                        }
                    }
                    else if (datacells[pt].DataType == CellValues.Boolean)
                    {
                        if (datacells[pt].CellText != null)
                        {
                            if (double.TryParse(datacells[pt].CellText, NumberStyles.Any, CultureInfo.InvariantCulture,
                                                out fValue))
                            {
                                listBoolean.Add(new SLSortItem {
                                    Number = fValue > 0.5 ? 1.0 : 0.0, Index = i
                                });
                            }
                            else if (bool.TryParse(datacells[pt].CellText, out bValue))
                            {
                                listBoolean.Add(new SLSortItem {
                                    Number = bValue ? 1.0 : 0.0, Index = i
                                });
                            }
                            else
                            {
                                listText.Add(new SLSortItem {
                                    Text = datacells[pt].CellText, Index = i
                                });
                            }
                        }
                        else
                        {
                            listBoolean.Add(new SLSortItem
                            {
                                Number = datacells[pt].NumericValue > 0.5 ? 1.0 : 0.0,
                                Index  = i
                            });
                        }
                    }
                    else
                    {
                        listText.Add(new SLSortItem {
                            Text = datacells[pt].CellText, Index = i
                        });
                    }
                }
                else
                {
                    listEmpty.Add(new SLSortItem {
                        Index = i
                    });
                }
            }

            listNumbers.Sort(new SLSortItemNumberComparer());
            if (!SortAscending)
            {
                listNumbers.Reverse();
            }

            listText.Sort(new SLSortItemTextComparer());
            if (!SortAscending)
            {
                listText.Reverse();
            }

            listBoolean.Sort(new SLSortItemNumberComparer());
            if (!SortAscending)
            {
                listBoolean.Reverse();
            }

            var ReverseIndex = new Dictionary <int, int>();

            if (SortAscending)
            {
                j = iStartIndex;
                for (i = 0; i < listNumbers.Count; ++i)
                {
                    ReverseIndex[listNumbers[i].Index] = j;
                    ++j;
                }

                for (i = 0; i < listText.Count; ++i)
                {
                    ReverseIndex[listText[i].Index] = j;
                    ++j;
                }

                for (i = 0; i < listBoolean.Count; ++i)
                {
                    ReverseIndex[listBoolean[i].Index] = j;
                    ++j;
                }

                for (i = 0; i < listEmpty.Count; ++i)
                {
                    ReverseIndex[listEmpty[i].Index] = j;
                    ++j;
                }
            }
            else
            {
                j = iStartIndex;
                for (i = 0; i < listBoolean.Count; ++i)
                {
                    ReverseIndex[listBoolean[i].Index] = j;
                    ++j;
                }

                for (i = 0; i < listText.Count; ++i)
                {
                    ReverseIndex[listText[i].Index] = j;
                    ++j;
                }

                for (i = 0; i < listNumbers.Count; ++i)
                {
                    ReverseIndex[listNumbers[i].Index] = j;
                    ++j;
                }

                for (i = 0; i < listEmpty.Count; ++i)
                {
                    ReverseIndex[listEmpty[i].Index] = j;
                    ++j;
                }
            }

            var         listCellKeys = datacells.Keys.ToList();
            SLCellPoint newpt;

            for (i = 0; i < listCellKeys.Count; ++i)
            {
                pt = listCellKeys[i];
                if (SortByColumn)
                {
                    if (ReverseIndex.ContainsKey(pt.RowIndex))
                    {
                        newpt = new SLCellPoint(ReverseIndex[pt.RowIndex], pt.ColumnIndex);
                    }
                    else
                    {
                        newpt = new SLCellPoint(pt.RowIndex, pt.ColumnIndex);
                    }
                }
                else
                {
                    if (ReverseIndex.ContainsKey(pt.ColumnIndex))
                    {
                        newpt = new SLCellPoint(pt.RowIndex, ReverseIndex[pt.ColumnIndex]);
                    }
                    else
                    {
                        newpt = new SLCellPoint(pt.RowIndex, pt.ColumnIndex);
                    }
                }

                slws.Cells[newpt] = datacells[pt];
            }
        }