CODE:
$stuff = '<html><head><t itle>stuff</title></head><body><b>H ello</b>
World</body></html>';
header("Expires : Mon, 26 Jul 1997 05:00:00 GMT"); //
Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); //
always modified
header("Cache-Control: no-store, no-cache, must-revalidate"); //
HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); //
HTTP/1.0
header("Content-type: application/msword; filename=stuff. doc");
//header("Content-Disposition: attachment; filename=stuff. doc");
echo $stuff;
However, upon attempting to run this script I ran into the following
error in IE:
Internet Explorer could not open this script: test.php (note: I am
trying to change it to be "stuff.doc" ). Nothing ever showed up.
test.php (the code you see) is in a Linux environment in a folder
protected by .htaccess.
In NS 7.0 it produces no errors but it tries to save the downloaded
file as "test.php" and not "stuff.doc" .
I am unsure how to do this in PHP although I can do it in TCL and have
done it that way before, that, however, is not an option here.
Please help, I'm stuck at the very beginning of attempting customized
simple reporting.
Thank You,
Shailesh P. 7 19427
>>Shailesh<< wrote: CODE: $stuff = '<html><head><t itle>stuff</title></head><body><b>H ello</b> World</body></html>';
header("Expires : Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); // HTTP/1.0
header("Content-type: application/msword; filename=stuff. doc"); //header("Content-Disposition: attachment; filename=stuff. doc"); echo $stuff;
However, upon attempting to run this script I ran into the following error in IE:
Internet Explorer could not open this script: test.php (note: I am trying to change it to be "stuff.doc" ). Nothing ever showed up.
I do not know if this has anything to do with IE not being able to open
the document, but why do you specify a content-type of
"applicatio n/msword" when the document seems to be an HTML-document?
--
Gerard van Wilgen www.majstro.com - Multilingual translation dictionary www.erotikejo.com - International sex portal
hi,
i simply wants to convert html string to csv/xls file..i hv tried
$stuff = '<html><head><t itle>stuff</title></head><body><b>H ello</b>
World</body></html>';
header("Content-Type: application/vnd.ms-excel");
header("Expires : 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("content-disposition: attachment;file name=str.xls");
print $stuff;
this would ask to save as xls file...but while opening that xls file
it's giving error..
because it's saving html coded file with only xls extension.
would anyone plz help me to save HTML string in xls/cvs format..
Regards,
Shailesh P
>>Shailesh<< schrieb: this would ask to save as xls file...but while opening that xls file it's giving error.. because it's saving html coded file with only xls extension.
Excel needs binary! would anyone plz help me to save HTML string in xls/cvs format..
What did you want, a csv or a Excel File?
If you need csv you could write it like a normal textfile, if you want
to get a excel file, try the Excel_Spreadshe et_Writer from the PEAR package.
-Kirsten
hi
In my reporting script i want to give report format option(HTML &
CSV).
i hv written a script that generates HTML report...but when it is
required in CSV form
is there any way to convert my html embedded string into csv file..????
Thank you
Shailesh P.
hi
In my reporting script i want to give report format option(HTML &
CSV).
i hv written a script that generates HTML report...but when it is
required in CSV form
is there any way to convert my html embedded string into csv file by
setting headers..????
Thank you
Shailesh P.
>>Shailesh<< schrieb: is there any way to convert my html embedded string into csv file by setting headers..????
csv->Comma Separated Values!!!
Therfor you will need a seperate script or code for generating this csv.
Changing the header will only inform the browser about the content of
the output.
So what should excel do with a file wich contains html-code?
-Kirsten
Shailesh,
Setting the content-type header to "applicatio n/msword" should make the browser open the file as a Word document. This isn't a problem as Word understands HTML (more or less), however it's no use for outputting an Excel spreadsheet.
CSV is the way to go here and as Kirsten said, a CSV file is just data seperated by commas - easy to output with a simple script once you understand the structure. Try saving an excel spreadsheet as a CSV file, then open the CSV file in notepad to see how the data is formatted - this should give you a good idea of what your script needs to output.
Theoretically it would be possible to have a similar script to format your data into a valid .xls file, however this would be a MAJOR pain as .xls is a binary file format. Go with CSV.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: hunterb |
last post by:
I have a file which has no BOM and contains mostly single byte chars. There
are numerous double byte chars (Japanese) which appear throughout. I need to
take the resulting Unicode and store it in a DB and display it onscreen. No
matter which way I open the file, convert it to Unicode/leave it as is or
what ever, I see all single bytes ok, but double bytes become 2 seperate
single bytes. Surely there is an easy way to convert these mixed...
|
by: aevans1108 |
last post by:
expanding this message to microsoft.public.dotnet.xml
Greetings
Please direct me to the right group if this is an inappropriate place
to post this question. Thanks.
I want to format a numeric value according to an arbitrary regular
expression.
|
by: z. f. |
last post by:
Hi,
i need to convert a unicode string to ascii string (in order to put it in
HTML page url )
right now the string gets to the page, but when the url clicked (with the
unicode string in a query string parameter) - the page gets to its
destination but showing יפור אהבה בלתי שכח" as the value
it got from the url.
so i need probably to convert it to ascii, but how?
|
by: Mark Kamoski |
last post by:
Hi--
What is the difference between Convert.ToString(obj) and CType(obj,
String)?
(Assume obj is a variable of type Object.)
Please advise.
Thank you.
|
by: Charles Law |
last post by:
I thought this was going to be straight forward, given the wealth of
conversion functions in .NET, but it is proving more convoluted than
imagined.
Given the following
<code>
Dim ba(1) As Byte
Dim b As Byte
| |
by: Nikolay Petrov |
last post by:
How can I convert DOS cyrillic text to Unicode
|
by: csgraham74 |
last post by:
Hi,
I have a requirement in work that i give a person the ability to
create a html document using a richt text editor. What i then want to
do is save the HTML doct to my server & insert reference in a database
so that i can retrieve the html document.
Basically i dont have a clue how to convert a string in HTML format
(taken from the RTE) to an actual document and then save it to a
folder. Can anyone point me in the correct direction.
|
by: Just Another Victim of the Ambient Morality |
last post by:
I've done a google search on this but, amazingly, I'm the first guy to
ever need this! Everyone else seems to need the reverse of this. Actually,
I did find some people who complained about this and rolled their own
solution but I refuse to believe that Python doesn't have a built-in
solution to what must be a very common problem.
So, how do I convert HTML to plaintext? Something like this:
<div>This is a string.</div>
|
by: FAQ server |
last post by:
-----------------------------------------------------------------------
FAQ Topic - Why does 1+1 equal 11? or How do I convert a
string to a number?
-----------------------------------------------------------------------
Javascript variables are loosely typed: the conversion between a
string and a number happens automatically. Since plus (+) is also
used as in string concatenation, ` '1' + 1 ` is equal to ` '11' `: the
String deciding...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |