Owl.Word.WordBuilder.CreateTable C# (CSharp) Method

CreateTable() public method

public CreateTable ( DataTable table ) : void
table System.Data.DataTable
return void
        public void CreateTable(DataTable table)
        {
            var tStyle = new TableStyle();

            CreateTable(table, tStyle);
        }

Same methods

WordBuilder::CreateTable ( DataTable table, TableStyle style ) : void

Usage Example

Example #1
0
        private static void AddTable(WordBuilder builder)
        {
            using (var table = new DataTable()) {

                table.Columns.Add("Item", typeof(string));
                table.Columns.Add("Min", typeof(string));
                table.Columns.Add("Avg", typeof(string));
                table.Columns.Add("Max", typeof(string));

                for (int i = 0; i < 10; i++) {

                    var r = table.NewRow();
                    r[0] = i.ToString(); r[1] = 10M.ToString(); r[2] = 11M.ToString(); r[3] = 12M.ToString();

                    table.Rows.Add(r);
                }

                builder.CreateTable(table, new TableStyle() {
                    Alignment = HorizontalAlignmentType.Center,
                    ShowTitle = true,
                    Title = "My Table"
                });
            }
        }