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
445
Add text lines before print UltraGrid
posted

I need to add couple of text lines on the top of the page when print an UltraGrid. Also I need to show preview dialog before print . The print output should be something like this for example:

Number: 123456      Name: ABCD

Address:  xxxxxxxx      Zip:      12345

----------------------------------------------

|               my UltraGrid data              |

-----------------------------------------------

So I added UltraGridPrintDocument and UltraPrintPreviewDialog in my form. And I tried to use that  "ultraGridPrintDocument.Header.TextLeft" property but it seems can only add one text line and also cannot be formatted to align those fields on the top. Here is my code snip:

ultraGridPrintDocument.Header.TextLeft = "Number...................";

ultraPrintPreviewDialog.Document = ultraGridPrintDocument;

 ultraPrintPreviewDialog.ShowDialog(this);

So what is the right way to add text lines on top of the Grid and also make those text fields aligned? Should I put those text fields into another UltraGrid and add that on top of my data grid when print? Please provide some sample code if possible.

Thanks! 

Parents
No Data
Reply
  • 469350
    Offline posted

    Hi,

    The grid print operation creates it's own print job. So there's no way to add anything into the printout except by using the header and/or footer of the page. These will be repeated on each page, of course, so that might not be what you want.

    If using the page header is okay, then you can use as many lines as you like by putting line breaks into your header text. 

    this.ultraGridPrintDocument1.Header.TextLeft = "Number: xxxxxx" + Environment.NewLine + "Address: xxxxxxx";

    I am not sure what you mean by "cannot be formatted to align those fields on the top."

Children