Repeating table - Print View - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Repeating table - Print View

Last post 02-22-2013 02:06 AM by sladefx. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 06-20-2011 02:46 AM

    Repeating table - Print View

    Hi,

     I've been given a form which has repeating tables on it. The repeating table allows a user to add a row and enter some information. The information they enter can be any size. The users have requested the ability to print out the form. I've managed to get this working, but they've commented on the page breaks in the rows. In most cases the row breaks are happening half way through a row and because each row contains a picture, the text is one one page and the picture another. The idea of the form is to be an instruction manual for the users which means that the picture and the text should ideally be on the same page.

    The picture is always 250x500, if no picture has been added then a place holder is there in place. If the text in the other columns is less than the size of the picture, then 3 rows can occur per page, with about a line or two left over. This means as the document gets longer the formatting gets worse.

    I've been googling & binging for the last 3 or 4 days and have only been able to find little bits and pieces. There was a useful piece of code by Matt Faus (I think that's the spelling) from this website, unfortunately I haven't been able to implement it

    The version of Infopath I am using is 2007 and I primarily use C# as the language. The forms are normal, non-web enabled forms.

     (and I've been working with Infopath for 7 days, so please be gentle!) 

    Thanks,

    J

     

  • 06-20-2011 04:05 AM In reply to

    Re: Repeating table - Print View

    What was the trouble you encountered with Matt's code?  Perhaps we can help you sort that out.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 06-20-2011 04:18 AM In reply to

    Re: Repeating table - Print View

    The main problem I encountered was trying to convert it to C#, but also that I think the layout of the form I have taken over may be completely different to the layout provided by Matt. I have just started this job and have been given a form to update the print view for. The form allows the user to go in and enter some details, which then creates a step by step guide.  The layout of the data source is:

     myFields

    -> SOPMain

    ->->OperationDetail (Repeating Table) (Contains: Number, Name, Description, Points, Picture, additionalFile, anotherFile)

    ->Footer

     The print view was almost complete, except for this slight issue, and the form is currently being used by the business so to be honest I was hoping for a 'Right click -> Don't allow rows to break over page' style answer (as in Word). The research I've done, unfortunately, seems to indicate that this isn't possible.

     Please could you let me know the C# equivalent of:

    // Set up access to secondary data source.
        var domVehicles = XDocument.GetDOM("Vehicles");   

        // Source nodes.
        var oVehicles = domVehicles.selectNodes("/Vehicles/Vehicle");
        // ALL ROWS
        // Get the node list.
        var oRows = XDocument.DOM.selectNodes("/my:myFields/my:Document/my:Page/my:Table/my:Row");

        // Save a sample node from this list for later - we will have to clone
        // it to add our rows back in.
        var oSampleRow = oRows.nextNode();

        // Remove all the rows from all the repeating tables.
        oRows.removeAll();

        // ALL TABLES
        var oTables = XDocument.DOM.selectNodes("/my:myFields/my:Document/my:Page/my:Table");   
        var oSampleTable = oTables.nextNode();   
        oTables.removeAll();

     

    I'll then try and continue to follow Matt's example.

     

    Thank you,

    J

  • 06-20-2011 04:50 AM In reply to

    • Skarn
    • Top 50 Contributor
      Male
    • Joined on 04-20-2008
    • Australia
    • Posts 198

    Re: Repeating table - Print View

    I've listed my 'repeat table header' findings here: http://www.infopathdev.com/forums/p/19481/67530.aspx#67530 and there might be something similar you can do to make the tables not page break in the middle of a row.

    A google for CSS styles for tables which supposedly address this behaviour gives: <TABLE style="page-break-after:always"> as a possibility as a tag to insert into the associated view xsl if you know how.

    But take note of my problem with Infopath reversing changes made to it's xsl files. A possible solution to this has been hinted by Patrick but I've yet to do any testing.

  • 06-24-2011 03:09 AM In reply to

    Re: Repeating table - Print View

    Thanks for the reply. I've tried the page-break-before:always and page-break-after:always settings neither appear to do much unfortunately. I'm assuming I've managed to do it correctly:

    Open in design and then save as source files -> open printview.xsl and find the repeating table, add the css to the table style and save. Open Manifest.xsf in design and then save as .xsn and then open .xsn.

    I've explained the problem to the user and they've agreed that it isn't worth the hassle trying to get this to display correctly as they will only be printing for another 2 or 3 weeks before touch screens are installed to display these forms in their work spaces.

    If I get any spare time I'll give it a go as I really dislike having to leave projects on "that'll do" style fixes lol.

  • 02-22-2013 02:06 AM In reply to

    Re: Repeating table - Print View

    Hi there, did you get anywhere with implementing this CSS or the code?

    Have exactly the same problem.

Page 1 of 1 (6 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.