Search code examples
phpms-wordcom

Table padding using the MS Word COM object in PHP


I've got some code here that will create a basic table in a Word document using PHP, it creates the table and populates it just fine, but I really need to shunt the table across so that the address (first box of the table) fits into a windowed envelope!

    $word->ActiveDocument->Tables->Add ( $word->Selection->Range, 1, 3 ); //creates table with 3 columns

    $word->Selection->TypeText ( $pretext [0] );
    $word->Selection->MoveRight (); //move to next column
    $word->Selection->TypeText ( $pretext [1] );
    $word->Selection->MoveRight (); //move to next column
    $word->Selection->TypeText ( $pretext [2] );
    $word->Selection->MoveRight (); //move off the table

Any suggestions would be fantastic - it seems really difficult to find any decent documentation for this online.


Solution

  • The properties are RightPadding, TopPadding and so on.

    You find the Reference at MSDN (choose the used version, the link points to Word2003 )