-1

I just want to a create a report with a table look like this :

enter image description here

Day, Date, and Movement are properties from DailyProgram model. Here's my DailyProgram class :

public class DailyProgram {
        public DailyProgram(int day, DateTime date) {
            this.Day = day;
            this.Date = date;
            this.TourDestinations = new List<TourDestination>();
            this.MovementSummary = new MovementSummary();
            this.Movements = new List<Movement>();
        }
        public int Day { get; set; }
        public DateTime Date { get; set; }
        public ICollection<TourDestination> TourDestinations { get; set; }
        public MovementSummary MovementSummary { get; set; }
        public ICollection<Movement> Movements { get; set; }

        public class TourDestination {
            public TourDestination(string destination) {
                this.Destination = destination;
                this.AttractionSummary = new List<AttractionSummary>();
                this.TransportationSummary = new List<TransportationSummary>();
            }
            public string Destination { get; set; }
            public AccommodationSummary AccommodationSummary { get; set; }
            public ICollection<TransportationSummary> TransportationSummary;
            public ICollection<AttractionSummary> AttractionSummary;
        }
    }

And the records in Movements section are from ICollection<Movement> Movements. Here my Movement class :

public class Movement
    {
        [DataType(DataType.DateTime)]
        public DateTime DateTime { get; set; }

        public int SeqNumber { get; set; }

        public string MovementName { get; set; }

        public string MovementDescription { get; set; }

        public int Duration { get; set; }

        public int ServiceItemId { get; set; }            

        public string Destination { get; set; }

        public MovementItem Item { get; set; }
    }

My Question is: I already try to find a tutorial to make a PDF report with the concept of Master-detail that I explain above in Google, but I have not found a tutorial yet. Is there any source or documentation from ITextSharp or PDFsharp to make PDF report with master detail but from list in code, not from database?

What I ever tried is Using subreport in Microsoft.Report.Viewer (RDLC). In RDLC I tried to Invoke the EventHandler in WEB API, but without success.

UPDATE

So far, I choose IText 7 for solve this question. And I solved this question by using PdfPTable and PdfPCell from IText 7.

Satria Janaka
  • 463
  • 4
  • 15
  • The only special thing about those master detail tables appears to be that the movement column cells contain sub tables or (viewed the other way around) that other cells are spread over multiple rows or columns. Thus, all you need in your pdf library is support for tables inside tables or for rowspan and colspan cell attributes. IText offers both. – mkl Sep 13 '17 at 04:16
  • Is by 'IText' you mean 'ITextSharp' ? – Satria Janaka Sep 13 '17 at 04:20
  • iTextSharp is the nickname for iText 5 .NET. If you are just starting with your code then I strongly recommend that you use *iText 7 .NET* instead. – Amedee Van Gasse Sep 13 '17 at 04:52
  • Ah, I get it. Maybe I will choose iTextSharp instead to make the PDF Report. Thank you for your answer. – Satria Janaka Sep 13 '17 at 05:52
  • Soon, the application will be hosted on Microsoft Azure. Does Microsoft Azure support iTextSharp ? @AmedeeVanGasse – Satria Janaka Sep 13 '17 at 06:14
  • MS Azure supports all kinds of libraries, even Java libraries. Since iText for .NET is a C# library, you can use it on MS Azure. (And please stop using the name iTextSharp, we're abandoning it to avoid problems with a company named Sharp.) – Bruno Lowagie Sep 13 '17 at 06:25
  • I believe that we have customers who use iText 7 on Azure and I don't see any reason why it shouldn't work, but I am not aware of any official endorsement by Microsoft so I think you should contact Microsoft if you want to be sure that they support iText. – Amedee Van Gasse Sep 13 '17 at 06:29
  • Next question, when I search with 'IText' keyword in manage NuGet Packages on Visual Studio, both ITextSharp and IText 7 are shown in the results. What is the difference between those two ? @BrunoLowagie – Satria Janaka Sep 13 '17 at 07:14
  • iTextSharp is the old name. Most likely, the version is 5 or earlier. We are abandoning the name iTextSharp in favor of iText for .NET, among others because a Trademark lawyer warned us that a company named Sharp doesn't like the fact that other companies also use the word Sharp in their brand names. Unfortunately, we can't stop people from using the old name iTextSharp. – Bruno Lowagie Sep 13 '17 at 07:18
  • Thank you everyone for the answers !, @BrunoLowagie so far I choose IText 7 for develop the report. – Satria Janaka Sep 15 '17 at 03:28

1 Answers1

0

PDFsharp does not support tables. You can create tables by drawing text and lines around it.

MigraDoc comes bundled with PDFsharp. MigraDoc supports tables.

The Invoice sample does not demonstrate master/detail views, but shows how to create a table and also shows how to use MergeRight and MergeDown.
http://www.pdfsharp.net/wiki/Invoice-sample.ashx