<font size="-1">

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • teser3@hotmail.com

    <font size="-1">

    I can put out a Word Doc from PHP but if I try and manipulate the font
    size in the PHP part it outputs a blank Word Document.

    Here is what I have:
    <?php
    $fname="report. doc";
    $handle = fopen( $fname, "rb" );
    $buf = fread( $handle, filesize( $fname ));
    fclose( $handle );
    $len = strlen( $buf );
    header( "Pragma: public" );
    header( "Cache-Control: private" );
    header( "Connection : close" );
    header( "Content-Type: application/msword" );
    header( "Content-Length: $len" );
    header( "Content-Disposition: inline; filename=\"$fna me\"" );
    print $buf;
    >
    <table border="1">
    <tr>
    <td>FieldOneHea der</td>
    <td>FieldTwoHea der</td>
    <td>FieldThreeH eader</td>
    ....
    <td>FieldTenHea der</td>
    </tr>
    <?php
    //Oracle DB Connection username and password etc here

    $s = OCIParse($conne ction. "select * from theTable");
    OCIExecute($s, OCI_DEFAULT);
    while (OCIFetch($s)) {
    print '<tr><td><font size="-1">' . ociresult($s, "FIELDONENA ME") .
    '</font></td>';
    print '<td><font size="-1">' . ociresult($s, "FIELDTWONAME") . '</
    font></td>';
    print '<td><font size="-1">' . ociresult($s, "FIELDTHREENAME "). '</
    font></td>';
    print '<td><font size="-1">' . ociresult($s, "FIELDFOURNAME" ). '</
    font></td>';
    print '<td><font size="-1">' . ociresult($s, "FIELDFIVENAME" ). '</
    font></td>';
    //rest here .......
    print '<td><font size="-1">' . ociresult($s, "FIELDNINENAME" ). '</
    font></td>';
    print '<td><font size="-1">' . ociresult($s, "FIELDTENNAME") . '</
    font></td></tr>';
    }
    print '</table>';


    ?>


    The wierd part is if I only put font size in the first 5 fields it
    will work:
    print '<tr><td><font size="-1">' . ociresult($s, "FIELDONENA ME") .
    '</font></td>';
    print '<td><font size="-1">' . ociresult($s, "FIELDTWONAME") . '</
    font></td>';
    print '<td><font size="-1">' . ociresult($s, "FIELDTHREENAME "). '</
    font></td>';
    print '<td><font size="-1">' . ociresult($s, "FIELDFOURNAME" ). '</
    font></td>';
    print '<td><font size="-1">' . ociresult($s, "FIELDFIVENAME" ). '</
    font></td>';
    //rest here .......
    print '<td>' . ociresult($s, "FIELDNINENAME" ). '</td>';
    print '<td>' . ociresult($s, "FIELDTENNAME") . '</td></tr>';



    Please advise.

  • =?ISO-8859-15?Q?Iv=E1n_S=E1nchez_Ortega?=

    #2
    Re: &lt;font size=&quot;-1&quot;&gt;

    teser3@hotmail. com wrote:
    I can put out a Word Doc from PHP but if I try and manipulate the font
    size in the PHP part it outputs a blank Word Document.
    No; you are outputting HTML, not a MS Office document.

    The problem is about MS Word's HTML parser, not about PHP.

    --
    ----------------------------------
    Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-

    http://acm.asoc.fi.upm.es/~mr/ ; http://acm.asoc.fi.upm.es/~ivan/
    MSN:i_eat_s_p_a _m_for_breakfas t@hotmail.com
    Jabber:ivansanc hez@jabber.org ; ivansanchez@kde talk.net

    Comment

    • Michael Fesser

      #3
      Re: &lt;font size=&quot;-1&quot;&gt;

      ..oO(teser3@hot mail.com)
      >I can put out a Word Doc from PHP but if I try and manipulate the font
      >size in the PHP part it outputs a blank Word Document.
      >
      >Here is what I have:
      ><?php
      $fname="report. doc";
      $handle = fopen( $fname, "rb" );
      $buf = fread( $handle, filesize( $fname ));
      fclose( $handle );
      file_get_conten ts() exists.
      $len = strlen( $buf );
      header( "Pragma: public" );
      'Pragma' is a request header, usage in a response is not defined.
      Additionally the only defined directive for this header is 'no-cache'.
      header( "Cache-Control: private" );
      header( "Connection : close" );
      header( "Content-Type: application/msword" );
      header( "Content-Length: $len" );
      header( "Content-Disposition: inline; filename=\"$fna me\"" );
      print $buf;
      >>
      ><table border="1">
      ><tr>
      >[...]
      Now I'm confused - do you want to output the .doc document _and_ the
      following together on the same page? That's not going to work.

      Micha

      Comment

      • =?ISO-8859-15?Q?Iv=E1n_S=E1nchez_Ortega?=

        #4
        Re: &lt;font size=&quot;-1&quot;&gt;

        Michael Fesser wrote:
        > header( "Content-Type: application/msword" );
        > header( "Content-Disposition: inline; filename=\"$fna me\"" );
        Now I'm confused - do you want to output the .doc document _and_ the
        following together on the same page? That's not going to work.
        No - He's forcing MS Word to open, then feeding HTML to it. He's not feeding
        Word anything else.

        --
        ----------------------------------
        Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-

        Funciona mejor si lo enchufas

        Comment

        • Michael Fesser

          #5
          Re: &lt;font size=&quot;-1&quot;&gt;

          ..oO(Iván Sánchez Ortega)
          >Michael Fesser wrote:
          >
          >> header( "Content-Type: application/msword" );
          >> header( "Content-Disposition: inline; filename=\"$fna me\"" );
          >
          >Now I'm confused - do you want to output the .doc document _and_ the
          >following together on the same page? That's not going to work.
          >
          >No - He's forcing MS Word to open, then feeding HTML to it. He's not feeding
          >Word anything else.
          Hmm, but he opens and sends a .doc file, followed by some ugly HTML ...

          Micha

          Comment

          • =?ISO-8859-15?Q?Iv=E1n_S=E1nchez_Ortega?=

            #6
            Re: &lt;font size=&quot;-1&quot;&gt;

            Michael Fesser wrote:
            Hmm, but he opens and sends a .doc file, followed by some ugly HTML ...
            WTF???!!!

            --
            ----------------------------------
            Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-

            http://acm.asoc.fi.upm.es/~mr/ ; http://acm.asoc.fi.upm.es/~ivan/
            MSN:i_eat_s_p_a _m_for_breakfas t@hotmail.com
            Jabber:ivansanc hez@jabber.org ; ivansanchez@kde talk.net

            Comment

            • Vladimir Ghetau

              #7
              Re: &lt;font size=&quot;-1&quot;&gt;

              On Jun 14, 12:36 am, "tes...@hotmail .com" <tes...@hotmail .comwrote:
              I can put out a Word Doc from PHP but if I try and manipulate the font
              size in the PHP part it outputs a blank Word Document.
              >
              Here is what I have:
              <?php
              $fname="report. doc";
              $handle = fopen( $fname, "rb" );
              $buf = fread( $handle, filesize( $fname ));
              fclose( $handle );
              $len = strlen( $buf );
              header( "Pragma: public" );
              header( "Cache-Control: private" );
              header( "Connection : close" );
              header( "Content-Type: application/msword" );
              header( "Content-Length: $len" );
              header( "Content-Disposition: inline; filename=\"$fna me\"" );
              print $buf;
              >
              <table border="1">
              <tr>
              <td>FieldOneHea der</td>
              <td>FieldTwoHea der</td>
              <td>FieldThreeH eader</td>
              ...
              <td>FieldTenHea der</td>
              </tr>
              <?php
              //Oracle DB Connection username and password etc here
              >
              $s = OCIParse($conne ction. "select * from theTable");
              OCIExecute($s, OCI_DEFAULT);
              while (OCIFetch($s)) {
              print '<tr><td><font size="-1">' . ociresult($s, "FIELDONENA ME") .
              '</font></td>';
              print '<td><font size="-1">' . ociresult($s, "FIELDTWONAME") . '</
              font></td>';
              print '<td><font size="-1">' . ociresult($s, "FIELDTHREENAME "). '</
              font></td>';
              print '<td><font size="-1">' . ociresult($s, "FIELDFOURNAME" ). '</
              font></td>';
              print '<td><font size="-1">' . ociresult($s, "FIELDFIVENAME" ). '</
              font></td>';
              //rest here .......
              print '<td><font size="-1">' . ociresult($s, "FIELDNINENAME" ). '</
              font></td>';
              print '<td><font size="-1">' . ociresult($s, "FIELDTENNAME") . '</
              font></td></tr>';}
              >
              print '</table>';
              >
              ?>
              >
              The wierd part is if I only put font size in the first 5 fields it
              will work:
              print '<tr><td><font size="-1">' . ociresult($s, "FIELDONENA ME") .
              '</font></td>';
              print '<td><font size="-1">' . ociresult($s, "FIELDTWONAME") . '</
              font></td>';
              print '<td><font size="-1">' . ociresult($s, "FIELDTHREENAME "). '</
              font></td>';
              print '<td><font size="-1">' . ociresult($s, "FIELDFOURNAME" ). '</
              font></td>';
              print '<td><font size="-1">' . ociresult($s, "FIELDFIVENAME" ). '</
              font></td>';
              //rest here .......
              print '<td>' . ociresult($s, "FIELDNINENAME" ). '</td>';
              print '<td>' . ociresult($s, "FIELDTENNAME") . '</td></tr>';
              >
              Please advise.



              Why don't you use this:

              Download PHP Dynamic Word/Excel Generator for free. An ultra easy-to-use php code for creating dynamic MS Word OR Excel files from a MySQL database query. Suitable for beginners to use.




              Sounds a lot better than trying to force things . Some people may have
              no Word installed, this would suck with Doc headers for HTML.


              Cheers!


              Vladimir

              Comment

              • Tim Roberts

                #8
                Re: &lt;font size=&quot;-1&quot;&gt;

                Iván Sánchez Ortega <ivansanchez-alg@rroba-escomposlinux.-.punto.-.org>
                wrote:
                >Michael Fesser wrote:
                >
                >> header( "Content-Type: application/msword" );
                >> header( "Content-Disposition: inline; filename=\"$fna me\"" );
                >
                >Now I'm confused - do you want to output the .doc document _and_ the
                >following together on the same page? That's not going to work.
                >
                >No - He's forcing MS Word to open, then feeding HTML to it. He's not feeding
                >Word anything else.
                Yes, he is. I think you missed the "print $buf;" statement, where he
                copies a Word document to stdout.

                Note, however, that Internet Explorer does not trust the Content-Type; it
                will often examine the first part of the file to determine how to process
                it.
                --
                Tim Roberts, timr@probo.com
                Providenza & Boekelheide, Inc.

                Comment

                • teser3@hotmail.com

                  #9
                  Re: &lt;font size=&quot;-1&quot;&gt;

                  "No - He's forcing MS Word to open, then feeding HTML to it. He's not
                  feeding
                  Word anything else.

                  Hmm, but he opens and sends a .doc file, followed by some ugly
                  HTML ... "


                  I am forcing the MS Word to open and feeding Oracle Database records
                  with HTML into it.
                  It works until I get to over 25 records and then it doesnt show
                  anything on the page.
                  Please advise how I can get a Word Document to open from a PHP web
                  page where it shows all the Database records because the way I am
                  doing it doesnt work when I get over 25 records.

                  I am in an environment where I cant download any foreign software so I
                  need to do it using PHP code.
                  Please advise.

                  Comment

                  • teser3@hotmail.com

                    #10
                    Re: &lt;font size=&quot;-1&quot;&gt;




                    ---------- Forwarded message ----------
                    From: "tes...@hotmail .com" <tes...@hotmail .com>
                    Date: Jun 15, 8:03 pm
                    Subject: <font size="-1">
                    To: comp.lang.php


                    "No - He's forcing MS Word to open, then feeding HTML to it. He's not
                    feeding
                    Word anything else.

                    Hmm, but he opens and sends a .doc file, followed by some ugly
                    HTML ... "

                    I am forcing the MS Word to open and feeding Oracle Database records
                    with HTML into it.
                    It works until I get to over 25 records and then it pops open a Word
                    Document that is blank.
                    Please advise how I can get a Word Document to open from a PHP web
                    page where it shows all the Database records because the way I am
                    doing it doesnt work when I get over 25 records.

                    I am in an environment where I cant download any foreign software so I
                    need to do it using PHP code.
                    Please advise.

                    Comment

                    • Michael Fesser

                      #11
                      Re: &lt;font size=&quot;-1&quot;&gt;

                      ..oO(teser3@hot mail.com)
                      >I am forcing the MS Word to open and feeding Oracle Database records
                      >with HTML into it.
                      >It works until I get to over 25 records and then it doesnt show
                      >anything on the page.
                      I'm surprised you see anything at all. From Word's point of view you're
                      sending an invalid document. It's like taking an image file, appending
                      some random bytes to it and then expecting the image viewer to still
                      recognize it as an image.
                      >Please advise how I can get a Word Document to open from a PHP web
                      >page where it shows all the Database records because the way I am
                      >doing it doesnt work when I get over 25 records.
                      Well, you would have to create that Word document on the server and then
                      deliver it to the browser ...

                      Or maybe Word is capable of recognizing plain HTML? Then all you would
                      have to do is to send an appropriate Content-Type header (as you already
                      do), followed by the HTML content. No reason to send any .doc file.

                      Micha

                      Comment

                      • Jerry Stuckle

                        #12
                        Re: &lt;font size=&quot;-1&quot;&gt;

                        teser3@hotmail. com wrote:
                        "No - He's forcing MS Word to open, then feeding HTML to it. He's not
                        feeding
                        Word anything else.
                        >
                        Hmm, but he opens and sends a .doc file, followed by some ugly
                        HTML ... "
                        >
                        >
                        I am forcing the MS Word to open and feeding Oracle Database records
                        with HTML into it.
                        It works until I get to over 25 records and then it doesnt show
                        anything on the page.
                        Please advise how I can get a Word Document to open from a PHP web
                        page where it shows all the Database records because the way I am
                        doing it doesnt work when I get over 25 records.
                        >
                        I am in an environment where I cant download any foreign software so I
                        need to do it using PHP code.
                        Please advise.
                        >
                        Forget about Word and create correct HTML that any browser can understand.

                        --
                        =============== ===
                        Remove the "x" from my email address
                        Jerry Stuckle
                        JDS Computer Training Corp.
                        jstucklex@attgl obal.net
                        =============== ===

                        Comment

                        • teser3@hotmail.com

                          #13
                          Re: &lt;font size=&quot;-1&quot;&gt;

                          On Jun 15, 9:26 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
                          tes...@hotmail. com wrote:
                          "No - He's forcing MS Word to open, then feeding HTML to it. He's not
                          feeding
                          Word anything else.
                          >
                          Hmm, but he opens and sends a .doc file, followed by some ugly
                          HTML ... "
                          >
                          I am forcing the MS Word to open and feeding Oracle Database records
                          with HTML into it.
                          It works until I get to over 25 records and then it doesnt show
                          anything on the page.
                          Please advise how I can get a Word Document to open from a PHP web
                          page where it shows all the Database records because the way I am
                          doing it doesnt work when I get over 25 records.
                          >
                          I am in an environment where I cant download any foreign software so I
                          need to do it using PHP code.
                          Please advise.
                          >
                          Forget about Word and create correct HTML that any browser can understand.
                          >
                          --
                          =============== ===
                          Remove the "x" from my email address
                          Jerry Stuckle
                          JDS Computer Training Corp.
                          jstuck...@attgl obal.net
                          =============== ===- Hide quoted text -
                          >
                          - Show quoted text -
                          Okay, I guess the main thing is how do I create a Print Friendly
                          report? I was using Word Doc so I oould create a Printer Friendly
                          report that could be seen in Word Document and also downloaded as a
                          Word Document.

                          Comment

                          • Jerry Stuckle

                            #14
                            Re: &lt;font size=&quot;-1&quot;&gt;

                            teser3@hotmail. com wrote:
                            On Jun 15, 9:26 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
                            >tes...@hotmail .com wrote:
                            >>"No - He's forcing MS Word to open, then feeding HTML to it. He's not
                            >>feeding
                            >>Word anything else.
                            >>Hmm, but he opens and sends a .doc file, followed by some ugly
                            >>HTML ... "
                            >>I am forcing the MS Word to open and feeding Oracle Database records
                            >>with HTML into it.
                            >>It works until I get to over 25 records and then it doesnt show
                            >>anything on the page.
                            >>Please advise how I can get a Word Document to open from a PHP web
                            >>page where it shows all the Database records because the way I am
                            >>doing it doesnt work when I get over 25 records.
                            >>I am in an environment where I cant download any foreign software so I
                            >>need to do it using PHP code.
                            >>Please advise.
                            >Forget about Word and create correct HTML that any browser can understand.
                            >>
                            >--
                            >============== ====
                            >Remove the "x" from my email address
                            >Jerry Stuckle
                            >JDS Computer Training Corp.
                            >jstuck...@attg lobal.net
                            >============== ====- Hide quoted text -
                            >>
                            >- Show quoted text -
                            >
                            Okay, I guess the main thing is how do I create a Print Friendly
                            report? I was using Word Doc so I oould create a Printer Friendly
                            report that could be seen in Word Document and also downloaded as a
                            Word Document.
                            >
                            If you need to create something which is exact, create a PDF.
                            Otherwise, code good html and CSS to make your pages fluid. For the
                            latter, try alt.html for help.



                            --
                            =============== ===
                            Remove the "x" from my email address
                            Jerry Stuckle
                            JDS Computer Training Corp.
                            jstucklex@attgl obal.net
                            =============== ===

                            Comment

                            • teser3@hotmail.com

                              #15
                              Re: &lt;font size=&quot;-1&quot;&gt;

                              On Jun 16, 8:16 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
                              tes...@hotmail. com wrote:
                              On Jun 15, 9:26 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
                              tes...@hotmail. com wrote:
                              >"No - He's forcing MS Word to open, then feeding HTML to it. He's not
                              >feeding
                              >Word anything else.
                              >Hmm, but he opens and sends a .doc file, followed by some ugly
                              >HTML ... "
                              >I am forcing the MS Word to open and feeding Oracle Database records
                              >with HTML into it.
                              >It works until I get to over 25 records and then it doesnt show
                              >anything on the page.
                              >Please advise how I can get a Word Document to open from a PHP web
                              >page where it shows all the Database records because the way I am
                              >doing it doesnt work when I get over 25 records.
                              >I am in an environment where I cant download any foreign software so I
                              >need to do it using PHP code.
                              >Please advise.
                              Forget about Word and create correct HTML that any browser can understand.
                              >
                              --
                              =============== ===
                              Remove the "x" from my email address
                              Jerry Stuckle
                              JDS Computer Training Corp.
                              jstuck...@attgl obal.net
                              =============== ===- Hide quoted text -
                              >
                              - Show quoted text -
                              >
                              Okay, I guess the main thing is how do I create a Print Friendly
                              report? I was using Word Doc so I oould create a Printer Friendly
                              report that could be seen in Word Document and also downloaded as a
                              Word Document.
                              >
                              If you need to create something which is exact, create a PDF.
                              Otherwise, code good html and CSS to make your pages fluid. For the
                              latter, try alt.html for help.
                              >
                              --
                              =============== ===
                              Remove the "x" from my email address
                              Jerry Stuckle
                              JDS Computer Training Corp.
                              jstuck...@attgl obal.net
                              =============== ===- Hide quoted text -
                              >
                              - Show quoted text -
                              Thanks, I was also trying to find info on PHP to PDF but cant seem to
                              find anything on that.
                              I would like to output my Oracle records using PHP to PDF report.
                              Please advise.

                              Comment

                              Working...