(VB.NET - 2008) I create a report add a header/footer and then when I try and export a grid I can't get it to fit nicely on the page - either too small or will run over to the next page. Also if the grid has a couple of more columns it throws off the formatting.
I generate anywhere from 1 to 10 grids in the PDF
The grid has 16 columns and 33 rows (including header and summary row)
How can I have it take up the width of the page and maximize the space between the header and footer so the grid is readable and doesn't overlap into another page?
Dim report As Infragistics.Documents.Report.Report = New Report()
Dim
section1 As Infragistics.Documents.Report.Section.ISection = report.AddSection()
Dim sectionHeader As Infragistics.Documents.Report.Section.ISectionHeader = section1.AddHeader()
sectionHeader.Repeat = True
sectionHeader.Height = 20
'Header Text
Dim sectionHeaderText As Infragistics.Documents.Report.Text.IText = sectionHeader.AddText(0, 0)
Dim headerStyle As New Text.Style(New Font("Arial", 12, FontStyle.Bold), Brushes.Maroon)
sectionHeaderText.Style = headerStyle
sectionHeaderText.Paddings.All = 0
sectionHeaderText.Alignment =
New TextAlignment(Alignment.Center, Alignment.Top)
sectionHeaderText.Background =
New Background(Brushes.LightGray)
sectionHeaderText.AddContent("Header 1 info")
sectionHeaderText.AddLineBreak()
sectionHeaderText.AddContent(
'SET UP THE FOOTER
Dim sectionFooter As Infragistics.Documents.Report.Section.ISectionFooter = section1.AddFooter()
sectionFooter.Repeat =
True
sectionFooter.Height = 40
'Footer Text/Image
Dim sectionFooterText As Infragistics.Documents.Report.Text.IText = sectionFooter.AddText(0, 0)
Dim img As New Image(My.Resources.VanguardShipIcon)
Dim s As New Size(80, 40)
sectionFooterText.AddContent(img, s, ImageAlignment.Right)
"Header 2 info")
'Add some line breaks between header and the grid
text = section1.AddText()
text.AddLineBreak()
Me.UltraGridDocumentExporterDetailGrid.TargetPaperSize = Infragistics.Documents.Report.PageSizes.Legal
Me.UltraGridDocumentExporterDetailGrid.AutoSize = DocumentExport.AutoSize.None
Me.UltraGridDocumentExporterDetailGrid.TargetPaperOrientation = PageOrientation.Landscape
Me.UltraGridDocumentExporterDetailGrid.Export(Me.ugPortfolioReport, section1)
Hello,
Have you been able to take a look at the mentioned sample ?
If you still have any questions or concerns please do not hesitate to ask.
Hi,
I found the sample and followd the pattern, but create a PDF with header/title and grids is very fragile. I had to tweak all kinds of things from grid columns to PDF page parms to Report parms to get it to work.
It was not as easy as I would have like:
Create a header for every page - the header text would change for each page.
Create a footer with the company logo on every page
Create page number on every page
Export a grid and have it fit nicely on the page - the number of columns would vary in the grid as well as the data values
Problems:
1. I could not get the header or footer to be at the very top and bottom of the page (there was always about a 1 inch magin at the top and bottom of the page)
2. Page numbers worked
3. Fitting an image into a footer - guess and hope until you get it right.
4. The grid was a whole story in itself -
The page size would change in the PDF depending on the grid columns
The grid would only take up 1/2 the page (sometimes) - meaning that the header would come out, A text tile and then the grid, then bunch of white space, then the footer. The grid would not fill in the white space to the footer.
The grid would sometimes run into the next page (I have 30 rows + 1 summary rows and either 10, 13 or 16 columns of mostly formatted numbers) and for some data if would have 27 grid rows on one page and the last 4 on the next.
4. Summary: I am scared to touch anything now since it works - but I had to create a different header for the Grid pages, remove the footer on the grid pages, set the page size to legal/landscape, play around with other properties, Try all different thing with the Initialize_Layout of the grid (performAutoSize...) and also BeginExport event do a bunch of things.
FEATURE REQUEST: Create a design-time Report Designer UI where you can put the Wingrid on it (Like Crystal or Visual Studio Report)