예제 #1
0
        private static RadDocument CreateDocument(GridViewDataControl grid)
        {
            RadDocument document;

            using (var stream = new MemoryStream())
            {
                EventHandler <GridViewElementExportingEventArgs> elementExporting = (s, e) =>
                {
                    if (e.Element == ExportElement.Table)
                    {
                        e.Attributes["border"] = "0";
                    }
                };

                grid.ElementExporting += elementExporting;

                grid.Export(stream, new GridViewExportOptions
                {
                    Format            = ExportFormat.Html,
                    ShowColumnFooters = grid.ShowColumnFooters,
                    ShowColumnHeaders = grid.ShowColumnHeaders,
                    ShowGroupFooters  = grid.ShowGroupFooters
                });

                grid.ElementExporting -= elementExporting;

                stream.Position = 0;

                document = new HtmlFormatProvider().Import(stream);

                foreach (Span span in document.EnumerateChildrenOfType <Span>())
                {
                    span.FontSize   = 12;
                    span.FontFamily = new FontFamily("Arial");
                }
            }

            return(document);
        }
예제 #2
0
        private static RadDocument CreateDocument(GridViewDataControl grid)
        {
            RadDocument document;

            using (var stream = new MemoryStream())
            {
                EventHandler<GridViewElementExportingEventArgs> elementExporting = (s, e) =>
                {
                    if (e.Element == ExportElement.Table)
                    {
                        e.Attributes["border"] = "0";
                    }
                };

                grid.ElementExporting += elementExporting;

                grid.Export(stream, new GridViewExportOptions
                {
                    Format = ExportFormat.Html,
                    ShowColumnFooters = grid.ShowColumnFooters,
                    ShowColumnHeaders = grid.ShowColumnHeaders,
                    ShowGroupFooters = grid.ShowGroupFooters
                });

                grid.ElementExporting -= elementExporting;

                stream.Position = 0;

                document = new HtmlFormatProvider().Import(stream);

                foreach (Span span in document.EnumerateChildrenOfType<Span>())
                {
                    span.FontSize = 12;
                    span.FontFamily = new FontFamily("Arial");
                }
            }

            return document;
        }