php-windows Digest 26 Aug 2003 00:18:41 -0000 Issue 1886

Topics (messages 21235 through 21246):

Re: MS Word COM Object formatting
        21235 by: Sven Schnitzke

Session Vars
        21236 by: Dean Hayes
        21241 by: Disko_kex
        21242 by: Dean Hayes
        21246 by: Dean Hayes

Re: Array question
        21237 by: Warren Vail
        21238 by: Sek-Mun Wong
        21239 by: Disko_kex
        21240 by: Joachim

Re: please help with table again (Best book)
        21243 by: Donatas

More COM Issues
        21244 by: Herhuth, Ron

End of Page characters
        21245 by: Gerardo Rojas

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
Hi,
sadly enough it's not that easy. But it is possible:

$word->visible = 0;
$word->Options->ConfirmConversions = false; // menu: options->general->confirm 
conversions
// search for HTML Converter
$fcList = $word->FileConverters();
$count = $fcList->Count();
for($i=1; $i<=$count; $i++) {
   $fc = $fcList->Item($i);
   // go for ClassName, it's locale-independent
   if ($fc->ClassName() == 'HTML') break;
}

if ($i <= $count) {
  /* HTML Converter available
        Documents.Open FileName:="dl.php", ConfirmConversions:=True, ReadOnly:= _
        False, AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:= _
        "", Revert:=False, WritePasswordDocument:="", WritePasswordTemplate:="", _
        Format:=wdOpenFormatAuto  <- Here you specify the converters index
  */
        $word->Documents->Open ('anyfile.html', False, False, False, '', '', False, 
"", "", $fc->OpenFormat());
        $word->Documents[1]->SaveAs('anyfile.doc', wdFormatDocument);
        $word->Document[1]->Close();
        $word->Quit();
        $word->Release();
}

Some words of caution:
a) At least Word 8.0 (aka Word 97) is at least a little stupid when it comes to 
understanding HTML.
   So don't expect too much of the conversion of complicated formats.
b) Word tends to ask if you want it to update the converters over the internet. This 
question can and
   must be suppressed once in manually processing a convesion by checking "don't ask 
again" or else 
   word will hang while automatically opening the HTML file.
c) Ron, of course you can set any font spec using COM: a macro suggesting assignment 
of a property
    works just the same in COM. If you see 
...Name = "aName"
just make it
...->Name = 'aName';
   
happy hacking
-- 
Sven 
> -----Ursprüngliche Nachricht-----
> Von:  Chris Kranz [SMTP:[EMAIL PROTECTED]
> Gesendet am:  Freitag, 22. August 2003 15:07
> An:   [EMAIL PROTECTED]
> Betreff:      [PHP-WIN] Re: MS Word COM Object formatting
> 
> you should be able to ... in word ... open up the html page from word
> itself, and then save it as a word doc... thinking in my head, soemthing
> along the lines of...
> 
> $file="bios.html"
> $word=new COM("Word.Application") or die("Cannot start word for you");
> $word->visible =0 ;
> $word->Documents->Open($file);
> $word->Documents[1]->SaveAs("testwrite.doc");
> $word->Quit();
> 
> 
> in theory, should work... although i could be wrong...
> 
> 
> 
> -- 
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
Hey,


I have a script that needs to save the session id and username but when i use the following code it will not save anything to the session file, can anyone help out here? The same script use to work when i ran it under Win 98 and Mandrake Linux but since i have installed WinXP it stops working

<?Php

        session_start();
                session_register('id');
                        $id = $PHPSESSID;

                session_register('user_username');
                        $user_username = $form_username;

                session_register('user_pass');
                        $user_pass = $form_pass;

?>

Thanks

Dean "The Insane Guy" Hayes
Mystical Web Designs
http://www.mystical-sector.com

<-- I design and i redesign but still i never designed true beauty like you -->

_________________________________________________________________
ninemsn Extra Storage comes with McAfee Virus Scanning - to keep your Hotmail account and PC safe. Click here http://join.msn.com/

--- End Message ---
--- Begin Message ---
Try this instead:

Session_start();
        $_SESSION["id"] = $PHPSESSID;
        $_SESSION["user_name"] = $form_username;
        $_SESSION["user_pass"] = $form_pass;


print "$_SESSION[id], $_SESSION[user_name], $_SESSION[user_pass]";

// jocke


-----Original Message-----
From: Dean Hayes [mailto:[EMAIL PROTECTED] 
Sent: den 25 augusti 2003 09:23
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] Session Vars


Hey,

I have a script that needs to save the session id and username but when
i 
use the following code it will not save anything to the session file,
can 
anyone help out here? The same script use to work when i ran it under
Win 98 
and Mandrake Linux but since i have installed WinXP it stops working

<?Php

        session_start();
                session_register('id');
                        $id = $PHPSESSID;

                session_register('user_username');
                        $user_username = $form_username;

                session_register('user_pass');
                        $user_pass = $form_pass;

?>

Thanks

Dean "The Insane Guy" Hayes
Mystical Web Designs
http://www.mystical-sector.com

<-- I design and i redesign but still i never designed true beauty like
you 
-->

_________________________________________________________________
ninemsn Extra Storage comes with McAfee Virus Scanning - to keep your 
Hotmail account and PC safe. Click here  http://join.msn.com/

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
I used the code below with $_SESSION[] and i have been able to get the username and password to save to the session file but i get and error of


Notice: Undefined variable: PHPSESSID in c:\apache\htdocs\editor\index.php on line 4

can anyone tell me what this means

I am new to php and have only used sessions once before

Dean "The Insane Guy" Hayes
Mystical Web Designs
http://www.mystical-sector.com

<-- I design and i redesign but still i never designed true beauty like you -->





From: "Disko_kex" <[EMAIL PROTECTED]>
To: "'Dean Hayes'" <[EMAIL PROTECTED]>,<[EMAIL PROTECTED]>
Subject: RE: [PHP-WIN] Session Vars
Date: Mon, 25 Aug 2003 12:33:50 +0200

Try this instead:

Session_start();
        $_SESSION["id"] = $PHPSESSID;
        $_SESSION["user_name"] = $form_username;
        $_SESSION["user_pass"] = $form_pass;


print "$_SESSION[id], $_SESSION[user_name], $_SESSION[user_pass]";


// jocke


-----Original Message----- From: Dean Hayes [mailto:[EMAIL PROTECTED] Sent: den 25 augusti 2003 09:23 To: [EMAIL PROTECTED] Subject: [PHP-WIN] Session Vars


Hey,


I have a script that needs to save the session id and username but when
i
use the following code it will not save anything to the session file,
can
anyone help out here? The same script use to work when i ran it under
Win 98
and Mandrake Linux but since i have installed WinXP it stops working

<?Php

        session_start();
                session_register('id');
                        $id = $PHPSESSID;

                session_register('user_username');
                        $user_username = $form_username;

                session_register('user_pass');
                        $user_pass = $form_pass;

?>

Thanks

Dean "The Insane Guy" Hayes
Mystical Web Designs
http://www.mystical-sector.com

<-- I design and i redesign but still i never designed true beauty like
you
-->

_________________________________________________________________
ninemsn Extra Storage comes with McAfee Virus Scanning - to keep your
Hotmail account and PC safe. Click here  http://join.msn.com/

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

_________________________________________________________________
ninemsn Extra Storage comes with McAfee Virus Scanning - to keep your Hotmail account and PC safe. Click here http://join.msn.com/

--- End Message ---
--- Begin Message ---
Thanks i fixed the problem i used Zone Alarm Pro With Web Filtering and it disables all cookies even session cookies so instead of PHPSESSID i udes the function session_id() it took me awhile to find out about it on the site but it all works now




Dean "The Insane Guy" Hayes
Mystical Web Designs
http://www.mystical-sector.com

<-- I design and i redesign but still i never designed true beauty like you -->





From: "Disko_kex" <[EMAIL PROTECTED]>
To: "'Dean Hayes'" <[EMAIL PROTECTED]>,<[EMAIL PROTECTED]>
Subject: RE: [PHP-WIN] Session Vars
Date: Mon, 25 Aug 2003 12:33:50 +0200

Try this instead:

Session_start();
        $_SESSION["id"] = $PHPSESSID;
        $_SESSION["user_name"] = $form_username;
        $_SESSION["user_pass"] = $form_pass;


print "$_SESSION[id], $_SESSION[user_name], $_SESSION[user_pass]";


// jocke


-----Original Message----- From: Dean Hayes [mailto:[EMAIL PROTECTED] Sent: den 25 augusti 2003 09:23 To: [EMAIL PROTECTED] Subject: [PHP-WIN] Session Vars


Hey,


I have a script that needs to save the session id and username but when
i
use the following code it will not save anything to the session file,
can
anyone help out here? The same script use to work when i ran it under
Win 98
and Mandrake Linux but since i have installed WinXP it stops working

<?Php

        session_start();
                session_register('id');
                        $id = $PHPSESSID;

                session_register('user_username');
                        $user_username = $form_username;

                session_register('user_pass');
                        $user_pass = $form_pass;

?>

Thanks

Dean "The Insane Guy" Hayes
Mystical Web Designs
http://www.mystical-sector.com

<-- I design and i redesign but still i never designed true beauty like
you
-->

_________________________________________________________________
ninemsn Extra Storage comes with McAfee Virus Scanning - to keep your
Hotmail account and PC safe. Click here  http://join.msn.com/

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

_________________________________________________________________
Hotmail is now available on Australian mobile phones. Go to http://ninemsn.com.au/mobilecentral/signup.asp

--- End Message ---
--- Begin Message ---
in my experience, using numeric indices to your array, you can deposit and
reference occurances as follows;  however your reference is not a valid
array definition;

[0] => 1 [1] => 2 [2] => 3 ... [99] => 100  (I don't believe these are valid
as a definition)

numeric indices would be defined as follows;

array(0 => 1, 1 => 2, 2 => 3  ....  99 => 100);

$x = $dataarray[50];

$dataarray[50 - 2] = $x;
$dataarray[50 + 1] = $x;

if($dataarray[71] == 74) do this....

On the other hand, if the indices is alpha-numeric string representations of
numbers,

array("0" => 1, "1" => 2, "2" => 3 ... "99" => 100)

you will need to use some other tricks to access them.

hope this is what you are looking for, you used several terms like "select"
and "know the value" of that are somewhat ambiguous ;-)

Warren Vail
[EMAIL PROTECTED]


-----Original Message-----
From: Disko_kex [mailto:[EMAIL PROTECTED]
Sent: Sunday, August 24, 2003 11:59 PM
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] Array question


If I have an array like this > [0] => 1 [1] => 2 [2] => 3 ... [99] =>
100

If I want to select [50] => 51 and store the value that's 2 positions
before and 1 position after, how can I do?

If I want to know what position value 71 have?


I have search the PHP-manual and found some functions as prev, next, pos
etc. But with these commands I have to loop thru the array every time to
reach the the values and positions. It has to be an easier way to do it.

// jocke

--- End Message ---
--- Begin Message ---
hi again jocke... seems i'll give a go at answering your questions again ;-)

If I understand your question properly, I doubt the previous poster's
response would be useful to you.

The bad news (I think): there are limited functions that deal with array
pointers. There are plenty to deal with arrays themselves.

as you've noted: pos, next, prev seem to be the only way to deal with a
pointer, so yes, the way that I implemented my solution was to use next and
pos to get the positioning and in doing so, reading the *entire array*
(yuck) and storing into a new array based on conditions.

option 1) I haven't tried, so I'm not sure if array_search (for key) and
in_array (for value) move the pointer - maybe you could try those. (gut feel
is they don't). If they do, then you can for loop a prev/next to get what
you want.

option 2) I guess you could actually use integers as your index and have
them sort-ed (or array_push them on) that might solve your problem, but I
think that's a bit of a kludge. (ie, implicitly using the array key value as
a pointer)

option 3) So.... the only way I found was to loop thru the whole array, it's
messy for large sets, but if your array size is only 100 (I doubt it is) it
may be ok. It seems excessive though.

looping thru the entire set might not be too bad, I assume that's what an
array_search might be doing as well(?) so you're not saving any more time
even if that works.

Anyhow, tell me if you find another method... i'll go off and do more
research on it now too.

"Disko_kex" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> If I have an array like this > [0] => 1 [1] => 2 [2] => 3 ... [99] =>
> 100
>
> If I want to select [50] => 51 and store the value that's 2 positions
> before and 1 position after, how can I do?
>
> If I want to know what position value 71 have?
>
>
> I have search the PHP-manual and found some functions as prev, next, pos
> etc. But with these commands I have to loop thru the array every time to
> reach the the values and positions. It has to be an easier way to do it.
>
> // jocke
>

--- End Message ---
--- Begin Message ---
Well its not exactly what I was looking for but you gave me some ideas,
but still got this small problem:

If I know the value in the array, say for example 49. Then I want to
store the previous and next value in the array? I know the other way
when I have the position, just use pos($dataarray) then like you sad
$dataarray($key+1), that's easy. But the other way????


-----Original Message-----
From: Warren Vail [mailto:[EMAIL PROTECTED] 
Sent: den 25 augusti 2003 09:33
To: Disko_kex; [EMAIL PROTECTED]
Subject: RE: [PHP-WIN] Array question

in my experience, using numeric indices to your array, you can deposit
and
reference occurances as follows;  however your reference is not a valid
array definition;

[0] => 1 [1] => 2 [2] => 3 ... [99] => 100  (I don't believe these are
valid
as a definition)

numeric indices would be defined as follows;

array(0 => 1, 1 => 2, 2 => 3  ....  99 => 100);

$x = $dataarray[50];

$dataarray[50 - 2] = $x;
$dataarray[50 + 1] = $x;

if($dataarray[71] == 74) do this....

On the other hand, if the indices is alpha-numeric string
representations of
numbers,

array("0" => 1, "1" => 2, "2" => 3 ... "99" => 100)

you will need to use some other tricks to access them.

hope this is what you are looking for, you used several terms like
"select"
and "know the value" of that are somewhat ambiguous ;-)

Warren Vail
[EMAIL PROTECTED]


-----Original Message-----
From: Disko_kex [mailto:[EMAIL PROTECTED]
Sent: Sunday, August 24, 2003 11:59 PM
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] Array question


If I have an array like this > [0] => 1 [1] => 2 [2] => 3 ... [99] =>
100

If I want to select [50] => 51 and store the value that's 2 positions
before and 1 position after, how can I do?

If I want to know what position value 71 have?


I have search the PHP-manual and found some functions as prev, next, pos
etc. But with these commands I have to loop thru the array every time to
reach the the values and positions. It has to be an easier way to do it.

// jocke

--- End Message ---
--- Begin Message ---
// This is how I would do it. The first question is easily solved by putting
a mathematical
// expression inside the array brackets.

$selectIndex = 50; // The index you're interested in

$selectedValue = yourArray[$select];
$selectedValueMinus2 = yourArray[$select-2];
$selectedValuePlus1 = yourArray[$select+1];

// The second problem would force me to loop through the array, though.

$selectValue = 71; // The value you want to look for

$sizeOfArray = count($yourArray); // Number of elements in your array

// Search through the array for the value you want, break when found
for($i=0;$i<$sizeOfArray;$i++){
        if($yourArray[$i]==$selectValue)
                break;
}

// $i contains the position of the value in the array

// Lycka till!

// Joachim

-----Ursprungligt meddelande-----
Fran: Disko_kex [mailto:[EMAIL PROTECTED]
Skickat: den 25 augusti 2003 08:59
Till: [EMAIL PROTECTED]
Amne: [PHP-WIN] Array question


If I have an array like this > [0] => 1 [1] => 2 [2] => 3 ... [99] =>
100

If I want to select [50] => 51 and store the value that's 2 positions
before and 1 position after, how can I do?

If I want to know what position value 71 have?


I have search the PHP-manual and found some functions as prev, next, pos
etc. But with these commands I have to loop thru the array every time to
reach the the values and positions. It has to be an easier way to do it.

// jocke

--- End Message ---
--- Begin Message ---
"PHP and MySQL Web Development" by Luke Welling and Laura Thomson

I read only 250 of this book but it gave me marvelous introduction to PHP
and MySQL. After reading those pages I started doing some eproject and now I
feel very comfortable with PHP.

Btw, I knew some Pascal and C++ already and that helped a lot as I was
familiar with basic programming concepts.

> Since you mentioned it, what do you think is the best entry level book
> for programming PHP? I'd like to hear others opinions as well.
> 
> -----Original Message-----
> From: Svensson, B.A.T. (HKG) [mailto:[EMAIL PROTECTED]
> Sent: Sunday, August 24, 2003 8:41 AM
> To: 'Thomas Edward Lawrence '; '[EMAIL PROTECTED] '
> Subject: RE: [PHP-WIN] please help with table again
> 
> 
> Are you trying to solve a particular problem or
> do you want to learn to do programing?
> 
> I don't want to be rude, but the question you ask are
> fairly basic programming knowledge, and I would recommend
> you to get a good beginners book on programming.
> 
> Anyway, on to your question:
> 
> If you want to write a table, but alos need to manipulte
> the contents in each field, then you need to make two itterations, e.g.
> loops.
> 
> The outer loop will control how many rows you have, and the inner will
> control how many columns you have. If you want to manipulate the each
> values in the table it has to be done in the inner loop.
> 
> The outer loop value will tell you wich row you currently working on,
> and the inner loop value will tell you wich column you work with. Just
> like a X-Y cordinate system.
> 
> For instance if you want a fixed value, different for each, rows, then
> reuse the outer loops incrementer) and display this value.
> 
> If you want to increase the numbers all the time, then locate and
> incrementor in the inner loop and display this value.
> 
> And finaly as an exercice you should try to modify the code
> so it displays the numbers a) in revers order, b) up-down and top left,
> c) and rotate the matrix 90 degrees, e.g make it a 5 rows x 3 cols
> matris and display the numbers just as they are in the 3x5 matrix, but
> rotated.
> 
> If you solve these three problem you will be much more confident and
> better suited in handling itterations afterwards.
> 
> Kind reagrds,
> 
>         //Anders
> 
> 
> -----Original Message-----
> From: Thomas Edward Lawrence
> To: [EMAIL PROTECTED]
> Sent: 2003-08-24 06:57
> Subject: [PHP-WIN] please help with table again
> 
> I want  it echo 5 columns with 3 row , but it also echo numbers which
> increase to follow columns like this  , how I must write  , please show
> me again , thank  you .
> 
> 1    2    3    4    5
> 6    7    8    9    10
> 11    12    13    14    15
> 
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
I have created a snazzy little PHP widget that creats an actual hard HTML
page from a bunch of included pages and saves it as a temp.html file on
the server.  The app then invokes MS Word's COM object and opens the HTML
file, converts it to a Word doc and then creates a link to it.  The
problem I'm having is a bit odd...I can see that the doc is indeed getting
created in the right directory, it opens and displays exactly as expected
if I open it from the directory...but the link to the file doesn't open
the file...it simply hangs trying to open the doc.  Subsequent attempts to
open the file using the link results in a page not found error.

I have double, triple checked the directory to the file on the server,
that checks out okay.  The file does exist and opens fine when i navigate
to the drive that contains the directory.

Does anyone have any possible ideas of why the file wouldn't be opening
using a link?

COM Related Code:

$fileName = "testwrite.html";
$fp = fopen($fileName,"r+")or die("Could not open file");
fwrite($fp,$htmlContent);
fclose($fp);


$filePath = "D:/public/TatumPartnersQA/testwrite.html";

@$word = new COM("Word.Application") or die("Unable to instanciate Word");

$word->visible = 0;
$word->Options->ConfirmConversions = false;

$word->Documents->Open($filePath);
$word->Documents[1]->SaveAs('D:/public/WordResources/testwrite4.doc');
$word->Documents[1]->Close();
$word->Quit();
$word->Release();

echo "<a
href='http://www.tatumpartners.net/public/WordResources/testwrite2.doc'
target='_new'>word file</a>";

--- End Message ---
--- Begin Message ---
Quick question:  Is there any special characters that make up a Page Break in MS Word? 
 I know that "\r\n" make a line break and carriage return.  Is there anything for Page 
Break?


--
Gerardo S. Rojas
mailto:[EMAIL PROTECTED]


--- End Message ---

Reply via email to