Results 1 to 8 of 8

Thread: Printing a single table on a page

  1. #1

    Default Printing a single table on a page

    I am trying to add a print button that applies just to a single table on a page using the instructions from this page:
    http://javascript.about.com/library/blprint.htm
    The last item is to assign class="print" to the table but I'm not sure where I'm supposed to add that. Any idea?
    Thanks in advance,
    Janice

  2. #2
    Senior Member
    Join Date
    Apr 2010
    Posts
    352

    Default

    CSS go in between the HEAD tags. Right click outside your page and choose Master HTML to apply it to all pages or right click on your page and choose Layout HTML if you only want it on that page and then click the icon that says headInner and paste:

    Code:
    <link rel="stylesheet" href="print.css" type="text/css" media="print" />
    Last edited by Technology Ideas; 12-10-2010 at 01:07 AM.

  3. #3

    Default

    Thanks Andrew - I do have that part taken care of. What I'm missing is how to assign class-"print" to the table that needs to be printed. Would you know how to do that in NOF?
    Thanks!
    Janice

  4. #4
    Senior Member
    Join Date
    Apr 2010
    Posts
    352

    Default

    That's little hard for me to answer specifically as I can't tell exactly what you've done, but essentially you just need to add code above and below the object/s you want to print by creating a DIV assigning that class to it. For instance, if it's literally just a table, right click the table and select Table HTML and before any NetObjects code add:

    Code:
     
    <div class="print">
    and at the end of the NetObjects generated code add:

    Code:
     
    </div>

  5. #5
    Senior Member gotFusion's Avatar
    Join Date
    Jan 2010
    Location
    www.gotHosting.biz
    Posts
    4,529

    Default

    If that does not work you can try to insert the class within the table tag. Press the Table HTML button on the table properties palette and insert class="print" within the table tag
    NetObjects Fusion Cloud Linux enabled Web Hosting, support + training starts at $14.95
    NetObjects Fusion web Hosting and support + ASP + PHP + ColdFusion + MySQL + MS SQL
    FREE NetObjects Fusion Support & training comes with all web hosting accounts
    NetObjects Fusion Web Hosting: http://www.gotHosting.biz

  6. #6

    Default

    Thanks Andrew and Mike - I was able to get the print function to work using Andrew's method; however, the table is printing near the bottom of the page where it would normally appear if the rest of the graphics and text were included. Is there a way to force it to the top of the page? I'm guessing it would have to do with the CSS file but I tried google and couldn't seem to find the answer I needed. This is the only thing in the print.css file:

    body {visibility:hidden;}
    .print {visibility:visible;}

    Janice

  7. #7
    Senior Member
    Join Date
    Apr 2010
    Posts
    352

    Default

    That is because you have done the following with the CSS: show/print only areas with the class called "print" and hide/don't print all other items, therefore, when you print it, it has to print the space where the other items would have been. The CSS cannot actually remove code of all other elements, CSS can't do that. It can hide it from being seen/printed...

    There is nothing you can do about that. The only way to do what you want would be to put the table in an iFrame and then put a print button in the iFrame and therefore when someone clicked print, the page would literally just be the table, and only that.

  8. #8
    Senior Member gotFusion's Avatar
    Join Date
    Jan 2010
    Location
    www.gotHosting.biz
    Posts
    4,529

    Default

    Quote Originally Posted by Technology Ideas View Post
    he only way to do what you want would be to put the table in an iFrame and then put a print button in the iFrame.
    You can call any block of code into a page using a dynamic include, then redefine the print function on that page to print the other document that is included on the parent page.

    Create a separate document with only the table code no html, head, or body tags ONLY the table code. You will need to do this OUTSIDE of Fusion as Fusion will not create a text only page. The simplest way to do this would be to copy the table code out of the Fusion generated page then delete the table in Fusion and replace it with your include statement (for coldfusion this would be <cfinclude template="xxxxx.cfm"> replace the xxxxx.cfm with the full URL of the page). Use the CTRL+T method to insert the include statement where you wish the table to appear. Copy the table code to notepad and save it. Then put in the print function coding in the parent page. That way when someone presses their print button the alternate page with only the table will print.

    Here is the code to redefine the print button (replace the link in the example with the actual domain/folder/page.... Your page must have a dynamic extension php, asp, cfm, etc). This would go into the document head using layout HTML insert.

    Code:
     
    < link rel="alternate" media="print" href=http://www.site.com/folder/differentPage.cfm>
    NetObjects Fusion Cloud Linux enabled Web Hosting, support + training starts at $14.95
    NetObjects Fusion web Hosting and support + ASP + PHP + ColdFusion + MySQL + MS SQL
    FREE NetObjects Fusion Support & training comes with all web hosting accounts
    NetObjects Fusion Web Hosting: http://www.gotHosting.biz

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •