Home Forums WPF controls Xceed DataGrid for WPF printing a datagrid

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #24466 |

    hi,
    I have used the ” grid.Print()” method to print a table view grid. It works perfectly, But the title of the printed grid has values such as .[0] , .[1] , .[2] etc avd not the column title. I have created the columns dynamically.kindly provide me a solution

    S.V.Britto

    Imported from legacy forums. Posted by Britto (had 852 views)

    Xceed Support
    Member
    Post count: 5658

    Can you provide a repro application?

    If you can, you can send it to <a href=”matlto:support@xceedsoft.com”>support@xceedsoft.com</a>

    Please make sure to reference this forum post when sending the mail:

    http://forums.xceed.com/forums/ShowPost.aspx?PostID=9372

    Imported from legacy forums. Posted by Marcus [Xceed] (had 252 views)

    User (Old forums)
    Member
    Post count: 23064

    What does repro application mean?.. Could you please clarify ?
    I will provide the necessary details
    It’s urgent…

    Imported from legacy forums. Posted by Britto (had 297 views)

    Odi [Xceed]
    Spectator
    Post count: 426

    An application (relevant portions only, if possible), or some sample code, that will help Xceed reproduce the problem.

    Just a heads-up: Xceed is closed on Monday the 3rd of September for Labor day, so the team can only look at this as of Tuesday.

    Odi

    Imported from legacy forums. Posted by Odi [Xceed] (had 438 views)

    User (Old forums)
    Member
    Post count: 23064

    Hi,

    The detailed code has been mailed. Please look into it and reply.

    Regards,
    Britto

    Imported from legacy forums. Posted by Britto (had 224 views)

    User (Old forums)
    Member
    Post count: 23064

    We have received the repro code and a developer will look at it shortly.

    Thanks,

    Imported from legacy forums. Posted by Pascal (had 694 views)

    User (Old forums)
    Member
    Post count: 23064

    Hi,

    The issue comes from the columns’ Fieldname.

    Currently, columns must keep as their Fieldname the default generated one, or in your case, the default that WOULD be generated.

    You are Binding to a List< string[] >, with AutoCreateColumns set to False, creating your columns before the binding occurs.

    When you are setting the column’s binding, you are setting the column’s fieldname to be the same as your title.

    The workaround would be to keep the default fieldname while still changing the column’s Title to your more descriptive caption.

    Therefore, if we take the code that you sent us, the procedure where you setup your columns would change from:

    bin = new Binding();
    path = “[” + i.ToString() + “]”;
    bin.Path = new PropertyPath(path, paraName);
    col = new Column(paraName, paraName, bin);

    to:

    bin = new Binding();
    // Note the dot before the opening bracket. The default binding would result in a dot being
    // placed before the indexer. Therefore, make sure you include it too.
    path = “.[” + i.ToString() + “]”;
    bin.Path = new PropertyPath(path, paraName);
    col = new Column(path, paraName, bin);

    Imported from legacy forums. Posted by PL (had 527 views)

    User (Old forums)
    Member
    Post count: 23064

    Dear Sir,
    Your Solution for printing a grid works good. many many thanks for your kind co-operatiom.
    Another problem i am facing while printing are, it prints over the entire width of the page and the columns also has their own width.
    Now I am in need of solutions for the following ones.
    1. How can i have columns of width, exactly to the width of its content in fieldname.
    2. While printing can i print the grid in landscape orientation, without setting it in the print dialog box.
    3. Is it possible to have margin for the grid while printing?

    Kindly provide me the solutions as early as possible.

    With Regards
    Britto.S.V

    Imported from legacy forums. Posted by kesavan (had 480 views)

    User (Old forums)
    Member
    Post count: 23064

    Hi,
    I have tried printing a grid in landscape orientation with the following codes. But it prints in portrait orientation only.Even if i change the orientation in the PrintDialogBox manualy, It again prints in the portait orientation only.
    The code is as follows

    DataGridPaginator datapag = new (DataGridPaginator)this.CreateDocumentpaginator;
    datapag.PageOrientation = System.Printing.PageOrientation.Landscape;
    this.print;
    I had Derived a DatagridControl for this Class. Please provide me a solution.

    Regards.
    S.V.Britto

    Imported from legacy forums. Posted by Britto (had 404 views)

    User (Old forums)
    Member
    Post count: 23064

    Hi,

    We opened a case for the landscape orientation not working. This is indeed a bug.

    Concerning your other questions, the print-out column’s width will be the same as the one you see on the screen. Therefore, you need to size your column’s to your content before printing or exporting.

    To tweak the margins, you either need to use the Print or Export overload that takes in an imageableArea.

    This rectangle in conjoncture with the page size is used to make margins.

    Imported from legacy forums. Posted by PL (had 6915 views)

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.