Can't set column widths on Reporting.ItemsTable

Nov 26, 2013 at 9:45 AM
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 {
        public string ColumnA { get; set; }
        public string ColumnB { get; set; }
    }

    class Program
    {
        static void 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());
            }
        }
    }
Mar 6, 2014 at 11:47 AM
did you figured it out?
Mar 6, 2014 at 12:17 PM
No, I ditched oxyplot reports and generated the PDF using MigraDoc PDF Sharp.
Mar 10, 2014 at 11:27 AM
Have you then figured out a way to include a OxyPlot.PlotModel directly into the PdfSharp document or do you have to save the image first and then include it from file?
Mar 10, 2014 at 1:07 PM
No again :( I'm rendering the chart to a tmp file and passing the path to PDF Sharp.