Exemple #1
0
        /// <summary>
        /// Get valid length file name
        /// </summary>
        /// <param name="filepath"></param>
        /// <param name="filenameWithoutExtension"></param>
        /// <returns></returns>
        public static string GetValidLengthFileName(string filepath, string filenameWithoutExtension, Presentation.PresentationType presentationType)
        {
            string RetVal = string.Empty;
            try
            {
                if (filepath.Length + filenameWithoutExtension.Length > 205)
                {
                    string FileName = filenameWithoutExtension.Replace(presentationType.ToString(), "");

                    RetVal = FileName.Substring(0, 205 - (FileName.Length + presentationType.ToString().Length));

                    RetVal = RetVal + " - " + presentationType.ToString();
                }
                else
                {
                    RetVal = filenameWithoutExtension;
                }
            }
            catch (Exception)
            {
            }
            return RetVal;
        }
 /// <summary>
 /// Raise the event for change in preview limit properties.
 /// </summary>
 public void RaisePreviewChangedEvent(Presentation.PresentationType presentationType)
 {
     if (this.PreviewChangedEvent != null)
     {
         this.PreviewChangedEvent(presentationType);
     }
 }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="presentationType">Presentation type to be used</param>
        /// <param name="showExcel"></param>
        public StyleTemplate(Presentation.PresentationType presentationType, bool showExcel)
        {
            FontSetting TempFontSetting;
            switch (presentationType)
            {
                case Presentation.PresentationType.Table:
                    TempFontSetting = new FontSetting("Arial", FontStyle.Bold, 11, Color.Black, Color.White, StringAlignment.Near, false, false, FootNoteDisplayStyle.Separate);
                    this._TitleSetting = new StyleTemplateSetting(TempFontSetting, true, string.Empty, LineDrawStyle.Solid, 0, TextOrientation.Horizontal, 0, false, LegendPosition.Left, StringAlignment.Center, 0, string.Empty, false);

                    TempFontSetting = new FontSetting("Arial", FontStyle.Bold, 8, Color.Black, Color.White, StringAlignment.Near, false, false, FootNoteDisplayStyle.Separate);
                    this._SubTitleSetting = new StyleTemplateSetting(TempFontSetting, true, string.Empty, LineDrawStyle.Solid, 0, TextOrientation.Horizontal, 0, false, LegendPosition.Left, StringAlignment.Center, 0, string.Empty, false);

                    // -- Legend settings
                    TempFontSetting = new FontSetting("Arial", FontStyle.Regular, 8, Color.Black, Color.White, StringAlignment.Center, true, false, FootNoteDisplayStyle.Inline);
                    this._Legends = new StyleTemplateSetting(TempFontSetting, true, string.Empty, LineDrawStyle.Solid, 0, TextOrientation.Horizontal, 0, false, LegendPosition.Right, StringAlignment.Center, 0, string.Empty, false);

                    break;

                case Presentation.PresentationType.Graph:
                    if (showExcel)
                    {
                        //-- Title Font Settings
                        TempFontSetting = new FontSetting("Arial", FontStyle.Bold, 14, Color.Black, Color.White, StringAlignment.Center);
                        //-- Set chart title
                        this._TitleSetting = new StyleTemplateSetting(TempFontSetting, true, "#00000", LineDrawStyle.Solid, 0, TextOrientation.Horizontal, 0, false, LegendPosition.Top, StringAlignment.Center, 0, "#111111", false);

                        //-- sub Title Font Settings
                        TempFontSetting = new FontSetting("Arial", FontStyle.Regular, 10, Color.Black, Color.White, StringAlignment.Center);
                        this._SubTitleSetting = new StyleTemplateSetting(TempFontSetting, true, string.Empty, LineDrawStyle.Solid, 0, TextOrientation.Horizontal, 0, false, LegendPosition.Left, StringAlignment.Center, 0, string.Empty, false);

                        //-- Set chart legends
                        TempFontSetting = new FontSetting("Arial", FontStyle.Regular, 10, Color.Black, Color.White, StringAlignment.Center, true, false, FootNoteDisplayStyle.Inline);
                        this._Legends = new StyleTemplateSetting(TempFontSetting, true, Color.Black.Name, LineDrawStyle.Solid, 2, TextOrientation.Horizontal, 0, false, LegendPosition.Right, StringAlignment.Center, 60, "#E3E3E3", false);
                    }
                    else
                    {
                        //-- Set chart title
                        TempFontSetting = new FontSetting("Arial", FontStyle.Bold, 14, Color.Black, Color.White, StringAlignment.Center);
                        this._TitleSetting = new StyleTemplateSetting(TempFontSetting, true, "#000000", LineDrawStyle.Solid, 0, TextOrientation.Horizontal, 0, false, LegendPosition.Top, StringAlignment.Center, 0, "#111111", false);

                        TempFontSetting = new FontSetting("Arial", FontStyle.Regular, 8, Color.Black, Color.White, StringAlignment.Center);
                        this._SubTitleSetting = new StyleTemplateSetting(TempFontSetting, true, string.Empty, LineDrawStyle.Solid, 0, TextOrientation.Horizontal, 0, false, LegendPosition.Left, StringAlignment.Center, 0, string.Empty, false);

                        TempFontSetting = new FontSetting("Arial", FontStyle.Regular, 8, Color.Black, Color.White, StringAlignment.Center, true, false, FootNoteDisplayStyle.Inline);
                        this._Legends = new StyleTemplateSetting(TempFontSetting, true, Color.Black.Name, LineDrawStyle.Solid, 2, TextOrientation.Horizontal, 0, false, LegendPosition.Right, StringAlignment.Center, 60, "#E3E3E3", false);

                    }
                    break;

                case Presentation.PresentationType.Map:
                    TempFontSetting = new FontSetting("Arial", FontStyle.Bold, 14, Color.Black, Color.White, StringAlignment.Center, false, false, FootNoteDisplayStyle.Separate);
                    this._TitleSetting = new StyleTemplateSetting(TempFontSetting, true, string.Empty, LineDrawStyle.Solid, 0, TextOrientation.Horizontal, 0, false, LegendPosition.Left, StringAlignment.Center, 0, string.Empty, false);

                    TempFontSetting = new FontSetting("Arial", FontStyle.Regular, 12, Color.Black, Color.White, StringAlignment.Center, false, false, FootNoteDisplayStyle.Separate);
                    this._SubTitleSetting = new StyleTemplateSetting(TempFontSetting, true, string.Empty, LineDrawStyle.Solid, 0, TextOrientation.Horizontal, 0, false, LegendPosition.Left, StringAlignment.Center, 0, string.Empty, false);

                    TempFontSetting = new FontSetting("Arial", FontStyle.Regular, 8, Color.Black, Color.White, StringAlignment.Center, false, false, FootNoteDisplayStyle.Separate);
                    this._Legends = new StyleTemplateSetting(TempFontSetting, false, "#ffffff", LineDrawStyle.Solid, 0, TextOrientation.Horizontal, 0, false, LegendPosition.Right, StringAlignment.Center, 60, "#E3E3E3", false);
                    break;
                case Presentation.PresentationType.None:
                    break;
                default:
                    break;
            }

            // -- Column Settings
            TempFontSetting = new FontSetting("Arial", FontStyle.Bold, 8, ColorTranslator.FromHtml("#000000"),true, ColorTranslator.FromHtml("#D7D7D7"), StringAlignment.Center, true, false, FootNoteDisplayStyle.Inline, false, ColorTranslator.ToHtml(Color.White), ColorTranslator.ToHtml(Color.White), true, 22, false);
            this._ColumnSetting = new StyleTemplateSetting(TempFontSetting, true, string.Empty, LineDrawStyle.Solid, 0, TextOrientation.Horizontal, 0, false, LegendPosition.Left, StringAlignment.Center,0, string.Empty, false);

            // -- Row settings
            TempFontSetting = new FontSetting("Arial", FontStyle.Regular, 8, ColorTranslator.FromHtml("#000000"), true, ColorTranslator.FromHtml("#F5F5F5"), StringAlignment.Near, true, false, FootNoteDisplayStyle.Inline, false, ColorTranslator.ToHtml(Color.White), ColorTranslator.ToHtml(Color.White), true, 10, false);
            this._RowSetting = new StyleTemplateSetting(TempFontSetting, true, string.Empty, LineDrawStyle.Solid, 0, TextOrientation.Horizontal, 0, false, LegendPosition.Left, StringAlignment.Center, 0, string.Empty, false);

            // -- Content settings
            TempFontSetting = new FontSetting("Arial", FontStyle.Regular, 8, Color.Black, true, Color.White, StringAlignment.Far, true, false, FootNoteDisplayStyle.Inline, false, ColorTranslator.ToHtml(Color.White), ColorTranslator.ToHtml(Color.White), true, 10, false);
            this._ContentSetting = new StyleTemplateSetting(TempFontSetting, true, string.Empty, LineDrawStyle.Solid, 0, TextOrientation.Horizontal, 0, false, LegendPosition.Left, StringAlignment.Center, 0, string.Empty, false);

            // -- Sub aggregate settings
            TempFontSetting = new FontSetting("Arial", FontStyle.Bold, 8, ColorTranslator.FromHtml("#804040"), ColorTranslator.FromHtml("#BBDDFF"), StringAlignment.Center);
            this._SubAggregateSetting = new StyleTemplateSetting(TempFontSetting, true, string.Empty, LineDrawStyle.Solid, 0, TextOrientation.Horizontal, 0, false, LegendPosition.Left, StringAlignment.Center, 0, string.Empty, false);

            // -- Group Aggregate settings
            TempFontSetting = new FontSetting("Arial", FontStyle.Bold, 8, Color.White, ColorTranslator.FromHtml("#0000A0"), StringAlignment.Center);
            this._GroupAggregateSetting = new StyleTemplateSetting(TempFontSetting, true, string.Empty, LineDrawStyle.Solid, 0, TextOrientation.Horizontal, 0, false, LegendPosition.Left, StringAlignment.Center, 0, string.Empty, false);

            // -- Group Header settings
            TempFontSetting = new FontSetting("Arial", FontStyle.Bold, 9, ColorTranslator.FromHtml("#400000"), ColorTranslator.FromHtml("#FFFF80"), StringAlignment.Center);
            this._GroupHeaderSetting = new StyleTemplateSetting(TempFontSetting, true, string.Empty, LineDrawStyle.Solid, 0, TextOrientation.Horizontal, 0, false, LegendPosition.Left, StringAlignment.Center, 0, string.Empty, false);

            // -- Footnotes settings
            TempFontSetting = new FontSetting("Arial", FontStyle.Regular, 7, ColorTranslator.FromHtml("#8080FF"), Color.White, StringAlignment.Center, true, false, FootNoteDisplayStyle.Separate);
            this._Footnotes = new StyleTemplateSetting(TempFontSetting, true, string.Empty, LineDrawStyle.Solid, 0, TextOrientation.Horizontal, 0, false, LegendPosition.Left, StringAlignment.Center, 0, string.Empty, false);

            // -- Comments settings
            TempFontSetting = new FontSetting("Arial", FontStyle.Regular, 7, ColorTranslator.FromHtml("#408080"), Color.White, StringAlignment.Center, true, false, FootNoteDisplayStyle.Separate);
            this._Comments = new StyleTemplateSetting(TempFontSetting, true, string.Empty, LineDrawStyle.Solid, 0, TextOrientation.Horizontal, 0, false, LegendPosition.Left, StringAlignment.Center, 0, string.Empty, false);

            // -- Denominator settings
            TempFontSetting = new FontSetting("Arial", FontStyle.Regular, 8, Color.Black, Color.White, StringAlignment.Center, false, false, FootNoteDisplayStyle.Separate);
            this._Denominator = new StyleTemplateSetting(TempFontSetting,false, string.Empty, LineDrawStyle.Solid, 0, TextOrientation.Horizontal, 0, false, LegendPosition.Left, StringAlignment.Center, 0, string.Empty, false);

            // -- Disclaimer font settings
            TempFontSetting = new FontSetting("Microsoft Sans Serif", FontStyle.Regular, 8, Color.Black, Color.White, StringAlignment.Center, false, false, FootNoteDisplayStyle.Separate);
            //TempFontSetting = new FontSetting("Microsoft Sans Serif", FontStyle.Regular, 8, Color.Black, Color.White, StringAlignment.Center, "Note: The boundaries and the names shown and the designations used on these maps do not imply official endorsement or acceptance by the United Nations.", false, false, FootNoteDisplayStyle.Separate);
            this._DisclaimerFont = new StyleTemplateSetting(TempFontSetting, true, string.Empty, LineDrawStyle.Solid, 0, TextOrientation.Horizontal, 0, false, LegendPosition.Left, StringAlignment.Center, 0, string.Empty, false);

            // -- Legend title settings
            TempFontSetting = new FontSetting("Microsoft Sans Serif", FontStyle.Bold, 10, Color.Black, Color.Black, StringAlignment.Center, false, false, FootNoteDisplayStyle.Separate);
            this._LegendTitle = new StyleTemplateSetting(TempFontSetting, true, string.Empty, LineDrawStyle.Solid, 0, TextOrientation.Horizontal, 0, false, LegendPosition.Right, StringAlignment.Center, 0, string.Empty, false);

            // -- Legend body settings
            TempFontSetting = new FontSetting("Microsoft Sans Serif", FontStyle.Regular, 8, Color.Black, Color.Black, StringAlignment.Center, false, false, FootNoteDisplayStyle.Separate);
            this._LegendBody = new StyleTemplateSetting(TempFontSetting, true, string.Empty, LineDrawStyle.Solid, 0, TextOrientation.Horizontal, 0, false, LegendPosition.Right, StringAlignment.Center, 0, string.Empty, false);

            // -- Legend body settings
            TempFontSetting = new FontSetting("Microsoft Sans Serif", FontStyle.Regular, 8, Color.Black, Color.Black, StringAlignment.Center, false, false, FootNoteDisplayStyle.Separate);
            this._LegendBody = new StyleTemplateSetting(TempFontSetting, true, string.Empty, LineDrawStyle.Solid, 0, TextOrientation.Horizontal, 0, false, LegendPosition.Left, StringAlignment.Center, 0, string.Empty, false);

            // -- Theme Label settings
            TempFontSetting = new FontSetting("Arial", FontStyle.Regular, 8, Color.Black, Color.Black, StringAlignment.Center, false, false, FootNoteDisplayStyle.Separate);
            this._ThemeLabel = new StyleTemplateSetting(TempFontSetting, true, string.Empty, LineDrawStyle.Solid, 0, TextOrientation.Horizontal, 0, false, LegendPosition.Left, StringAlignment.Center, 0, string.Empty, false);

            // -- Label Font settings
            TempFontSetting = new FontSetting("Arial", FontStyle.Regular, 8, Color.Black, Color.Black, StringAlignment.Center, false, false, FootNoteDisplayStyle.Separate);
            this._LabelFontSetting = new StyleTemplateSetting(TempFontSetting, true, string.Empty, LineDrawStyle.Solid, 0, TextOrientation.Horizontal, 0, false, LegendPosition.Left, StringAlignment.Center, 0, string.Empty, false);

            //-- Set chart Plot area
            FontSetting PlotFont = new FontSetting("Arial", FontStyle.Regular, 5, Color.Black, true, Color.White, StringAlignment.Center, true, false, FootNoteDisplayStyle.Inline, false, ColorTranslator.ToHtml(Color.White), ColorTranslator.ToHtml(Color.White), false, 21, false, FontSetting.CellBorderStyle.Fill, ColorTranslator.ToHtml(Color.White), false, 0);
            this._PlotArea = new StyleTemplateSetting(PlotFont, true, ColorTranslator.ToHtml(Color.White), LineDrawStyle.Solid, 0, TextOrientation.Custom, 45, false, LegendPosition.Right, StringAlignment.Center, 60, "#E3E3E3", false);

            //-- Set chart area
            FontSetting ChartFont = new FontSetting("Arial", FontStyle.Regular, 5, Color.Black, true, Color.White, StringAlignment.Center, true, false, FootNoteDisplayStyle.Inline, false, ColorTranslator.ToHtml(Color.White), ColorTranslator.ToHtml(Color.White), false, 21, false, FontSetting.CellBorderStyle.Fill, ColorTranslator.ToHtml(Color.White), false, 0);
            this._ChartArea = new StyleTemplateSetting(ChartFont, false, "#ffffff", LineDrawStyle.Solid, 0, TextOrientation.Horizontal, 0, false, LegendPosition.Right, StringAlignment.Center, 60, "#E3E3E3", false);

            if (showExcel && presentationType == Presentation.PresentationType.Graph)
            {
                //-- Set chart border
                FontSetting TitleFont = new FontSetting("Arial", FontStyle.Regular, 10, Color.Black, Color.White, StringAlignment.Center);
                this._Border = new StyleTemplateSetting(TitleFont, false, "#000000", LineDrawStyle.Solid, 0, TextOrientation.Horizontal, 0, false, LegendPosition.Top, StringAlignment.Center, 0, "#111111", false);

                //-- Set chart grid
                TitleFont = new FontSetting("Arial", FontStyle.Regular, 10, Color.Black, Color.White, StringAlignment.Center);
                this._Grid = new StyleTemplateSetting(TitleFont, true, "#E9E9E9", LineDrawStyle.Solid, 1, TextOrientation.Horizontal, 0, false, LegendPosition.Top, StringAlignment.Center, 0, "#111111", false);

                //-- Set chart xaxis
                FontSetting AxisFont = new FontSetting("Arial", FontStyle.Regular, 8, Color.Black, Color.White, StringAlignment.Center);
                this._XAxis = new StyleTemplateSetting(AxisFont, true, "#000000", LineDrawStyle.Solid, 1, TextOrientation.Custom, 45, false, LegendPosition.Top, StringAlignment.Center, 10, "#111111", true);

                //-- Set chart y axis
                AxisFont = new FontSetting("Arial", FontStyle.Regular, 8, Color.Black, Color.White, StringAlignment.Center);
                this._YAxis = new StyleTemplateSetting(AxisFont, true, "#000000", LineDrawStyle.Solid, 1, TextOrientation.Horizontal, 90, false, LegendPosition.Top, StringAlignment.Center, 60, "#111111", true);

                //-- Set chart xaxis series label
                AxisFont = new FontSetting("Arial", FontStyle.Regular, 8, Color.Black, Color.White, StringAlignment.Center, false, false, FootNoteDisplayStyle.Inline);
                this._XAxisSeriesLabel = new StyleTemplateSetting(AxisFont, true, "#ffffff", LineDrawStyle.Solid, 0, TextOrientation.Custom, 45, false, LegendPosition.Right, StringAlignment.Center, 60, "#E3E3E3", false);

                //-- Set chart yaxis series label
                AxisFont = new FontSetting("Arial", FontStyle.Regular, 8, Color.Black, Color.White, StringAlignment.Center, false, false, FootNoteDisplayStyle.Inline);
                this._YAxisSeriesLabel = new StyleTemplateSetting(AxisFont, false, "#ffffff", LineDrawStyle.Solid, 0, TextOrientation.Custom, 45, false, LegendPosition.Right, StringAlignment.Center, 60, "#E3E3E3", false);
            }
            else
            {
                //-- Set chart border
                FontSetting TitleFont = new FontSetting("Arial", FontStyle.Regular, 8, Color.Black, Color.White, StringAlignment.Center);
                this._Border = new StyleTemplateSetting(TitleFont, false, "#000000", LineDrawStyle.Solid, 0, TextOrientation.Horizontal, 0, false, LegendPosition.Top, StringAlignment.Center, 0, "#111111", false);

                //-- Set chart grid
                TitleFont = new FontSetting("Arial", FontStyle.Regular, 8, Color.Black, Color.White, StringAlignment.Center);
                this._Grid = new StyleTemplateSetting(TitleFont, false, "#E9E9E9", LineDrawStyle.Solid, 1, TextOrientation.Horizontal, 0, false, LegendPosition.Top, StringAlignment.Center, 0, "#111111", false);

                //-- Set chart xaxis
                FontSetting AxisFont = new FontSetting("Arial", FontStyle.Regular, 8, Color.Black, Color.White, StringAlignment.Center);
                this._XAxis = new StyleTemplateSetting(AxisFont, true, "#000000", LineDrawStyle.Solid, 1, TextOrientation.Custom, 45, false, LegendPosition.Top, StringAlignment.Center, 10, "#111111", true);

                //-- Set chart y axis
                AxisFont = new FontSetting("Arial", FontStyle.Regular, 8, Color.Black, Color.White, StringAlignment.Center);
                this._YAxis = new StyleTemplateSetting(AxisFont, true, "#000000", LineDrawStyle.Solid, 1, TextOrientation.Horizontal, 0, false, LegendPosition.Top, StringAlignment.Center, 60, "#111111", true);

                //-- Set chart xaxis series label
                AxisFont = new FontSetting("Arial", FontStyle.Regular, 5, Color.Black, Color.White, StringAlignment.Center, false, false, FootNoteDisplayStyle.Inline);
                this._XAxisSeriesLabel = new StyleTemplateSetting(AxisFont, true, "#ffffff", LineDrawStyle.Solid, 0, TextOrientation.Custom, 45, false, LegendPosition.Right, StringAlignment.Center, 60, "#E3E3E3", false);

                //-- Set chart yaxis series label
                AxisFont = new FontSetting("Arial", FontStyle.Regular, 5, Color.Black, Color.White, StringAlignment.Center, false, false, FootNoteDisplayStyle.Inline);
                this._YAxisSeriesLabel = new StyleTemplateSetting(AxisFont, false, "#ffffff", LineDrawStyle.Solid, 0, TextOrientation.Horizontal, 0, false, LegendPosition.Right, StringAlignment.Center, 60, "#E3E3E3", false);
            }
        }