Click to See Complete Forum and Search --> : OLE of Excel Graph on ASP page
johannesburgboy
06-09-2003, 09:36 AM
Hi. I want to know what to use when I want to link an excel graph to an ASP page. This graph will be manually updated in Excel and I want the latest graph to appear on the website. Is this possible?
Chees JHB boy
khaki
06-09-2003, 11:49 AM
hi JHB boy...
I don't think it can be done (I've asked this same question in numerous forums)
You do have some options though.
Save the Excel file (which contains the graphs) as a webpage.
This will save the graph(s) as GIFs.
Then rename the GIFs and put them on the server.
If the graph(s) will be updated daily...
you can name them using a date-based naming convention (to prevent the browser from caching). Such as:
2003_06_09.gif
and then put this on your webpage:
(it adds the leading zeros - and the year... if you want it):
<script type="text/javascript">
var now = new(Date);
var y = now.getFullYear();
var m = now.getMonth()+1;
var d = now.getDate();
m = (m < 9) ? "0" + m : m;
d = (d < 9) ? "0" + d : d;
document.write('<img src=' + y + "_" + m + "_" + d + '.gif>');
</script>
It returns:
<img src="2003_06_09.gif">
(or you could manually change the image name on the page itself)
However...
if your graphs are updated throughout the day...
it's a lot trickier
it can still be done though...
although you will need to alter the javascript to handle hours and minutes instead of the date stuff.
Plus you will need to have the page refresh itself at specified intervals.
In addition...
you will need to have some VBA programming that changes the file name at regular intervals to match the intervals that the pages use (so that the javascript generated image name is always referring to an image that is on the server).
Either that... or give that boring and thankless job to someone who can spend the day manually changing the names themselves :eek:
Loading the images into a database is another option...
but caching is still an issue...
so the javascript naming convention will still be needed.
It's a bit complex...
and a total pain in the *ss...
but it's very do-able if you can code in Excel VBA.
Otherwise...
I don't know of another way to do it :rolleyes:
don't know if that helped...
but maybe it will get you thinking about it in a different way (at least)...
good luck...
;) k