示例#1
0
        public static void Print(this RadGridView grid, PrintSettings settings)
        {
            spreadsheet.Workbook = CreateWorkbook(grid, settings);
            PrintWhatSettings printWhatSettings = new PrintWhatSettings(ExportWhat.ActiveSheet, false);

            spreadsheet.Print(printWhatSettings);
        }
		public static void Print(this RadGridView grid, PrintSettings settings)
		{
			spreadsheet.Workbook = CreateWorkbook(grid, settings);
			PrintWhatSettings printWhatSettings = new PrintWhatSettings(ExportWhat.ActiveSheet, false);

			spreadsheet.Print(printWhatSettings);
		}
示例#3
0
        public static void PrintPreview(this RadGridView grid, PrintSettings settings)
        {
            spreadsheet.Workbook = CreateWorkbook(grid, settings);
            var printPreviewControl = CreatePrintPreviewControl(spreadsheet);
            var window = CreatePreviewWindow(printPreviewControl);

            window.ShowDialog();
        }
		public static void PrintPreview(this RadGridView grid, PrintSettings settings)
		{
			spreadsheet.Workbook = CreateWorkbook(grid, settings);
			var printPreviewControl = CreatePrintPreviewControl(spreadsheet);
			var window = CreatePreviewWindow(printPreviewControl);

			window.ShowDialog();
		}
示例#5
0
        private static Workbook CreateWorkbook(RadGridView grid, PrintSettings settings)
        {
            EventHandler <GridViewElementExportingToDocumentEventArgs> elementExporting = (s, e) =>
            {
                var documentVisualExportParameters = e.VisualParameters as GridViewDocumentVisualExportParameters;

                if (documentVisualExportParameters != null)
                {
                    if (e.Element == ExportElement.HeaderRow)
                    {
                        if (settings.HeaderBackground != null)
                        {
                            documentVisualExportParameters.Style = new CellSelectionStyle()
                            {
                                Fill = new PatternFill(PatternType.Solid, settings.HeaderBackground, settings.HeaderBackground)
                            };
                        }
                    }
                    else if (e.Element == ExportElement.GroupHeaderRow)
                    {
                        if (settings.GroupHeaderBackground != null)
                        {
                            documentVisualExportParameters.Style = new CellSelectionStyle()
                            {
                                Fill = new PatternFill(PatternType.Solid, settings.GroupHeaderBackground, settings.GroupHeaderBackground)
                            };
                        }
                    }
                    else if (e.Element == ExportElement.Row)
                    {
                        if (settings.RowBackground != null)
                        {
                            documentVisualExportParameters.Style = new CellSelectionStyle()
                            {
                                Fill = new PatternFill(PatternType.Solid, settings.RowBackground, settings.RowBackground)
                            };
                        }
                    }
                }
            };

            grid.ElementExportingToDocument += elementExporting;

            Workbook currentWorkbook = grid.ExportToWorkbook();

            return(currentWorkbook);
        }
		private static Workbook CreateWorkbook(RadGridView grid, PrintSettings settings)
		{
			EventHandler<GridViewElementExportingToDocumentEventArgs> elementExporting = (s, e) =>
				{
					var documentVisualExportParameters = e.VisualParameters as GridViewDocumentVisualExportParameters;

					if (documentVisualExportParameters != null)
					{
						if (e.Element == ExportElement.HeaderRow)
						{
							if (settings.HeaderBackground != null)
							{
								documentVisualExportParameters.Style = new CellSelectionStyle() { Fill = new PatternFill(PatternType.Solid, settings.HeaderBackground, settings.HeaderBackground) };
							}
						}
						else if (e.Element == ExportElement.GroupHeaderRow)
						{
							if (settings.GroupHeaderBackground != null)
							{
								documentVisualExportParameters.Style = new CellSelectionStyle() { Fill = new PatternFill(PatternType.Solid, settings.GroupHeaderBackground, settings.GroupHeaderBackground) };
							}
						}
						else if (e.Element == ExportElement.Row)
						{
							if (settings.RowBackground != null)
							{
								documentVisualExportParameters.Style = new CellSelectionStyle() { Fill = new PatternFill(PatternType.Solid, settings.RowBackground, settings.RowBackground) };
							}
						}
					}
				};

			grid.ElementExportingToDocument += elementExporting;

			Workbook currentWorkbook = grid.ExportToWorkbook();

			return currentWorkbook;
		}