Quantcast
Channel: OxyPlot (moved to GitHub)
Viewing all articles
Browse latest Browse all 2061

New Post: Can't set column widths on Reporting.ItemsTable

$
0
0
Hi there, I am having trouble setting the column widths on an ItemsTable in a report.

I figured I need to do something like the code below but the column widths seem to be ignored.

Any help would be much appreciated.
class Item {
        publicstring ColumnA { get; set; }
        publicstring ColumnB { get; set; }
    }

    class Program
    {
        staticvoid Main(string[] args)
        {
            Report theReport = new Report();
            theReport.Title = "My Test Report";

            ItemsTable theTable = new ItemsTable();

            ItemsTableField thisColumn = new ItemsTableField("Column A", "ColumnA");
            thisColumn.Width = 200.0;
            theTable.Fields.Add(thisColumn);

            thisColumn = new ItemsTableField("Column B", "ColumnB");
            thisColumn.Width = 50.0;
            theTable.Fields.Add(thisColumn);

            theTable.Items = new List<Item>() {
                new Item() {ColumnA = "This", ColumnB = "Is"},
                new Item() {ColumnA = "A", ColumnB = "Test"},
                new Item() {ColumnA = "Longer string that I don't want to", ColumnB = "wrap"},
            };

            theReport.Add(theTable);

            using (PdfReportWriter writer = new PdfReportWriter(@"d:\temp\out.pdf"))
            {
                writer.WriteReport(theReport, new ReportStyle());
            }
        }
    }

Viewing all articles
Browse latest Browse all 2061

Trending Articles