Forum Moderators: coopster

Message Too Old, No Replies

Spreadsheet Excel Writer Question

Can you do vertical text in Spreadsheet_Excel_Writer

         

hughie

9:27 am on Dec 5, 2007 (gmt 0)

10+ Year Member



Hi There

I need to generate a tightly formated excel file from PHP, i've come across PEAR:Spreadsheet_Excel_Writer and it looks interesting.

However the main crux is the ability to merge cells vertically (which i don't think is a problem) and have text written vertically in them.

E.g.

C - Cell B
E - Cell C
L - Cell D
L - Cell E

A

And so on. ( i also need to the text to be flipped 90 degrees as well but can't display that here)

Has anyone got experience with this and is it possible?

Cheers
Hugh

coopster

3:34 pm on Dec 7, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Just thinking out loud here ...

If you wanted to have the first cell contain grouped information, you could always use double quotation marks as string delimiters. So, your first cell you might store as:

$cell1 = "C\nE\n\L\nL";

However, I am not certain how MS Excel will handle that upon import. You would have to test.

hughie

9:59 pm on Dec 7, 2007 (gmt 0)

10+ Year Member



Hi Coopster, thanks for not letting this one drop ;-)

Its not the vertical text that's the issue, its the vertical cell merge and rotating text that would be lovely but it's probably too much to ask.

I'm going to see if i can find a compromise before i do any major work on it.

coopster

4:24 pm on Dec 11, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Oh, I think I understand what you are saying now. For example, ...

+---+--------+
¦ C ¦ Cell B ¦
¦ ¦--------¦
¦ E ¦ Cell C ¦
¦ ¦--------¦
¦ L ¦ Cell D ¦
¦ ¦--------¦
¦ L ¦ Cell E ¦
¦---¦--------¦
¦ A ¦ Cell F ¦
+---+--------+

Does that visual display what you are stating? Thinking out loud once again here ... I would like to believe that you could create a new COM [php.net] object and write out your data using the COM methods. A "cheater" way to develop the functions required in the merge loop would be to create a macro in MS Excel and "record" it. I'm thinking this would work, or at least should work!

d40sithui

4:34 pm on Dec 11, 2007 (gmt 0)

10+ Year Member



this might be out of the question, but why don't you write to the excel file as if a webpage. then you could use css and table commands to format the page better/easier. it would save as an excel and can open with excel. it would display nicer too.

hughie

11:34 pm on Dec 11, 2007 (gmt 0)

10+ Year Member



Hi Coopster

yup, thats the job. I've not looked at com objects, they scare me so i'm hiding from those. Not sure what you mean about the macro but i'll investigate.

Regarding doing it via HTML, i think this would cause me trouble as the formatting has to be very tight as it's an excell file that is used to print over an already printed order form. I'm passing the product data into the excel file which said person can tweak away in excell and then print over the order already printed form.