Hi,
I'm using UltraGridDocumentExporter to export the grid content to a PDF document. The issue I'm facing is, after exporting the grid columns data to PDF, few columns doesn't show the complete data. Content is cut off.
On debugging, the complete data is available in the grid instance before exporting to PDF. Problem arises when I call the PerformAutoResize() method for each of the columns in the grid to compute the width. For instance, a column holds value like "This is a sample test message to be displayed in the grid". But only " "This is a sample test message" is displayed in the PDF. If I increase the width manually while in debugging mode, the complete text is displayed.
Please let me know your comments on the above issue.
Thanks
You are probably calling PerformAutoResize on the on-screen columns. The screen uses different graphics units than the PDF document, so if you auto-size the on-screen columns and then export to PDF, the sizes will not be correct.
Why are you calling PerformAutoResize, anwyay? The UltraGridDocumentExporter has an AutoSize property which automatically auto-sizes the columns in the exported grid by default. So unless you explicitly turned this off, there's no reason to call PerformAutoResize yourself.
If, for some reason, you want to size the columns yourself, you should call PerformAutoResize on the columns of the Layout that is provided by the event args of the ExportStarted event.
I have set the UltraGridDocumentExporter's AutoSize Property to NONE (Not calling the PerformAutoResize method in the ExportStarted Event). Tried the below scenarios,
1) In the grid, a particular column's width is say 300. And I'm able to see the data completely. After I export, I dont see the complete text in the PDF. Also, If I increase the width of that column in the grid say to 400, and then export to PDF, complete text is seen in the PDF. This should be the case when the width was 300 right? Because, I was able to see the complete data with 300 as the column width.
2) When I wrap the column in the grid, and then export to PDF, the cell border and the actual data overlaps. Unable to view the data clearly. RowSizing Property is set to AutoFree. But it has no effect. Is there any way to overcome this problem? The same behaviour happens with the column header too. Header text overlaps with the cell border.
After setting the AutoSize Property to NONE, the header text doesn't fit in a single line. I would prefer, column header text in a single line. Please let me know what is causing this behaviour.
Hi Boris,
I have multiple lines on grid when I am trying to export in PDF , the bottom is cutting off.
Here is my sample code.
Private Sub ugrdExporter_ExportStarted(sender As Object, e As Infragistics.Win.UltraWinGrid.DocumentExport.ExportStartedEventArgs) Handles ugrdExporter.ExportStarted
Try
ugrdExporter.AutoSize = Infragistics.Win.UltraWinGrid.DocumentExport.AutoSize.SizeColumnsToContent
Catch ex As Exception
ExceptionManager.Publish(ex)
End Try
End Sub
Private Sub ugrdExporter_InitializeRow(sender As Object, e As Infragistics.Win.UltraWinGrid.DocumentExport.DocumentExportInitializeRowEventArgs) Handles ugrdExporter.InitializeRow
ugrdExporter.AutoSize = Infragistics.Win.UltraWinGrid.DocumentExport.AutoSize.None
Hi Raji,
Did you try using the AutoSize property, instead of calculating the size manually? Did it work? If you need any additional assistance, please let me know.
Raji K said:1) In the grid, a particular column's width is say 300. And I'm able to see the data completely. After I export, I dont see the complete text in the PDF. Also, If I increase the width of that column in the grid say to 400, and then export to PDF, complete text is seen in the PDF. This should be the case when the width was 300 right? Because, I was able to see the complete data with 300 as the column width.
No, that is just what I was referring to in my previous post. The screen uses difference graphics units than the report. When you set the column width to 300, you are using pixels. There is no guarantee that 300 pixels on the screen will correspond to a value in the report such that all of the text will fit. The best thing to do is to leave on the AutoSize property or auto-size the columns in the export layout to ensure that the data will fit in the report.
Raji K said:2) When I wrap the column in the grid, and then export to PDF, the cell border and the actual data overlaps. Unable to view the data clearly. RowSizing Property is set to AutoFree. But it has no effect. Is there any way to overcome this problem? The same behaviour happens with the column header too. Header text overlaps with the cell border.
I'm not entirely sure what you mean by "wrap the column in the grid". But once again it sounds like you are making the assumption that if the height of the row is sufficient on the screen that it will also be sufficient in the report. This is not the case, for the same reasons I described above.