SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Wizard Wolf_22's Avatar
    Join Date
    Jul 2005
    Posts
    1,710
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Using COM with Excel...

    I'm having a hard time "targeting" the row within an Excel file I've managed to create using COM. I thought it would be the following:
    $cell->Rows(1,1)->RowHeight = "51";

    ...but it didn't work, nor did various other attempts...

    What's a basic procedure (using PHP 5) to change a row's height value prior to write out? Here's what I have so far:

    PHP Code:
    ...
    $sheet->activate;
    $cells=$sheet->Range('A1','C1')->Merge;
    $cell=$sheet->Cells(1,1);
    $cell->value $name;
    $cell->WrapText "True";
    Rows(1)->RowHeight 51.75;//something wrong... 
    Any help with this is appreciated.

  2. #2
    SitePoint Wizard Wolf_22's Avatar
    Join Date
    Jul 2005
    Posts
    1,710
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So I managed to find the solution (albeit possibly inefficient, etc.):
    PHP Code:
    $column_a->ColumnWidth '2'
    Where $column_a is a Range of cells. If anyone has a better way of doing this, however, by all means...

    So anyway, I guess my original code was correct? I think something that occurred in doing this for me had to do with how messy the memory management was / is for using PHP and Excel. I noticed in my Taskmanager that I had MANY instances of Excel running and when I would go to "refresh" my page, it would nosedive. After eliminating those erroneous instances, it then seemed to work...

    Now I just need to know how to center text horizontally in a cell. Anyone?


Bookmarks

Posting Permissions

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