Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
275
How to add a page header to PDF when using UltraWebGridDocumentExporter
posted

Hello,

We are using UltraWebGrids and allow our end users to export the grids to PDF.  The contents of the grid is generated by the user selecting various parameters and then refreshing the grid in the browser.  When we export it to PDF, we want to be able to include some text that says what parameter values the user had selected, which generated the data as such.  We would also like to be able to include a page header with text of our choosing.  I cannot see any method of including a page header, however.

The only thing I can come up with is modifying the grid rows/cells and inserting a few rows at the top of the grid, but this is not ideal because they appear just after the header row.  I could live with it if there was just a way to insert rows above the header row, even though it would not be a true "page" header.

Here is some sample code we are using to generate the PDF from the grid. In this sample code I am inserting a row with "some test text" which is not ideal because it appears below the header row, even though my code says to insert it at index 0. Here's my code:

Dim obj As New Infragistics.WebUI.UltraWebGrid.DocumentExport.UltraWebGridDocumentExporter
Dim bytData() As Byte

Dim objMS As New System.IO.MemoryStream

'not great, it puts a row under the headers.
Dim objRow As New Infragistics.WebUI.UltraWebGrid.UltraGridRow
Dim objCell As New Infragistics.WebUI.UltraWebGrid.UltraGridCell
objCell.Value = "some test text."
objCell.ColSpan = 10
objRow.Cells.Add(objCell)
_Grid.Rows.Insert(0, objRow, True)

obj.ExportMode = Infragistics.WebUI.UltraWebGrid.Exporter.ExportMode.Download
obj.Format = Infragistics.Documents.Reports.Report.FileFormat.PDF
obj.DownloadName = Filename

obj.TargetPaperOrientation = intOrientation
obj.Export(_Grid, objMS, True)
bytData = objMS.ToArray()

Response.Clear()
Response.ClearHeaders()
Response.ContentType = "application/PDF"
Response.AddHeader("Pragma", "public")
Response.AddHeader("Expires", "0")
Response.AddHeader("Content-Disposition", "inline; filename=" & Filename)
Response.BinaryWrite(bytData)
Response.End()

 

Any ideas here?

Parents Reply Children
No Data