Hi,
When I use UltraGridPrintDocument to print a grid the grid is printed inside a border (see attached image). Is there anyway to get rid of this?
It doesn't appear in the PDF when using UltraGridDocumentExporter, which is what I'm trying to achieve when printing.
Kind regards,
Nathan
Hi Sahaja,
That doesn't work either. Here's the code.
Public Sub ExportGridToPrinter(ByVal grid1 As UltraGrid, ByVal grid2 As UltraGrid, ByVal contactName As String) Dim ultraGridExcelExporter1 As New UltraGridPrintDocument Try AddHandler grid1.InitializePrint, AddressOf grid_InitializePrint ultraGridExcelExporter1.Grid = grid1 grid1.DisplayLayout.Rows.ExpandAll(True) ultraGridExcelExporter1.Header.TextLeft = "Share Holding Statement for " & contactName _ & ControlChars.CrLf & ControlChars.CrLf & "Date of Statement: " & DateTime.Today.ToLongDateString() ultraGridExcelExporter1.Header.Height = 80 ultraGridExcelExporter1.Header.Appearance.FontData.Bold = DefaultableBoolean.True ultraGridExcelExporter1.Header.Appearance.FontData.SizeInPoints = 12 ultraGridExcelExporter1.Print() Catch Throw Finally AddHandler grid1.InitializePrint, AddressOf grid_InitializePrint End Try End Sub Private Sub grid_InitializePrint(sender AS Object, e as CancelablePrintEventArgs) e.PrintLayout.BorderStyle = UIElementBorderStyle.None End Sub
Hello Nathan,
Try setting UIElementBorderStyle.None to BorderStyle property of the Grid's PrintLayout in order to remove the Grid Border from printed document. You can set this property in InitializePrint event of the Grid. For example:
private void UltraGrid1_InitializePrint(object sender, CancelablePrintEventArgs e) { e.PrintLayout.BorderStyle = UIElementBorderStyle.None; }
Please let me know if I may be of further assistance.
Sincerely,Sahaja KokkalagaddaAssociate Software Developer
It doesn't seem to work. I'm using 2016.2.
My code is as follows:
Public Sub ExportGridToPrinter(ByVal grid1 As UltraGrid, ByVal grid2 As UltraGrid, ByVal contactName As String) Dim ultraGridExcelExporter1 As New UltraGridPrintDocument ultraGridExcelExporter1.Grid = grid1 ultraGridExcelExporter1.Page.BorderStyle = UIElementBorderStyle.None grid1.DisplayLayout.Rows.ExpandAll(True) ultraGridExcelExporter1.Header.TextLeft = "Share Holding Statement for " & contactName _ & ControlChars.CrLf & ControlChars.CrLf & "Date of Statement: " & DateTime.Today.ToLongDateString() ultraGridExcelExporter1.Header.Height = 80 ultraGridExcelExporter1.Header.Appearance.FontData.Bold = DefaultableBoolean.True ultraGridExcelExporter1.Header.Appearance.FontData.SizeInPoints = 12 ultraGridExcelExporter1.Print() End Sub
There is a possibility of removing page border when printing with UltraGridPrintDocument using the BorderStyle property off its Page object. You can set UIElementBorderStyle.None to this property in order to remove the border. For example you can do something like this:
/ the page property is the section representing the // entire renderable area of the page. you can assign // a border around the margin area this.ultraPrintDocument1.Page.BorderStyle = UIElementBorderStyle.None;