table a4

Discussion in 'HTML' started by Spiff, Dec 1, 2004.

  1. Spiff

    Spiff Guest

    Easy problem:
    I want to draw a 3x3 table on a a4 paper (and then print it). The table must
    occupy all the paper, all cells must have the same size.
    I _don't_ want to specify table cell size explicitly but I would like it to
    be done automatically.

    A bit more difficult:
    Same as before, but I want a word centered in each cell.

    I know that with CSS you can specify paper size but I don't know if I can
    solve my problem.
    Thanks in advance, Gianmaria
    Spiff, Dec 1, 2004
    #1
    1. Advertising

  2. Spiff

    Kris Guest

    In article <>, "Spiff" <>
    wrote:

    > I want to draw a 3x3 table on a a4 paper (and then print it). The table must
    > occupy all the paper, all cells must have the same size.


    Put up a PDF file.

    --
    Kris
    <> (nl)
    Kris, Dec 1, 2004
    #2
    1. Advertising

  3. Spiff

    Spiff Guest

    >> I want to draw a 3x3 table on a a4 paper (and then print it). The table
    >> must
    >> occupy all the paper, all cells must have the same size.

    >
    > Put up a PDF file.


    Do you know if what I asked is impossibile with html and css?
    Thanks, S.
    Spiff, Dec 1, 2004
    #3
  4. Spiff wrote:

    > Easy problem:


    I suppose.

    > I want to draw a 3x3 table on a a4 paper (and then print it). The
    > table must occupy all the paper, all cells must have the same size.
    > I _don't_ want to specify table cell size explicitly but I would
    > like it to be done automatically.


    What is the URL of your sample?

    Have you set the table width to 100% ? And the three columns to 33%?

    Are you using a print stylesheet?

    > A bit more difficult: Same as before, but I want a word centered in
    > each cell.


    Do that the same as you would for the screen media.

    Hmm, is this a data table, or are you using tables for layout?

    > I know that with CSS you can specify paper size but I don't know if
    > I can solve my problem. Thanks in advance, Gianmaria


    I've never found the need to specify paper size.

    --
    -bts
    -This space intentionally left blank.
    Beauregard T. Shagnasty, Dec 1, 2004
    #4
  5. Spiff

    Spiff Guest

    >> I want to draw a 3x3 table on a a4 paper (and then print it). The
    >> table must occupy all the paper, all cells must have the same size.[...]

    >
    > What is the URL of your sample?


    Sorry, I don't have any url.

    > Have you set the table width to 100% ? And the three columns to 33%?


    Yes. This is my stylesheet code:

    table { border-collapse:collapse; width: 100%; }
    tr { width: 33%; text-align: center;}
    td { border:1px solid black;}

    and my html code

    <table>
    <tr>
    <td>row 1, cell 1</td>
    <td>row 1, cell 2</td>
    <td>row 1, cell 3</td>
    </tr>
    <tr>
    <td>row 2, cell 1</td>
    <td>row 2, cell 2</td>
    <td>row 2, cell 3</td>
    </tr>
    <tr>
    <td>row 3, cell 1</td>
    <td>row 3, cell 2</td>
    <td>row 3, cell 3</td>
    </tr>

    My code partially works. The table split up the page in 3x3 cells. The table
    occupy all the horizontal size of the page, but not the vertical size
    (that's why I think I need to specify the size of the page!).

    > Are you using a print stylesheet?


    Uhm.... I only intend to print the page on the printer, so the only
    stylesheet I'm using is the above one.

    > Hmm, is this a data table, or are you using tables for layout?


    ahem... I don't know. My problem is that I have 9 object (words, imagine
    etc) that I simply want to equally distribuite on a "a4" paper. So is this a
    data table or a table for layout?

    > I've never found the need to specify paper size.


    If what I intend to do is possible with html than I think I need to specify
    the paper size.
    Thanks a lot, Gianmaria
    Spiff, Dec 2, 2004
    #5
  6. Spiff

    rf Guest

    Spiff wrote:

    > Yes. This is my stylesheet code:
    >
    > table { border-collapse:collapse; width: 100%; }
    > tr { width: 33%; text-align: center;}
    > td { border:1px solid black;}


    <sigh/>

    table {width: 100%; height: 100%;}

    td {width: 33%; height: 33%; text-align: center;}



    There is no point in specifying a width for a td element.

    Why did you not simply *try* specifying height, rather than just talking
    about it?

    > If what I intend to do is possible with html than I think I need to

    specify
    > the paper size.


    No you don't. The piece of paper is the viewport, just like a screen is the
    vieport.

    --
    Cheers
    Richard.
    rf, Dec 2, 2004
    #6
  7. Spiff

    Spiff Guest

    >> table { border-collapse:collapse; width: 100%; }
    >> tr { width: 33%; text-align: center;}
    >> td { border:1px solid black;}

    >
    > <sigh/>
    >
    > table {width: 100%; height: 100%;}
    > td {width: 33%; height: 33%; text-align: center;}


    Thanks a lot for your reply.
    I tried your code but I'm not able to make it works. This is the complete
    html code I written.

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html>
    <head>
    <style>
    table { width: 100%; height: 100%; border-collapse: collapse}
    td { width: 33%; height:33%; text-align: center; border: 1px solid black}
    </style>
    <title>Table</title>
    </head>
    <body>
    <table>
    <tr>
    <td>row 1, cell 1</td>
    <td>row 1, cell 2</td>
    <td>row 1, cell 3</td>
    </tr>
    <tr>
    <td>row 2, cell 1</td>
    <td>row 2, cell 2</td>
    <td>row 2, cell 3</td>
    </tr>
    <tr>
    <td>row 3, cell 1</td>
    <td>row 3, cell 2</td>
    <td>row 3, cell 3</td>
    </tr>

    </table>
    </body>
    </html>

    > There is no point in specifying a width for a td element.


    Yes, you're definitly right. Sorry for the stupid thing I wrote.

    > Why did you not simply *try* specifying height, rather than just talking
    > about it?


    I'm sorry, I only read some css tutorial and try to solve my problem.

    >> [..]I think I need to specify the paper size.

    >
    > No you don't. The piece of paper is the viewport, just like a screen is
    > the
    > vieport.


    Ok!
    Thanks a lot for your help!
    S.
    Spiff, Dec 2, 2004
    #7
  8. Spiff

    Philip Ronan Guest

    Spiff wrote:

    > Thanks a lot for your reply.
    > I tried your code but I'm not able to make it works. This is the complete
    > html code I written.


    I don't think specifying a "height" of 100% for a table will actually have
    much effect unless the table is contained in a block element with a known
    height. The height of your <body> element will default to "auto", not to the
    size of an A4 sheet of paper.

    You could try specifying the size in cm, like this:

    table { width:100%; }
    td { width:33%; height:8.5cm; text-align:center; border:1px solid black }

    But HTML isn't really designed for this sort of thing. Someone suggested you
    use a PDF file instead. I think you should follow that advice.

    Phil

    --
    phil [dot] ronan @ virgin [dot] net
    http://vzone.virgin.net/phil.ronan/
    Philip Ronan, Dec 2, 2004
    #8
  9. Spiff

    Spiff Guest

    Thanks for your msg.

    > You could try specifying the size in cm, like this:
    >
    > table { width:100%; }
    > td { width:33%; height:8.5cm; text-align:center; border:1px solid black }


    The problem is that if I need to make a different table I have to calculate
    each time the height. But thank you anyway.

    > But HTML isn't really designed for this sort of thing. Someone suggested
    > you
    > use a PDF file instead. I think you should follow that advice.


    Yes, I'm agree. I tought also to LaTeX, but HTML is the simplest one and I
    wanted to be sure that was impossible with that.
    AnywayA friend give me this solution that works almost perfectly (there are
    some problem with margin). Here it is:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="it" lang="it">
    <head>
    <style>
    @media print
    {
    @page: {margin:0px}

    body,html { width:20cm; height:28cm;}

    table { width:100%; height:100%; border-collapse: collapse;}

    td { width:33%; border: 1px solid black; text-align:center; }

    }
    </style>
    <title>3x3 table in A4 table</title>
    </head>
    <body>
    <table>
    <tbody>
    <tr>
    <td>1</td>
    <td>2</td>
    <td>3</td>
    </tr>
    <tr>
    <td>4</td>
    <td>5</td>
    <td>6</td>
    </tr>
    <tr>
    <td>7</td>
    <td>8</td>
    <td>9</td>
    </tr>
    </tbody>
    </table>
    </object>
    </body>
    </html>
    Spiff, Dec 2, 2004
    #9
  10. Spiff

    rf Guest

    Spiff wrote:
    > Thanks for your msg.
    >
    > > You could try specifying the size in cm, like this:


    Hey people:

    This is *not* rocket science.

    http://users.bigpond.net.au/rf/printpage.htm

    A minimal HTML page that prints a grid on the viewport. It does *not* matter
    what the viewport is, a computer screen or a piece of paper or a telephone.
    There are no nasty dimensions specified, not cm or inches or furlongs, just
    the browser doing what it will do if you allow it to, that is fit the page
    to the viewport.

    http://users.bigpond.net.au/rf/printpage.jpg

    A picture of above URL printed on a piece of A4 paper. Note that it uses the
    entire viewport (except for a header and a footer for the URL and stuff).

    If you don't want those margins then *change your browser settings* because
    that is where they are specified, not in the HTML.

    The exact same URL could be imported into, for instance, MS Word and it
    would print exactly the same (except for the header/footer).

    HTH

    --
    Cheers
    Richard.
    rf, Dec 2, 2004
    #10
  11. Spiff

    Steve Pugh Guest

    On Thu, 02 Dec 2004 11:56:27 GMT, rf <rf@.invalid> wrote:
    >
    > Hey people:
    >
    > This is *not* rocket science.
    >
    > http://users.bigpond.net.au/rf/printpage.htm


    The key point that as far as I can see hasn't been
    commented on so far is that the OP's page used a doctype
    that triggers Standards mode whilst the example here
    doesn't use a doctype and hence triggers Quirks mode.

    In Standards mode height: 100% on a table won't do
    what's wanted but in Quirks mode it will.

    That's why the OP couldn't get this to work earlier.

    And to the OP: why use XHTML 1.1 when IE doesn't
    support it? Is this for an intranet that doesn't use
    IE?

    Steve
    Steve Pugh, Dec 2, 2004
    #11
  12. Spiff

    Spartanicus Guest

    "rf" <rf@.invalid> wrote:

    >A minimal HTML page that prints a grid on the viewport. It does *not* matter
    >what the viewport is, a computer screen or a piece of paper or a telephone.


    Only screens have viewport(s), print media are paged with rendering done
    on a canvas.

    --
    Spartanicus
    Spartanicus, Dec 2, 2004
    #12
  13. Spiff

    rf Guest

    Steve Pugh wrote:

    > The key point that as far as I can see hasn't been
    > commented on so far is that the OP's page used a doctype
    > that triggers Standards mode whilst the example here
    > doesn't use a doctype and hence triggers Quirks mode.


    Didn't spot that :-(

    > In Standards mode height: 100% on a table won't do
    > what's wanted but in Quirks mode it will.


    So? My page *assumes* quirks mode, which both IE an Firefox accept. It is a
    minimal page, after all :)

    > That's why the OP couldn't get this to work earlier.


    > And to the OP: why use XHTML 1.1 when IE doesn't
    > support it? Is this for an intranet that doesn't use
    > IE?


    And for this exercise why not use a bloody pencil, or something like MS word
    which *always* operates in quirks mode.

    If I want to do something like this to a piece of paper I fire up an old
    copy of word perfect and switch on "lable" mode :)


    --
    Cheers
    Richard.
    rf, Dec 2, 2004
    #13
  14. Spiff

    Spiff Guest

    > This is *not* rocket science.
    >
    > http://users.bigpond.net.au/rf/printpage.htm
    >
    > A minimal HTML page that prints a grid on the viewport. It does *not*
    > matter
    > what the viewport is [...]


    Great, it's work! And yes, without worry about dimesion etc. etc. Very
    nice!!
    So, my code doesn't work only because this:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

    Really thanks a lot,
    Spiff
    Spiff, Dec 2, 2004
    #14
  15. Spiff

    Spiff Guest

    > The key point that as far as I can see hasn't been
    > commented on so far is that the OP's page used a doctype
    > that triggers Standards mode whilst the example here
    > doesn't use a doctype and hence triggers Quirks mode.

    [....]

    Sorry, what is "OP"?
    Thanks, S.
    Spiff, Dec 2, 2004
    #15
  16. Spiff

    Spiff Guest

    >> And to the OP: why use XHTML 1.1 when IE doesn't
    >> support it? Is this for an intranet that doesn't use
    >> IE?

    >
    > And for this exercise why not use a bloody pencil, or something like MS
    > word
    > which *always* operates in quirks mode. [...]


    I didn't use Microsoft word because I want generate the page through a
    program and I don't know the Word .doc internal format.

    Thanks, S.
    Spiff, Dec 2, 2004
    #16
  17. Spiff

    Steve Pugh Guest

    Spiff <> wrote:
    > I wrote:
    >>
    >> The key point that as far as I can see hasn't been
    >> commented on so far is that the OP's page used a doctype
    >> that triggers Standards mode whilst the example here
    >> doesn't use a doctype and hence triggers Quirks mode.

    >
    > Sorry, what is "OP"?


    Original Poster.

    You, in this case.

    Steve
    Steve Pugh, Dec 2, 2004
    #17
  18. Spiff

    Kris Guest

    In article <>, "Spiff" <>
    wrote:

    > >> I want to draw a 3x3 table on a a4 paper (and then print it). The table
    > >> must
    > >> occupy all the paper, all cells must have the same size.

    > >
    > > Put up a PDF file.

    >
    > Do you know if what I asked is impossibile with html and css?


    PDF was made for print, HTML and CSS are not (..not primarily).

    --
    Kris
    <> (nl)
    Kris, Dec 2, 2004
    #18
  19. Spiff

    Spiff Guest

    "Kris" <> wrote in message
    news:4all.nl...

    > PDF was made for print, HTML and CSS are not (..not primarily).


    Do you know if it's easy make the work I need with pdf files? Consider I
    need to put unicode character in the page (japanese font).

    Thanks, S.
    Spiff, Dec 3, 2004
    #19
  20. Spiff

    Dylan Parry Guest

    Spiff wrote:

    > Do you know if it's easy make the work I need with pdf files? Consider I
    > need to put unicode character in the page (japanese font).


    Have you got Word or some other word processing software? If so you can
    create the document in that then use
    http://www.cutepdf.com/Products/CutePDF/writer.asp to "print" the
    document to a PDF file.

    Just download http://www.cutepdf.com/download/CuteWriter.exe and
    http://www.cutepdf.com/download/converter.exe then install the two. Then
    it's just like printing a document normally -- you go to file > print
    and select "cutePDF writer" as the printer and you will be asked what
    you want to save the PDF document as. Easy peasy.

    Of course, you could shell out a fortune for Acrobat or spend a few
    weeks learning LaTeX :D

    --
    Dylan Parry
    http://webpageworkshop.co.uk -- FREE Web tutorials and references
    Dylan Parry, Dec 3, 2004
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. David Williams
    Replies:
    2
    Views:
    1,108
    Jacob Yang [MSFT]
    Aug 12, 2003
  2. Ken Dopierala Jr.

    Do you use <table> or <asp:Table>?

    Ken Dopierala Jr., Jan 12, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    8,603
    Craig Deelsnyder
    Jan 13, 2004
  3. Earl Teigrob
    Replies:
    2
    Views:
    307
    Shintaro
    Feb 21, 2004
  4. Leonardo Gangemi
    Replies:
    0
    Views:
    304
    Leonardo Gangemi
    Apr 7, 2004
  5. Rio
    Replies:
    4
    Views:
    1,174
Loading...

Share This Page