Hi all,
I am displaying a number of reports, and giving the users an option to
display them on the web or download them to Excel. If they want the
Excel file, I just use the PHP header command to change the Content-
Type and Content-Disposition headers, and essentially print the same
report, and it's done. That works fine.
But in some reports on the web I need to show images. The web part is
fine, but I'm having a tough time figuring out how to actually display
the images in Excel. Since this is a 'take it with you' file, links
won't work. I assume I'll have to effectively store the entire real
image file within Excel in the report. Can anyone point me in the
right direction? Here's a code snippet:
if ( ( isset($_POST['xl'])&&($_POST['xl']=="1") ) ||
( isset($_GET['xl'])&&($_GET['xl']=="1") ) ) {
header("Content-Type: application/xls");
header("Content-Disposition: attachment; filename=MyReport.xls");
header("Content-Type: application/force-download");
header("Cache-Control: post-check=0, pre-check=0", false);
$xl = 1;
}
....
....
if ($xl == 1) {
print "<img border=0 src='../report/$file' height=20>";
}
else {
print "<img border=0 src='../report/$file' height=20>";
}
Presently the image part doesn't work for Excel. Thanks in advance.
Eddie Andrews 6 8038
On Jun 11, 4:42 pm, Eddie <eddieandr...@gmail.comwrote:
Hi all,
I am displaying a number of reports, and giving the users an option to
display them on the web or download them to Excel. If they want the
Excel file, I just use the PHP header command to change the Content-
Type and Content-Disposition headers, and essentially print the same
report, and it's done. That works fine.
But in some reports on the web I need to show images. The web part is
fine, but I'm having a tough time figuring out how to actually display
the images in Excel. Since this is a 'take it with you' file, links
won't work. I assume I'll have to effectively store the entire real
image file within Excel in the report. Can anyone point me in the
right direction? Here's a code snippet:
if ( ( isset($_POST['xl'])&&($_POST['xl']=="1") ) ||
( isset($_GET['xl'])&&($_GET['xl']=="1") ) ) {
header("Content-Type: application/xls");
header("Content-Disposition: attachment; filename=MyReport.xls");
header("Content-Type: application/force-download");
header("Cache-Control: post-check=0, pre-check=0", false);
$xl = 1;
}
...
...
if ($xl == 1) {
print "<img border=0 src='../report/$file' height=20>";}
else {
print "<img border=0 src='../report/$file' height=20>";
}
Presently the image part doesn't work for Excel. Thanks in advance.
Eddie Andrews
What do you get if you manually create an Excel spreadsheet with
images, saving it as html, then viewing in a text editor?
C.
Eddie escribió:
I am displaying a number of reports, and giving the users an option to
display them on the web or download them to Excel. If they want the
Excel file, I just use the PHP header command to change the Content-
Type and Content-Disposition headers, and essentially print the same
report, and it's done. That works fine.
But in some reports on the web I need to show images. The web part is
fine, but I'm having a tough time figuring out how to actually display
the images in Excel. Since this is a 'take it with you' file, links
won't work. I assume I'll have to effectively store the entire real
image file within Excel in the report. Can anyone point me in the
right direction? Here's a code snippet:
if ( ( isset($_POST['xl'])&&($_POST['xl']=="1") ) ||
( isset($_GET['xl'])&&($_GET['xl']=="1") ) ) {
header("Content-Type: application/xls");
header("Content-Disposition: attachment; filename=MyReport.xls");
header("Content-Type: application/force-download");
header("Cache-Control: post-check=0, pre-check=0", false);
$xl = 1;
}
...
...
if ($xl == 1) {
print "<img border=0 src='../report/$file' height=20>";
}
else {
print "<img border=0 src='../report/$file' height=20>";
}
Hmmm... What's the difference?
Obviously, you aren't generating Excel files at all. This is just good
old HTML that the browser allows you to open with Excel (because of the
forged file extension) and Excel happens to understand (because of its
built-in HTML capabilities).
As you know, you don't insert pictures inside HTML but you link an
external file. So Excel only gets the HTML, there aren't any pictures.
Even if they were, according to your code it'd be looking for them in a
"report" subdirectory in the client computer.
Perhaps if you publish the pictures in your web server and provide a
full URL so Excel can download them itself _may_ do the trick (I'm not
too familiar with Excel):
<img src="hptt://example.com/foo/picture.jpg">
If it doesn't, you'll need to generate a real Excel file. There're some
libraries out there.
--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://bits.demogracia.com
-- Mi web de humor al baño María: http://www.demogracia.com
--
You make a good suggestion. As a default, when saving Excel files as a
web page, if it has an image, it stores the image in a folder and
references the image in the HTML. But that isn't quite what I want to
do. Isn't there a way to save the image within the Excel file itself,
so the user can carry only the XLS file with him rather than HTML and
images files and a directory structure.
On Jun 12, 7:11 am, "C. (http://symcbean.blogspot.com/)"
<colin.mckin...@gmail.comwrote:
On Jun 11, 4:42 pm, Eddie <eddieandr...@gmail.comwrote:
Hi all,
I am displaying a number of reports, and giving the users an option to
display them on the web or download them to Excel. If they want the
Excel file, I just use the PHP header command to change the Content-
Type and Content-Disposition headers, and essentially print the same
report, and it's done. That works fine.
But in some reports on the web I need to show images. The web part is
fine, but I'm having a tough time figuring out how to actually display
the images in Excel. Since this is a 'take it with you' file, links
won't work. I assume I'll have to effectively store the entire real
image file within Excel in the report. Can anyone point me in the
right direction? Here's a code snippet:
if ( ( isset($_POST['xl'])&&($_POST['xl']=="1") ) ||
( isset($_GET['xl'])&&($_GET['xl']=="1") ) ) {
header("Content-Type: application/xls");
header("Content-Disposition: attachment; filename=MyReport.xls");
header("Content-Type: application/force-download");
header("Cache-Control: post-check=0, pre-check=0", false);
$xl = 1;
}
...
...
if ($xl == 1) {
print "<img border=0 src='../report/$file' height=20>";}
else {
print "<img border=0 src='../report/$file' height=20>";
}
Presently the image part doesn't work for Excel. Thanks in advance.
Eddie Andrews
What do you get if you manually create an Excel spreadsheet with
images, saving it as html, then viewing in a text editor?
C.
On Jun 12, 9:15 am, "Álvaro G. Vicario"
<alvaroNOSPAMTHA...@demogracia.comwrote:
Eddie escribió:
I am displaying a number of reports, and giving the users an option to
display them on the web or download them to Excel. If they want the
Excel file, I just use the PHP header command to change the Content-
Type and Content-Disposition headers, and essentially print the same
report, and it's done. That works fine.
But in some reports on the web I need to show images. The web part is
fine, but I'm having a tough time figuring out how to actually display
the images in Excel. Since this is a 'take it with you' file, links
won't work. I assume I'll have to effectively store the entire real
image file within Excel in the report. Can anyone point me in the
right direction? Here's a code snippet:
if ( ( isset($_POST['xl'])&&($_POST['xl']=="1") ) ||
( isset($_GET['xl'])&&($_GET['xl']=="1") ) ) {
header("Content-Type: application/xls");
header("Content-Disposition: attachment; filename=MyReport.xls");
header("Content-Type: application/force-download");
header("Cache-Control: post-check=0, pre-check=0", false);
$xl = 1;
}
...
...
if ($xl == 1) {
print "<img border=0 src='../report/$file' height=20>";
}
else {
print "<img border=0 src='../report/$file' height=20>";
}
Hmmm... What's the difference?
Obviously, you aren't generating Excel files at all. This is just good
old HTML that the browser allows you to open with Excel (because of the
forged file extension) and Excel happens to understand (because of its
built-in HTML capabilities).
As you know, you don't insert pictures inside HTML but you link an
external file. So Excel only gets the HTML, there aren't any pictures.
Even if they were, according to your code it'd be looking for them in a
"report" subdirectory in the client computer.
Perhaps if you publish the pictures in your web server and provide a
full URL so Excel can download them itself _may_ do the trick (I'm not
too familiar with Excel):
<img src="hptt://example.com/foo/picture.jpg">
If it doesn't, you'll need to generate a real Excel file. There're some
libraries out there.
--
--http://alvaro.es- Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web:http://bits.demogracia.com
-- Mi web de humor al baño María:http://www.demogracia.com
--
That makes even better sense. I'll start looking for libs.
..oO(Eddie)
>You make a good suggestion. As a default, when saving Excel files as a web page, if it has an image, it stores the image in a folder and references the image in the HTML. But that isn't quite what I want to do. Isn't there a way to save the image within the Excel file itself, so the user can carry only the XLS file with him rather than HTML and images files and a directory structure.
Sure, but you'd have to create your document in a native Excel format.
Micha
On Jun 12, 2:45 pm, Michael Fesser <neti...@gmx.dewrote:
.oO(Eddie)
You make a good suggestion. As a default, when saving Excel files as a
web page, if it has an image, it stores the image in a folder and
references the image in the HTML. But that isn't quite what I want to
do. Isn't there a way to save the image within the Excel file itself,
so the user can carry only the XLS file with him rather than HTML and
images files and a directory structure.
Sure, but you'd have to create your document in a native Excel format.
Micha
Yep. I think you're right. Thanks. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: dale zhang |
last post by:
Hi,
I am trying to save and read an image from MS Access DB based on the
following article:
http://www.vbdotnetheaven.com/Code/Sept2003/2175.asp
Right now, I saved images without any...
|
by: Pranav |
last post by:
I've a web page that displays report data in a data grid an
a chart ( I'm using Chart Fx for .Net which creates .PNG files on Server)
I've a requirement to export the datagrid and chart both to...
|
by: somanyusernamesaretakenal |
last post by:
What I am trying to achieve:
Basically I have generated a report in access. This report needs to be updated using excel. (Updating the new data, not changing existing data)
What I did was I...
|
by: wstsoi |
last post by:
hi
I have to read images from spreadsheet, is it possible to do with php?
|
by: edwinparker |
last post by:
Hi,
I'm trying to convert a gridview to an excel report and have one small hang up. So far I've been able to create my gridview and export it to excel ok, but in my gridview I have an image. The...
|
by: Sport Girl |
last post by:
Hi everybody ,
i have the task of developing in Perl a script that retrieves data from 3 tables ( bugs, profiles, products) from a MySQL database called bugs and display them in an excel sheet...
|
by: pkj7461 |
last post by:
Hi,
I was using Docmd.Transferspreadsheet to to populate query data in Excel.
My code so far
Dim xlApp As Excel.Application
Dim xlWb As Excel.workbook
Dim xlWs As Excel.Worksheet
Set x1App =...
|
by: Karl |
last post by:
Hi all,
It may seem like a rather odd request (or not) but I would like to be
able to create a file (doc, jpg, xls or one of many other files that
can be automated) on a website and stream it to...
|
by: veer |
last post by:
hello expert
i am facing a probleum of saving the out put in excel sheet
actually i have two buttons on my vb form i,e merge entery and merge verify
and when i execute my program one by one...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |