
Can't set column widths on Reporting.ItemsTable
This discussion was imported from CodePlex
nutsontheroad wrote at 2013-11-26 10:45:
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.
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()); } } }
delapiero wrote at 2014-03-06 12:47:
did you figured it out?
nutsontheroad wrote at 2014-03-06 13:17:
No, I ditched oxyplot reports and generated the PDF using MigraDoc PDF Sharp.
slashdevnull wrote at 2014-03-10 12:27:
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?
nutsontheroad wrote at 2014-03-10 14:07:
No again :( I'm rendering the chart to a tmp file and passing the path to PDF Sharp.
Servicio de atención al cliente por UserEcho