Formatting Excel Cells
Is it possible to format the cells of excel spreadsheet using php. I download a excel spreadsheet from webpage which is passed thro the headers. I want to format the cells in this manner using php. This is the code in VB. Code:
Range("A1:K1").Select
Selection.Font.Bold = True
Selection.Font.ColorIndex = 15
Selection.Font.ColorIndex = 9
With Selection.Interior
.ColorIndex = 48
.Pattern = xlSolid
End With
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Export MySQL To Certain Excel Cells
I have .xls files that I want to be able to export MySQL data into. Is there a straightforward way to do this...I'll really only be inputing 2-3 values. So pretend I have: $test1 $test2 $test3 And I want to export them into test.xls in cells A1, A2, A3. Can someone provide the method for doing this?
Formatting Excel Fields Using Php
I have managed to create and excel file using php, I display the results in html and have a link to create the excel file. I need to format one of the fields as "text", is this possible?
Limit # Table Cells
I'm trying to write a script that would allow me to limit the amount of table cells and the # of rows in the table. PHP Code:
How To Make Text Wrap In Table Cells?
I don't understand this at all. I have a table with fixed width and height in pixels. Yet when I place a long text string in a cell, the cell expands as far as needed to the right or left to fit the string on one line. This is driving me quite mad. How do I ensure that a long string is displayed in a neat, orderly fashion? My question has nothing to go with wrapping text around images. I just simply need to have text wrapped!
Empty HTML Table Cells Have No Borders, What Do You Do?
When I first start using databases and dynamic content, I noticed that when you use table borders in your designs and if the database column/row doesn't have any info the html table outputed looks funny. I was wondering how you handle this. I use a function that puts a clear gif image. Code: //This function is used for replacing an empty var with a clear gif 1px X 1px function replace_empty($vars) { if ($vars =="") { $vars = "<img src='images/clear.gif' width=Ƈ' height=Ƈ' alt=''>"; } echo $vars; } //End function replace_empty Or you could use some CSS like "empty-cells: show"
Print Table Cells To Fill In The End Of A Calendar
I have a variable called $rowCount that keeps track of how many total cells have been added to a table. Its actually the month view of a calendar. I need to print blank cells representing the days of the next month to fill in the cells and make the grid complete. I am almost there, I just need to figure out how to make it stop printing new cells when the $rowCount variable becomes divisible by 7. That would mean that all table rows have 7 columns, and the grid is complete. here is what I tried so far, but this just keeps printing the cells, never stopping. PHP Code:
Extract Html Table Cells And Put To An Array
i have a table like: <tr><td>headA</td><td>headB</td><td>headC</td><td>headD</td></tr> <tr><td>1a</td><td>1b</td><td>1c</td><td>1d</td></tr> <tr><td>2a</td><td>2b</td><td>2c</td><td>2d</td></tr> <tr><td>3a</td><td>3b</td><td>3c</td><td>3d</td></tr> <tr><td>4a</td><td>4b</td><td>4c</td><td>4d</td></tr> where there can be any number of rows and there can be any number of columns. how can i read through this and create an array for each row, and use the header row as the keys. ie have it something like: QuotemyArray[0] = array( 'headA' = '1a', 'headB' = '1b', 'headC' = '1c', 'headD' = '1c', ); myArray[1] = array( 'headA' = '2a', 'headB' = '2b', 'headC' = '2c', 'headD' = '2c', ); etc....
Mysql To Excel And Then Email The Excel Doc
I have a good working code for making a excel doc. on the fly. He send the file to the screen and you can save it directly. But I dont want it to send it to the screen but that he save it on the server and EMAILS it to someone. I'm searching and trying to get it work for 3 days, but no luck. I hope you guys can help me out. This is the code I use the make an excel doc. $select = "SELECT * FROM dagrapport WHERE dagrapportid='$dagrapportid'"; $result = mysql_query($select); $datum = mysql_result($result,0,'datum'); $medewerkernummer = mysql_result($result,0,'medewerkernummer'); $export = mysql_query($select); $fields = mysql_num_fields($export); $kop = ""; $data = ""; for ($i = 0; $i < $fields; $i++) { $kop .= mysql_field_name($export, $i) . " "; } while($row = mysql_fetch_row($export)) { $line = '' foreach($row as $value) { if ((!isset($value)) OR ($value == "")) { $value = " "; } else { $value = str_replace('"', '""', $value); $value = '"' . $value . '"' . " "; } $line .= $value; } $data .= trim($line)." "; } $data = str_replace(" ","",$data); if ($data == "") { $data = " (0) Records Found! "; } header("Content-type: application/x-msexcel"); header("Content-Disposition: attachment; filename=dagrapport-$datum-$medewerkernummer.xls"); header("Pragma: no-cache"); header("Expires: 0"); print "$kop $data";
Php To Excel : Can You Format The Excel Sheet?
I can create a file to download to excel, but I would like to know if you can bold the excel sheet or make headers and change the width of the cells. If not feel free to say impossible in php.
Formatting
Does anyone know how to keep the formating of a textarea box (i.e. keep the lines and spaces between lines) when it gets put into a mysql table (the column set as text).
Excel Into Php
How can I import data from an excel spreadsheet into a php form?
PHP And Excel
Heres what I got, a form that when filled out and submitted it sends the information to me via an email, the only problem is I need it to either come as an txt attachment or as an excel file, so that way the information that is submitted can be cut and pasted into an excel document.
Excel PHP
I am using a set of functions that seem to be pretty common for using an associative array to write data to an .XLS file. This work fine for the most part, however I have problems writting a number to Excel on a Solaris system, whereas it works fine on a Windows system using the same PHP version (5.05). I have isolated the code to the following function: /** * Excel worksheet cell insertion * (single-worksheet supported only) * @access private * @param (int) $row worksheet row number (0...65536) * @param (int) $col worksheet column number (0..255) * @param (mixed) $val worksheet row number */ function _xlsWriteCell($row, $col, $val) { if (is_float($val) || is_int($val)) { // doubles, floats, integers $str = pack(str_repeat($this->bin[$this->endian], 5), 0x203, 14, $row, $col, 0x0); $str .= pack("d", $val); } else { // everything else is treated as a string $l = strlen($val); $str = pack(str_repeat($this->bin[$this->endian], 6), 0x204, 8 + $l, $row, $col, 0x0, $l); $str .= $val; } fwrite($this->fp, $str); $this->position += strlen($str); return strlen($str);.....
PHP With Excel
Can i write to MS-Excel using PHP? I am using PHP 5 on Linux.
Excel Via PHP
I would like to know how could I get variables from an Excel document right to php... for example, how can I get all the names of colum 'names' of my excel file right to my php, and make them visible in a html files...
PHP And Excel
I want to read (and ONLY read) a multi-sheets Excel file with PHP. I found so many scripts on the net that I finally don't know what to choose so... could experimented users help me to directly find the one that I need ? Here are the two obvious things the script must match : - free - can read multi-sheets Excel files
Xml To Excel
I tried to search this on the forum, but I'm not finding what I need. I need to get data from my XML file into an Excel file. Can anyone show me a link to a tutorial or if they know how to do it, please?
Php To Excel
How can I convert a PHP document to an excel file?
Excel To CVS
We receive various files from clients and have tried over the years to get our clients to standardize their file formats to a format that we can use and automate the processing of the data. Unfortunately there are always the few that do not want to spend the time or have the people with the knowledge to format their files to match our required format. Hence we end up spending a tremendous amount of time reformating the files or manually keying the data into our system to use the information and this opens the door for human errors by our employees. I have been given the task to try to automate as much of this process as possible to eliminate the need to manually key information or adjust the files we receive. Solution: Develop a web based system in PHP that would allow a client to upload a file that we could read and populate a form. The form would allow the client to review the information and key in any information that is missing from their file and then submit it to us for processing. This would eliminate our need to manually key in data or adjust the files and any errors in the information would be the result of the client and not our employees. The file formats we receive regularly are Tab Delimited files, Excel files, and XML files. Question: Tab Delimited files are easy enough to deal with and XML can be easily parsed and used with PHP. The trouble I have is with Microsoft Excel. Is there a way to convert the xls file to a CSV with PHP ? I have done some searching on the forum and on the net but I have not found anything that would fit my requirements.
Excel
does anyone know how to save a spreadsheet automatically with the excel spreadsheet writer and attach it into an email and send the email all while the script runs simultaneously?
Formatting Of Dates From MDB With PHP
I am having a problem with Date formatting I am running PHP on an IIS box and my date formatting is coming out quite strange utilizing the following query: $strSQL = "SELECT Indiv.Lastname, Indiv.Firstname, IndivClient.StartDate, IndivClient.Type, IndivClient.StartDate FROM Indiv INNER JOIN IndivClient ON Indiv.NameID = IndivClient.NameID WHERE (((IndivClient.Type)='QSuspect') AND ((IndivClient.StartDate) Between $workday And Date()));"; and the following output code print "<td>$directory->value</td></tr>"; I get dates in this format 1021006800 If I use a simple date string I get dates in the normal d/m/y format.
Formatting Error In IE
I've created a form in php which displays and works perfectly in Opera. However, when I bring it up in IE, the text and input boxes are separated by almost half the page and the submit does not work. The code follows - any assistance would be appreciated.
PHP Text Formatting
I'm wondering if someone can help me out with a small but no less importam problem I have? I'm using the code below to call text from a MySQL database field <td>".$rs[2]."</td> The problem is that the text appears with the web page like Sentence 1 Sentence 1 Sentence 1 and not like Sentence 1 Sentence 1 Sentence 1 as it should be, any suggestions?
Formatting A Date
I need to format a date in php to look like Sunday September 2. If the code is like this:
Date Formatting
I am trying to work out how to convert UK date format (DD/MM/YYY) to a format that will be accepted by MySQL (YYYY-MM-DD), so far I have been almost successful by using the following:- PHP Code:
Formatting Dates?
Im reading a csv file with php and getting a date in the form 30/09/07 Which I am trying to insert into a mysql table which has the field formatted as yyyy-mm-dd hh:mm:ss . I cant get it to insert the field remains blank How do I do this?...
Formatting Strings?
i have a row in one of my databases, and i use a timestamp to imput the current time into the row. Now, when i output the timestamp i get something like 20001218155634. I tried reading the php manual to help me on editing strings, but it wasn't of much help. So does anybody know any websites with good php string manipulating tutorials? or can anybody show me how to format the timestamp?
Formatting Text
I am currently looking for a way to have text that is entered in my news service (it is added to a databse, then displayed) to be cut off after a certain length on some pages (mainly the front page)...kind of like what you see on some sites with the "read more" at the end. I want it so i could enter a long news/article update, then on the home page it would be shortened, and when the user clicks on the title, it takes them to the detail page with the full length article. I am using dreamweaver, if that makes any difference.
Formatting Dates
I can't get my date to properly display. It is $birthday. It is formatted as a time stamp. Previouslu, I had it in yyyy-m-d format. Neither worked! The output I get from the code below is Age: 33 (December 31, 1969). WHY? $today = time(); $age= ($today - $birthdate)/60/60/24/365.25; $f_age = sprintf("%01.0d", $age); echo "Age: $f_age "; $f_birthday = date("F d, Y", $birthday); echo "($f_birthday)<br>";
Date Formatting
how do I retrieve the current year to insert to the database. And how the date data is stored? is it yyyy/mm/dd or yyyy/dd/mm?
Formatting String
i have a variable that holds a string, the held string can be any string including HTML tags, here is an example. PHP Code:
String Formatting
i have built a forum for my site with php an mysql. a user submits raw text from a textarea into a table. when the text is pulled for display i run it through a function called "format_post( )." PHP Code:
Textarea Formatting
I am using a php html form with data which is loaded from a mysql database. Three of the fields are textareas. The data loads into these fields fine, except that the loaded text starts at what appears to be 2 or 3 tab characters to the left. See illustration: +---------<this is a textarea object>---------+ | This is about the way that| |the text loads from the database field. | | | | | +---------------------------------------------+ It's almost as if there's a textarea "align" property which is set to "center" by default unless otherwise explicitly stated. Is there some setting in the wrap property that will fix this, or should I be looking elsewhere?
Formatting Problem
I am using stripslashes(htmlspecialchars($myrow[1])) to display a record from the database. When I enter data in the form in the backend, I want to put <b>text</b> but this actually turns out as <b>text</b> on the webpage instead of bolding the word text. How do I make it so I can enter HTML in the backend textarea form fields?
Formatting A String
if i have a string like this: id=14,15,16,17 and some of the ids can be missing e.g. id = 14,,16,17 I would like to strip out the extra commas. Ive had a few goes trying different ways.
#$!%& Date Formatting.
I've looked through every OTHER date format thread, I've even tried 2 or 3 different methods of formatting the date. I even had a thread back in May about this, and I still haven't gotten it to work. PHP Code:
Formatting XML Data
I am currently working quite a bit with XML files and i keep running into the same problem. Many times i want to split the text into a paragraph, or make it an unordered list. How do you all format your XML idea.
Formatting Numbers?
How can I get from "5.99" to just "5"? I tried researching the manual, but they are full of rounding numbers and decimal points.
Textbox Formatting
say you've got this textbox that asks for a visitors first name. Is there a way to make the first letter of their name CAPITALIZED even if they typed it in lower-case? (i.e. they type "billyjoe" and I want the output to be "Billyjoe" with a capital B) I've been searching for a while, but haven't been able to come up with anything yet.
Formatting Number
Can sombody tell me the best way to format a number in this way. 456.45657 must be 456,46 So the point becoms a comma and I would have 2 digits i.pv. 5
PHP And Number Formatting
When I add 2 items in the cart less than $1000.00, the formatting of the numbers display fine. When for example I got 2 items that cost 3475.00, the total cost the the two items is displayed as 6, and NOT 3475.00. I am using the the sprintf function, and I believe my problem lies in the fact that I don't know the correct format to display numbers in excess of 1000.00?
Text Formatting
I'm having a problem with PHP, mysql and HTML. I am writing a message board for my site using PHP and mysql. I am running into a problem however with text formatting. Right now, the text for a message is entered into a text area. When the user submits the form the text is sent to a mysql database. All this works fine. My problem comes when reading the text FROM the database. If I use PHP to create a table and read the text into a cell, all of the formmatting is lost. No line breaks, tabs, etc... it just lumps all of the text together. I can use a <PRE> tag and then put the text in and it will preserve the formatting with line breaks, etc. The problem with this is that it wont word wrap. So if i type alot without a hard line break, then when it reads from the database using a <PRE> tag it puts all of the text on one line and stretches the table. Because the <PRE> tag will display it with its original formatting I know that the formatting is being stored in the mysql. So I either need to find out how I can wordwrap a <PRE> tag (in IE). OR I need to know how I can get PHP and HTML to restore the original format of the text without using a <PRE> tag.
Currency Formatting
i'm trying to format the output of a record in access, which i am pulling from through php (odbc) and the formatting is set at 4 decimal places, which i don't want. i want currency and no decimal places. I was trying to use this example, but i have no bloody idea howo to use it. or where to put it for that matter: <?php $number = 1234.56; // let's print the international format for the en_US locale setlocale(LC_MONETARY, 'en_US'); echo money_format('%i', $number)." "; // USD 1,234.56 ?>
Formatting Strings
I am currently using sprintf to format a report from a MySQL database data. I was wondering if there is an easy way to format text besides using sprintf. See below for the example I need to recreate. If any lines exceed the 75 column the need to wrap to the next line and indent 24 spaces. PHP Code:
Formatting Number.
I am trying to display prices on a shopping cart system, but need to be able to display the prices in the form £x.yy, at the moment I am getting things like: £4 £4.2 £4.123 How can I make PHP display a floating point number with only/at least 2 decimcal places?
Php Date-Formatting
I have a date value that I pull from a .csv file. After reading the file and storing the values in an array the value of the date could be found in $array[1], for example. while (($data = fgetcsv($handle,5000, ",")) !== FALSE) { $mydate = $data[3]; // here is the array value that holds the date } The date will be in either m/d/yyyy or mm/dd/yyyy format. Here is the problem. I need to display this date on the page in "long" format - i.e. January 5, 2005 instead of 1/5/2005 or 01/05/2005. I have tried to use the date() function, however I can only get the formatting to work with the current date and not with an 'existing' date. date("d.m.Y", $mydate); // this does not work, I get a date from 1969...
Number Formatting
I have a page that multiplies an amount of a part by the quantity of that part, then gives a total. For example: PART (costs $5.00, quantity of 3) That yields a total of $15. I want to it say $15.00 and I want it to round to the hundreths place in circumstances where a part may cost $3.6554, for example. How can I achieve this?
String Formatting
I have the following string - &=120=-&=127=-&=131=-&=135=-&=170=-&=171=-&=174=-&=175=-&=194=-&=196=-&=206=-&=222=-&=230=-&=236=-&=237=-&=240=-&=249=9 249=9 The important part are the numbers e.g. 120,127 and the dash or value after the = and before the & e.g. 236= (-) & The red part. I would like to separete them to get to display the dash only. how would I do this?
|