/// <summary>
        /// Grid Element Exporting
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void radGridSnapshot_ElementExporting(object sender, GridViewElementExportingEventArgs e)
        {
            RadGridView_ElementExport.ElementExporting(e, isGroupFootersVisible: false, cellValueConverter: () =>
            {
                object result = e.Value;
                if (e.Value == null && e.Element == ExportElement.Cell)
                {
                    GridViewDataColumn column = (e.Context as GridViewDataColumn);
                    if (column != null)
                    {
                        if (column.DisplayIndex == 0)
                        {
                            MarketSnapshotPerformanceData data = column.DataControl.Items[++itemIndex] as MarketSnapshotPerformanceData;
                            if (data != null)
                            {
                                result = string.Format("{0}{1}{2}", data.MarketSnapshotPreferenceInfo.EntityNodeValueName
                                                       , String.IsNullOrEmpty(data.MarketSnapshotPreferenceInfo.EntityNodeValueName) ? "" : " "
                                                       , data.MarketSnapshotPreferenceInfo.EntityName);
                            }
                        }
                    }
                }

                return(result);
            });
        }
Example #2
0
        private void ElementExporting(object sender, GridViewElementExportingEventArgs e)
        {
            var visParameters = e.VisualParameters as GridViewExcelMLVisualExportParameters;

            if (e.Element == ExportElement.Row)
            {
                if (!firstRow.HasValue)
                {
                    firstRow = true;
                }
                else if (firstRow.Value)
                {
                    firstRow = false;
                }
                firstCell = true;
            }
            else if (e.Element == ExportElement.Cell)
            {
                if ((firstRow.HasValue && firstRow.Value) || (firstCell))
                {
                    visParameters.StyleId = "Header";
                    firstCell             = false;
                }
                else
                {
                    visParameters.StyleId = "Cell";
                }
            }
        }
        /// <summary>
        /// handles element exporting for grid
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgRelativePerformance_ElementExporting(object sender, GridViewElementExportingEventArgs e)
        {
            RadGridView_ElementExport.ElementExporting(e, () =>
            {
                if (e.Value is RelativePerformanceData)
                {
                    RelativePerformanceData value = e.Value as RelativePerformanceData;
                    if (value != null)
                    {
                        decimal totalValue = value.AggregateCountryAlpha.HasValue?
                                             value.AggregateCountryAlpha.Value:0;
                        countryTotal = GetValueInBasisPoints(totalValue.ToString());
                    }

                    return(value);
                }

                if (e.Value is RelativePerformanceCountrySpecificData)
                {
                    RelativePerformanceCountrySpecificData value = e.Value as RelativePerformanceCountrySpecificData;

                    string result = String.Empty;
                    if (value.Alpha != null)
                    {
                        decimal totalValue = 0M;

                        result = Decimal.TryParse(value.Alpha.ToString(), out totalValue) ?
                                 GetValueInBasisPoints(totalValue.ToString()) : String.Empty;
                    }
                    return(result);
                }

                if (e.Value == null)
                {
                    GridViewDataColumn column = (e.Context as GridViewDataColumn);
                    if (column != null)
                    {
                        if ((!String.IsNullOrEmpty(column.Header.ToString()) && String.Equals(column.Header.ToString(), "Total",
                                                                                              StringComparison.CurrentCultureIgnoreCase)))
                        {
                            return(countryTotal);
                        }
                    }
                }

                if (e.Element == ExportElement.FooterCell)
                {
                    decimal totalValue = 0M;

                    string value = Decimal.TryParse(e.Value.ToString(), out totalValue) ?
                                   GetValueInBasisPoints(totalValue.ToString()) : "Total";

                    return(value);
                }

                return(e.Value);
            });
        }
 private void ElementExporting(object sender, GridViewElementExportingEventArgs e)
 {
     if (e.Element == ExportElement.HeaderRow)
     {
         var htmlVisualExportParameters = e.VisualParameters as GridViewHtmlVisualExportParameters;
         if (htmlVisualExportParameters != null)
         {
             htmlVisualExportParameters.FontWeight = FontWeights.Bold;
         }
     }
 }
Example #5
0
 static void gvwToExport_ElementExporting(object sender, GridViewElementExportingEventArgs e)
 {
     if (e.Value != null && e.Value.GetType() == typeof(string))
     {
         e.Value = (e.Value as string)
                   .Replace("&", "&amp;")
                   .Replace("<", "&lt;")
                   .Replace(">", "&gt;")
                   .Replace("\"", "&quot;")
                   .Replace("\'", "&apos;");
     }
 }
 /// <summary>
 /// dgFinancialReportExt ElementExporting EventHandler
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e">GridViewElementExportingEventArgs</param>
 private void dgFinancialReportExt_ElementExporting(object sender, GridViewElementExportingEventArgs e)
 {
     RadGridView_ElementExport.ElementExporting(e, hideColumnIndex: new List <int> {
         1, 14
     }, headerCellValueConverter: () =>
     {
         if (e.Value == null)
         {
             return(null);
         }
         return(e.Value.ToString().Replace("A", "E"));
     });
 }
Example #7
0
 private void GridViewReport_ElementExporting(object sender, GridViewElementExportingEventArgs e)
 {
     if (e.Element == ExportElement.Cell)
     {
         if (e.Value is HudPlayerType hudPlayerType)
         {
             e.Value = hudPlayerType.Name;
         }
         else if (e.Value is EnumMRatio mRatio)
         {
             var converter = new MRatioToTextConverter();
             e.Value = converter.Convert(e.Value, typeof(string), null, null);
         }
     }
 }
        private void ElementExporting(object sender, GridViewElementExportingEventArgs e)
        {
            var visParameters = e.VisualParameters as GridViewExcelMLVisualExportParameters;

            if (e.Element == ExportElement.Row)
            {
                visParameters.RowHeight = this.RowHeight;
            }
            if (e.Element == ExportElement.Cell && (e.Context as GridViewBoundColumnBase).UniqueName == "Name")
            {
                visParameters.StyleId = "Name";
            }
            if (e.Element == ExportElement.Cell && (e.Context as GridViewBoundColumnBase).UniqueName == "UnitPrice")
            {
                visParameters.StyleId = "UnitPrice";
            }
        }
Example #9
0
        private void ElementExporting(object sender, GridViewElementExportingEventArgs e)
        {
            e.Width *= 1.4;
            if (e.Element == ExportElement.HeaderRow || e.Element == ExportElement.FooterRow ||
                e.Element == ExportElement.GroupFooterRow)
            {
                e.Background = HeaderBackground;
                e.Foreground = HeaderForeground;
                e.FontSize   = 16;
                e.FontWeight = FontWeights.Bold;
            }
            else if (e.Element == ExportElement.Row)
            {
                e.Background = RowBackground;
                e.Foreground = RowForeground;
            }
            else if (e.Element == ExportElement.Cell &&
                     e.Value != null && e.Value.Equals("Chocolade"))
            {
                e.FontFamily = new FontFamily("Verdana");
                e.Background = Colors.LightGray;
                e.Foreground = Colors.Blue;
            }
            else if (e.Element == ExportElement.GroupHeaderRow)
            {
                e.FontFamily = new FontFamily("Verdana");
                e.Background = Colors.LightGray;
                e.Height     = 24;
            }
            else if (e.Element == ExportElement.GroupHeaderCell &&
                     e.Value != null && e.Value.Equals("Chocolade"))
            {
                e.Value = "MyNewValue";
            }
            else if (e.Element == ExportElement.GroupFooterCell)
            {
                GridViewDataColumn           column   = e.Context as GridViewDataColumn;
                QueryableCollectionViewGroup qcvGroup = e.Value as QueryableCollectionViewGroup;

                if (column != null && qcvGroup != null && column.AggregateFunctions.Count > 0)
                {
                    e.Value = GetAggregates(qcvGroup, column);
                }
            }
        }
Example #10
0
 /// <summary>
 /// Element Exporting Event
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dgPortfolioDetails_ElementExporting(object sender, GridViewElementExportingEventArgs e)
 {
     if (e.Element == ExportElement.Row)
     {
         var value = e.Value as PortfolioDetailsData;
         if (value.Children != null)
         {
             foreach (var child in value.Children)
             {
                 e.Value = child;
                 RadGridView_ElementExport.ElementExporting(e, isGroupFootersVisible: false);
             }
         }
         else
         {
             RadGridView_ElementExport.ElementExporting(e, isGroupFootersVisible: false);
         }
     }
     else
     {
         RadGridView_ElementExport.ElementExporting(e, isGroupFootersVisible: false);
         //The following section is used for reformatting in exported file
         RadGridView_ElementExport.ElementExporting(e, isGroupFootersVisible: false, cellValueConverter: () =>
         {
             object result = e.Value;
             if (e.Value != null && e.Element == ExportElement.Cell && e.Value.ToString() != "")
             {
                 GridViewDataColumn column = (e.Context as GridViewDataColumn);
                 if (column != null && (column.Header.ToString() == "Target %" ||
                                        column.Header.ToString() == "Portfolio %" ||
                                        column.Header.ToString() == "Benchmark %" ||
                                        column.Header.ToString() == "Active Position %" ||
                                        column.Header.ToString() == "Upside %"))
                 {
                     decimal?resultInt = 0;
                     resultInt         = Convert.ToDecimal(result);
                     //resultInt =  ? 0 : Convert.ToDecimal(result);
                     resultInt = resultInt / 100;
                     result    = resultInt.ToString();
                 }
             }
             return(result);
         });
     }
 }
        void ElementExporting(object sender, GridViewElementExportingEventArgs e)
        {
            var htmlVisualExportParameters = e.VisualParameters as GridViewHtmlVisualExportParameters;

            if (htmlVisualExportParameters != null)
            {
                if (e.Element == ExportElement.HeaderRow || e.Element == ExportElement.FooterRow ||
                    e.Element == ExportElement.GroupFooterRow)
                {
                    htmlVisualExportParameters.Background = HeaderBackground;
                    htmlVisualExportParameters.Foreground = HeaderForeground;
                    htmlVisualExportParameters.FontSize   = 20;
                    htmlVisualExportParameters.FontWeight = FontWeights.Bold;
                }
                else if (e.Element == ExportElement.Row)
                {
                    htmlVisualExportParameters.Background = RowBackground;
                    htmlVisualExportParameters.Foreground = RowForeground;
                }
                else if (e.Element == ExportElement.Cell &&
                         e.Value != null && e.Value.Equals("Chocolade"))
                {
                    htmlVisualExportParameters.FontFamily = new FontFamily("Verdana");
                    htmlVisualExportParameters.Background = Colors.LightGray;
                    htmlVisualExportParameters.Foreground = Colors.Blue;
                }
                else if (e.Element == ExportElement.GroupHeaderRow)
                {
                    htmlVisualExportParameters.FontFamily = new FontFamily("Verdana");
                    htmlVisualExportParameters.Background = Colors.LightGray;
                    htmlVisualExportParameters.Height     = 30;
                }
                else if (e.Element == ExportElement.GroupHeaderCell &&
                         e.Value != null && e.Value.Equals("Chocolade"))
                {
                    e.Value = "MyNewValue";
                }
            }
        }
Example #12
0
 /// <summary>
 /// Event for Grid Export
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ElementExportingEvent(object sender, GridViewElementExportingEventArgs e)
 {
     RadGridView_ElementExport.ElementExporting(e);
 }
 /// <summary>
 /// dgICPSummaryReport ElementExporting EventHandler
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e">GridViewElementExportingEventArgs</param>
 private void dgICPSummaryReport_ElementExporting(object sender, GridViewElementExportingEventArgs e)
 {
     RadGridView_ElementExport.ElementExporting(e);
 }
Example #14
0
 /// <summary>
 ///     设置导出样式
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ElementExporting(object sender, GridViewElementExportingEventArgs e)
 {
     // ReSharper disable once CSharpWarnings::CS0618
     e.Width = 120;
     if (e.Element == ExportElement.Cell && e.Value != null)
     {
         var temp = (sender as RadGridView);
         if (temp != null)
         {
             if (_i%3 == 0 && _i >= 6 &&
                 temp.Name.Equals("FleetTrendAll", StringComparison.OrdinalIgnoreCase))
             {
                 e.Value = DateTime.Parse(e.Value.ToString()).AddMonths(1).AddDays(-1).ToString("yyyy/M/d");
             }
             else if (_i%4 == 3 && _i >= 7 &&
                      temp.Name.Equals("SubFleetTrendAll", StringComparison.OrdinalIgnoreCase))
             {
                 e.Value = DateTime.Parse(e.Value.ToString()).AddMonths(1).AddDays(-1).ToString("yyyy/M/d");
             }
         }
     }
     _i++;
 }
 /// <summary>
 /// 设置导出样式
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void ElementExporting(object sender, GridViewElementExportingEventArgs e)
 {
     e.Width = 120;
     if (e.Element == ExportElement.Cell &&
         e.Value != null)
     {
         if (i % 5 == 3 && i >= 8 && (sender as RadGridView).Name == "AircraftTrent")
         {
             e.Value = DateTime.Parse(e.Value.ToString()).AddMonths(1).AddDays(-1).ToString("yyyy/M/d");
         }
     }
     i++;
 }
 /// <summary>
 ///Adding styles to export
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dgTopTenBenchmarkSecurities_ElementExporting(object sender, GridViewElementExportingEventArgs e)
 {
     RadGridView_ElementExport.ElementExporting(e, isGroupFootersVisible: false);
 }
 private void ElementExporting(object sender, GridViewElementExportingEventArgs e)
 {
     var htmlVisualExportParameters = e.VisualParameters as GridViewHtmlVisualExportParameters;
     if (htmlVisualExportParameters != null)
     {
         if (e.Element == ExportElement.HeaderRow || e.Element == ExportElement.FooterRow
             || e.Element == ExportElement.GroupFooterRow)
         {
             htmlVisualExportParameters.Background = HeaderBackground;
             htmlVisualExportParameters.Foreground = HeaderForeground;
             htmlVisualExportParameters.FontSize = 20;
             htmlVisualExportParameters.FontWeight = FontWeights.Bold;
         }
         else if (e.Element == ExportElement.Row)
         {
             htmlVisualExportParameters.Background = RowBackground;
             htmlVisualExportParameters.Foreground = RowForeground;
         }
         else if (e.Element == ExportElement.Cell &&
             e.Value != null && e.Value.Equals("Chocolade"))
         {
             htmlVisualExportParameters.FontFamily = new FontFamily("Verdana");
             htmlVisualExportParameters.Background = Colors.LightGray;
             htmlVisualExportParameters.Foreground = Colors.Blue;
         }
         else if (e.Element == ExportElement.GroupHeaderRow)
         {
             htmlVisualExportParameters.FontFamily = new FontFamily("Verdana");
             htmlVisualExportParameters.Background = Colors.LightGray;
             htmlVisualExportParameters.Height = 30;
         }
         else if (e.Element == ExportElement.GroupHeaderCell &&
             e.Value != null && e.Value.Equals("Chocolade"))
         {
             e.Value = "MyNewValue";
         }
     }
 }
		private void ElementExporting(object sender, GridViewElementExportingEventArgs e)
		{
			var visParameters = e.VisualParameters as GridViewExcelMLVisualExportParameters;
			if (e.Element == ExportElement.Row)
			{
				visParameters.RowHeight = this.RowHeight;
			}
			if (e.Element == ExportElement.Cell && (e.Context as GridViewBoundColumnBase).UniqueName == "Name")
			{
				visParameters.StyleId = "Name";
			}
			if (e.Element == ExportElement.Cell && (e.Context as GridViewBoundColumnBase).UniqueName == "UnitPrice")
			{
				visParameters.StyleId = "UnitPrice";
			}
		}
Example #19
0
        private void ElementExporting(object sender, GridViewElementExportingEventArgs e)
        {
            var bHtml = (TheExportOptionsViewModel.Value.ExportFileType != ExportFileType.ExcelML &&
                        TheExportOptionsViewModel.Value.ExportFileType != ExportFileType.Csv);
            if (!bHtml)
                return;

            switch (e.Element)
            {
                case ExportElement.HeaderRow:
                    if (TheExportOptionsViewModel.Value.ExportFileType == ExportFileType.Pdf)
                    {
                        if (TheExportOptionsViewModel.Value.HeaderBackground.HasValue)
                            ((GridViewHtmlVisualExportParameters)e.VisualParameters).Styles.Add("background-color", TheExportOptionsViewModel.Value.HeaderBackground.Value.ToString().Remove(1, 2));
                    }
                    else
                    {
                        ((GridViewHtmlVisualExportParameters)e.VisualParameters).Background = TheExportOptionsViewModel.Value.HeaderBackground;
                    }

                    ((GridViewHtmlVisualExportParameters)e.VisualParameters).FontSize = 20;
                    ((GridViewHtmlVisualExportParameters)e.VisualParameters).FontWeight = FontWeights.Bold;
                    break;

                case ExportElement.HeaderCell:
                    ((GridViewHtmlVisualExportParameters)e.VisualParameters).Foreground = TheExportOptionsViewModel.Value.HeaderForeground;
                    ((GridViewHtmlVisualExportParameters)e.VisualParameters).Height = 20;
                    break;

                case ExportElement.Row:
                    _row = (IInfoClass)e.Value;
                    if (TheExportOptionsViewModel.Value.ExportFileType == ExportFileType.Pdf)
                    {
                        if (TheExportOptionsViewModel.Value.RowBackground.HasValue)
                            ((GridViewHtmlVisualExportParameters)e.VisualParameters).Styles.Add("background-color", TheExportOptionsViewModel.Value.RowBackground.Value.ToString().Remove(1, 2));
                    }
                    else
                    {
                        ((GridViewHtmlVisualExportParameters)e.VisualParameters).Background = TheExportOptionsViewModel.Value.RowBackground;
                    }

                    break;

                case ExportElement.GroupHeaderRow:
                    ((GridViewHtmlVisualExportParameters)e.VisualParameters).FontFamily = new FontFamily("Arial Unicode MS");
                    ((GridViewHtmlVisualExportParameters)e.VisualParameters).Background = Colors.LightGray;
                    ((GridViewHtmlVisualExportParameters)e.VisualParameters).Height = 30;
                    var qcvGroup = e.Value as QueryableCollectionViewGroup;
                    if (qcvGroup != null)
                        e.Value = string.Format(CultureInfo.InvariantCulture, "{0} Items", qcvGroup.Items.Count);

                    break;

                case ExportElement.GroupFooterRow:
                case ExportElement.FooterRow:
                    if (TheExportOptionsViewModel.Value.ExportFileType == ExportFileType.Pdf)
                        ((GridViewHtmlVisualExportParameters)e.VisualParameters).Styles.Add("background-color", Colors.LightGray.ToString().Remove(1, 2));
                    else
                        ((GridViewHtmlVisualExportParameters)e.VisualParameters).Background = Colors.LightGray;

                    break;

                case ExportElement.Cell:
                    if (_accessDeniedProperties.Any(x => x == ((GridViewColumn)e.Context).UniqueName))
                    {
                        e.Value = "<Blocked>";
                        ((GridViewHtmlVisualExportParameters)e.VisualParameters).Foreground = Colors.Red;
                        break;
                    }

                    if (e.Value is string && (string)e.Value == "<Rich Text>")
                    {
                        ((GridViewHtmlVisualExportParameters)e.VisualParameters).Foreground = Colors.Blue;
                        break;
                    }

                    if (e.Value is byte[])
                    {
                        e.Value = "binary data";
                    }

                    var propertyName = ((GridViewDataColumn)e.Context).UniqueName + Constants.FieldBackColorPostfix;
                    var value = _row.GetValueByPropertyName(propertyName);
                    if (value is long)
                    {
                        var color = ((long)value);
                        if (color != 0)
                        {
                            ((GridViewHtmlVisualExportParameters)e.VisualParameters).Background = ((long)value).ToColor();
                        }
                    }
                    ((GridViewHtmlVisualExportParameters)e.VisualParameters).Foreground = TheExportOptionsViewModel.Value.RowForeground;

                    break;

                case ExportElement.GroupFooterCell:
                    if (e.Value == null)
                        return;

                    var qcvg = e.Value as QueryableCollectionViewGroup;
                    if (qcvg != null)
                    {
                        var resultList = new List<string>();
                        foreach (var aggr in qcvg.AggregateResults)
                        {
                            if (aggr.FunctionName.StartsWith(((GridViewColumn)e.Context).UniqueName, StringComparison.Ordinal))
                            {
                                resultList.Add(string.Format(CultureInfo.InvariantCulture, "{0} {1}", aggr.Caption, aggr.Value));
                            }
                        }

                        e.Value = string.Join(", ", resultList);
                    }
                    break;

                case ExportElement.FooterCell:
                    if (e.Value == null)
                        return;

                    var result = new List<string>();
                    var array = ((string)e.Value).Split(',');

                    for (byte i = 0; i < ((GridViewColumn)e.Context).AggregateFunctions.Count; i++)
                        result.Add(string.Format(CultureInfo.InvariantCulture, "{0} {1}", ((GridViewColumn)e.Context).AggregateFunctions[i].Caption, array[i]));

                    e.Value = string.Join(", ", result);

                    break;
            }
        }
Example #20
0
 /// <summary>
 /// handles element exporting
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dgIndexConstituents_ElementExporting(object sender, GridViewElementExportingEventArgs e)
 {
     RadGridView_ElementExport.ElementExporting(e, isGroupFootersVisible: false);
 }
 private void dgQuarterlyResults_ElementExporting(object sender, GridViewElementExportingEventArgs e)
 {
     RadGridView_ElementExport.ElementExporting(e, isGroupFootersVisible: false);
 }
 /// <summary>
 /// 设置导出样式
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void ElementExporting(object sender, GridViewElementExportingEventArgs e)
 {
     e.Width = 120;
     if (e.Element == ExportElement.Cell &&
         e.Value != null)
     {
         if (i % 4 == 3 && i >= 7 && (sender as RadGridView).Name == "FleetTrendCargo")
         {
             e.Value = DateTime.Parse(e.Value.ToString()).AddMonths(1).AddDays(-1).ToString("yyyy/M/d");
         }
         else if (i % 6 == 3 && i >= 9 && (sender as RadGridView).Name == "SubFleetTrendCargo")
         {
             e.Value = DateTime.Parse(e.Value.ToString()).AddMonths(1).AddDays(-1).ToString("yyyy/M/d");
         }
     }
     i++;
 }
Example #23
0
 /// <summary>
 /// Element Exporting Event
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ExcelElementExporting(object sender, GridViewElementExportingEventArgs e)
 {
     RadGridView_ElementExport.ElementExporting(e, isGroupFootersVisible: false);
 }
 /// <summary>
 /// dgFinancialReport ElementExporting EventHandler
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e">GridViewElementExportingEventArgs</param>
 private void dgFinancialReport_ElementExporting(object sender, GridViewElementExportingEventArgs e)
 {
     RadGridView_ElementExport.ElementExporting(e, hideColumnIndex: new List <int> {
         1, 14
     });
 }
 /// <summary>
 /// 设置导出样式
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void ElementExporting(object sender, GridViewElementExportingEventArgs e)
 {
     e.Width = 120;
     if (e.Element == ExportElement.Cell &&
        e.Value != null)
     {
         if (i % 4 == 3 && i >= 7)
         {
             RadGridView a = sender as RadGridView;
             if (a.Name == "FleetTrendPnrMonth")
             {
                 e.Value = DateTime.Parse(e.Value.ToString()).AddMonths(1).AddDays(-1).ToString("yyyy/M/d");
             }
         }
     }
     i++;
 }
Example #26
0
 /// <summary>
 /// Syles added to Export to Excel
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dgCOASpecific_ElementExporting(object sender, GridViewElementExportingEventArgs e)
 {
     RadGridView_ElementExport.ElementExporting(e, hideColumnIndex: new List <int> {
         1, 8
     });
 }
Example #27
0
        /// <summary>
        /// Application des couleurs sur les éléments du tableau
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private static void elementExporting(object sender, GridViewElementExportingEventArgs e)
        {
            e.FontFamily = new FontFamily("Verdana");
            e.FontSize = 9;
            e.VerticalAlignment = VerticalAlignment.Center;

            if (e.Element == ExportElement.Table)
            {
                e.Attributes["border"] = "0";
            }
            else if (e.Element == ExportElement.HeaderRow)
            {
                rowCount = 0;

                e.Styles.Add("background-color", ExportAndPrintHelper.HeaderBackground.ToString().Remove(1, 2));

                e.Background = ExportAndPrintHelper.HeaderBackground;
                e.Foreground = ExportAndPrintHelper.HeaderForeground;
                e.FontWeight = FontWeights.Bold;
                e.FontSize = 10;
            }
            else if (e.Element == ExportElement.GroupHeaderRow)
            {
                rowCount = 0;

                e.Styles.Add("background-color", ExportAndPrintHelper.GroupHeaderBackground.ToString().Remove(1, 2));
                e.Background = ExportAndPrintHelper.GroupHeaderBackground;
                e.Foreground = ExportAndPrintHelper.HeaderForeground;
                e.FontWeight = FontWeights.Bold;
            }
            else if (e.Element == ExportElement.HeaderCell)
            {
                e.Styles.Add("white-space", "nowrap");

                if (e.Value is Image && (e.Context as GridViewDataColumn) != null)
                {
                    e.Value = (e.Context as GridViewDataColumn).DataMemberBinding.Path.Path;
                }
            }
            else if (e.Element == ExportElement.GroupHeaderCell && String.IsNullOrEmpty(e.Value.ToString()) && e.Context is QueryableCollectionViewGroup)
            {
                e.Value = (e.Context as QueryableCollectionViewGroup).Key;
            }
            else if (e.Element == ExportElement.Row)
            {
                rowCount++;

                if (rowCount % 2 == 0)
                {
                    e.Background = ExportAndPrintHelper.RowBackgroundAlternate;
                    e.Foreground = ExportAndPrintHelper.RowForegroundAlternate;
                }
                else
                {
                    e.Background = ExportAndPrintHelper.RowBackground;
                    e.Foreground = ExportAndPrintHelper.RowForeground;
                }
                e.Styles.Add("background-color", e.Background.ToString().Remove(1, 2));
            }
            else if (e.Element == ExportElement.Cell && (e.Context as GridViewDataColumn) != null)
            {
                if ((e.Context as GridViewDataColumn).DataType == typeof(DateTime)
                    || (e.Context as GridViewDataColumn).DataType == typeof(Decimal)
                    || (e.Context as GridViewDataColumn).DataType == typeof(Double)
                    || (e.Context as GridViewDataColumn).DataType == typeof(int)
                    )
                {
                    (e.Context as GridViewDataColumn).TextWrapping = TextWrapping.NoWrap;
                    e.Styles.Add("white-space", "nowrap");
                }

                if (e.Value is bool)
                {
                    e.Value = ((bool)e.Value) ? "oui" : "non";
                }
                if ((e.Context as GridViewDataColumn).DataType == typeof(DateTime))
                {
                    e.Width = 80;
                }
            }
        }
 /// <summary>
 /// Helper method Export
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dgRelativePerformanceUI_ElementExporting(object sender, GridViewElementExportingEventArgs e)
 {
     RadGridView_ElementExport.ElementExporting(e);
 }
 /// <summary>
 /// 设置导出样式
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void ElementExporting(object sender, GridViewElementExportingEventArgs e)
 {
     e.Width = 120;
     if (e.Element == ExportElement.Row)
     { i = 1; }
     else if (e.Element == ExportElement.Cell &&
         e.Value != null)
     {
         var gridViewColumn = e.Context as GridViewColumn;
         if (gridViewColumn != null && gridViewColumn.UniqueName == "performTime")
         {
             if (!string.IsNullOrEmpty(e.Value.ToString()))
                 e.Value = DateTime.Parse(e.Value.ToString()).ToString("yyyy年M月");
         }
         i++;
     }
 }
 /// <summary>
 /// handles element exporting for export to excel
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dgRegionBreakdown_ElementExporting(object sender, GridViewElementExportingEventArgs e)
 {
     RadGridView_ElementExport.ElementExporting(e, isGroupFootersVisible: true, aggregatedColumnIndex: new List <int> {
         1, 2, 3
     });
 }
Example #31
0
 /// <summary>
 ///     设置导出样式
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ElementExporting(object sender, GridViewElementExportingEventArgs e)
 {
     // ReSharper disable once CSharpWarnings::CS0618
     e.Width = 120;
     if (e.Element == ExportElement.Cell && e.Value != null)
     {
         var radGridView = sender as RadGridView;
         if (radGridView != null && (_i%5 == 3 && _i >= 8 &&
                                     radGridView.Name.Equals("FleetTrendPnr", StringComparison.OrdinalIgnoreCase)))
         {
             e.Value = DateTime.Parse(e.Value.ToString()).AddMonths(1).AddDays(-1).ToString("yyyy/M/d");
         }
         else if (radGridView != null && _i%8 == 3 && _i >= 11 &&
                  radGridView.Name.Equals("SubFleetTrendPnr", StringComparison.OrdinalIgnoreCase))
         {
             e.Value = DateTime.Parse(e.Value.ToString()).AddMonths(1).AddDays(-1).ToString("yyyy/M/d");
         }
     }
     _i++;
 }
Example #32
0
 /// <summary>
 ///     设置导出样式
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ElementExporting(object sender, GridViewElementExportingEventArgs e)
 {
     // ReSharper disable once CSharpWarnings::CS0618
     e.Width = 120;
     if (e.Element == ExportElement.Cell && e.Value != null)
     {
         if (_i%5 == 3 && _i >= 8 &&
             ((RadGridView) sender).Name.Equals("FleetStructure", StringComparison.OrdinalIgnoreCase))
         {
             e.Value = DateTime.Parse(e.Value.ToString()).AddMonths(1).AddDays(-1).ToString("yyyy/M/d");
         }
     }
     _i++;
 }
 private void ElementExporting(object sender, GridViewElementExportingEventArgs e)
 {
     if (e.Element == ExportElement.HeaderRow)
     {
         var htmlVisualExportParameters = e.VisualParameters as GridViewHtmlVisualExportParameters;
         if (htmlVisualExportParameters != null)
         {
             htmlVisualExportParameters.FontWeight = FontWeights.Bold;
         }
     }
 }
 /// <summary>
 /// 设置导出样式
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void ElementExporting(object sender, GridViewElementExportingEventArgs e)
 {
     e.Width = 120;
 }
Example #35
0
        /// <summary>
        /// Handles RadGridView Element Export in predefined prameterized details
        /// </summary>
        /// <param name="exportElement">GridViewElementExportingEventArgs - custom argument received in RadGridView Element_Exporting event</param>
        /// <param name="cellValueConverter">Function to convert cell values to customed values</param>
        /// <param name="headerCellValueConverter">Function to convert header cell values to customed values</param>
        /// <param name="isGroupFootersVisible">True to display group footers in export</param>
        /// <param name="hideColumnIndex">List of column indexes to be hide in export</param>
        /// <param name="aggregatedColumnIndex">aggregated column indexes</param>
        public static void ElementExporting(GridViewElementExportingEventArgs exportElement, Func <object> cellValueConverter = null,
                                            Func <object> headerCellValueConverter = null, bool isGroupFootersVisible       = true
                                            , List <int> hideColumnIndex           = null, List <int> aggregatedColumnIndex = null)
        {
            ExportElementOptions element = ExportElementOptions.Where(t => t.ExportElementType == exportElement.Element).FirstOrDefault();

            if (element != null)
            {
                exportElement.Background        = element.ExportElementBackground;
                exportElement.Foreground        = element.ExportElementForeground;
                exportElement.FontFamily        = element.ExportElementFontFamily;
                exportElement.FontSize          = element.ExportElementFontSize;
                exportElement.Height            = element.ExportElementFontSize + 5;
                exportElement.Width             = 100;
                exportElement.VerticalAlignment = VerticalAlignment.Center;
                exportElement.FontWeight        = element.ExportElementFontWeight;
                exportElement.TextAlignment     = element.ExportElementTextAlignment;
            }


            if (hideColumnIndex != null)
            {
                GridViewDataColumn column = exportElement.Context as GridViewDataColumn;

                if (column != null)
                {
                    if (exportElement.Element == ExportElement.Cell || exportElement.Element == ExportElement.FooterCell ||
                        exportElement.Element == ExportElement.GroupFooterCell || exportElement.Element == ExportElement.GroupHeaderCell ||
                        exportElement.Element == ExportElement.GroupIndentCell || exportElement.Element == ExportElement.HeaderCell)
                    {
                        if (hideColumnIndex.Contains(column.DisplayIndex))
                        {
                            exportElement.Cancel = true;
                        }
                    }
                }
            }

            if (exportElement.Element == ExportElement.HeaderCell)
            {
                if (headerCellValueConverter != null)
                {
                    exportElement.Value = headerCellValueConverter();
                }
            }

            if (exportElement.Element == ExportElement.GroupFooterRow || exportElement.Element == ExportElement.GroupFooterCell)
            {
                if (isGroupFootersVisible == false)
                {
                    exportElement.Cancel = true;
                    return;
                }
            }

            if (exportElement.Element == ExportElement.Cell)
            {
                if (cellValueConverter != null)
                {
                    exportElement.Value = cellValueConverter();
                }
            }

            if (exportElement.Element == ExportElement.Row)
            {
                if (cellValueConverter != null)
                {
                    exportElement.Value = cellValueConverter();
                }
            }

            if (exportElement.Element == ExportElement.FooterCell)
            {
                if (cellValueConverter != null)
                {
                    exportElement.Value = cellValueConverter();
                }
            }

            else if (exportElement.Element == ExportElement.GroupFooterCell)
            {
                GridViewDataColumn           column   = exportElement.Context as GridViewDataColumn;
                QueryableCollectionViewGroup qcvGroup = exportElement.Value as QueryableCollectionViewGroup;

                if (column != null && qcvGroup != null && column.AggregateFunctions.Count > 0)
                {
                    exportElement.Value = GetAggregates(qcvGroup, column);
                }
                else
                {
                    exportElement.Value = "";
                }
            }
        }