コード例 #1
0
        public static void ToHtml <T>(this UniversalGrid <T> grid, TextWriter output, string tableClass = null)
        {
            var htmlFormatter = new HtmlFormatter <T>(output, x => x.ToString(), tableClass);
            var writer        = new GridWriter <T>(htmlFormatter);

            writer.Write(grid);
        }
コード例 #2
0
        public static void ToCsv <T>(this UniversalGrid <T> grid, TextWriter output, char delimitter = '\t')
        {
            var htmlFormatter = new CsvFormatter <T>(output, x => x.ToString(), delimitter);
            var writer        = new GridWriter <T>(htmlFormatter);

            writer.Write(grid);
        }
コード例 #3
0
        public static XDocument ToSvg <T>(this UniversalGrid <T> grid, Func <T, XNode> objectFormatter = null)
        {
            var doc = new XDocument();

            using (var output = doc.CreateWriter())
            {
                var htmlFormatter = new SvgFormatter <T>(output, objectFormatter ?? (x => x == null ? null : new XText(x.ToString())));
                var writer        = new GridWriter <T>(htmlFormatter);
                writer.Write(grid);
            }

            return(doc);
        }
コード例 #4
0
        public static void FormatUsing <T>(this UniversalGrid <T> grid, ITextFormatter <T> formatter)
        {
            var writer = new GridWriter <T>(formatter);

            writer.Write(grid);
        }