Last post Jul 25, 2017 07:22 AM by Cathy Zou
Jul 07, 2017 09:14 PM|NJ2|LINK
The following code exports Gridview to a pdf fine. How do I add a page break in pdf when the number in column one changes? I need to have separate page for each number so records with all "1" are on a page and "2" on its own page and so on. The numbers in
column one may not be sequentiall they could be like:
1s then 3s then 7s etc.
This is Row 1
This is Row 2
This is Row 3
This is Row 4
This is Row 5
This is Row 6
This is Row 7
This is Row 8
This is Row 9
This is Row 10
This is Row 11
This is Row 12
Response.ContentType = "application/pdf";
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
gv1.AllowPaging = false;
StringReader sr = new StringReader(sw.ToString());
Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 10f, 0f);
HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
Jul 10, 2017 07:22 AM|Cathy Zou|LINK
using DevExpres ASPxGridView;
To accomplish this task, manually create printing links for each group, and insert page breaks at the beginning of the link content. For each link, the grid should be filtered appropriately.
For more information, please refer to the following links:
Jul 10, 2017 01:25 PM|NJ2|LINK
I am not using any 3rd party controls.
Jul 21, 2017 10:15 AM|Cathy Zou|LINK
As far I know, we couldn’t inset page break when we export gridview to pdf
So, I suggest you could consider to use third party control.
Jul 21, 2017 04:33 PM|NJ2|LINK
It doesn't have to be from the GridView. The data in GridView can be exported out to another format and then create pdf out of that with page break. I am sure there is a way to do it without using a 3rd party control.
Jul 25, 2017 07:22 AM|Cathy Zou|LINK
For PdfWriter is a third-party library
So you could to ask the library provider.