VahidN/PdfReport.Core

How add simple text block at Report [before the main table]

andreykhr opened this issue · 5 comments

Hi @VahidN, I just download your library. Its look nice, but I don't understand, how can i write simple text block? I need some text paragraphs before main table. Only at first page, not header on each page.

I think I must go down to iTextSharp, but can't understand what object responsive for that.

Could u explain, how can I do it?

You can use MainTableEvents to add rows at different stages of creating the final report. Here is a sample to demonstrate it.

Cool! Thanx.

By the way. It show me row data when i use cellData.Value, but I need formatted text (suppose html). I found cellData.FormattedValue and try to use like

 cellData.FormattedValue =  string.Format(@"<table style='width: 100%;font-size:9pt;font-family:tahoma;'>
                                <tr align='left' >
                                    <td width='80%'>                                       

I suppose by property name its for html, but result PDF is empty. I lost something?

Try specifying the CellTemplate:

infoTable.AddSimpleRow((cellData, properties) =>
                         {
                            cellData.CellTemplate = new HtmlField(); //Using iTextSharp's HTML to PDF capabilities.
                            cellData.Value = "....html...";

                            properties.RunDirection = PdfRunDirection.LeftToRight;                            
                            properties.HorizontalAlignment = HorizontalAlignment.Justified;
                            properties.ShowBorder = true;
                            properties.PdfFont = args.PdfFont;
                            properties.CellPadding = 5f;							 
			});

YES! Its worked Great!!
Thanx!!

lock commented

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related problems.