By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,480 Members | 2,192 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,480 IT Pros & Developers. It's quick & easy.

Reports on the intranet

P: n/a
Hi
I wonder if there is any possibility to generate reports in form such a
pivot tables and make them available on the web, would be great if users
would be able to work on it as on pivot table in excel, is it possible ?
What would I need ?
Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
You can achieve your objective using ASP/ASPX. Using ASP/ASPX would
require the Microsoft IIS web server. Here is a sample using aspx which
displays an Excel Spreadsheet in a webpage. Note: This can also be
accomplished using ASP.

<%@ Import Namespace="System.IO" %>
<script language="VB" runat="server">
Sub Page_Load(Src as Object, E as EventArgs)
Try
GetFile()
Catch ex As Exception
End Try
End Sub

Private Sub GetFile()
Dim FilePath As String = Cache("strFile").ToString
If Not Dir(FilePath).Equals("") Then
Dim fs As New FileStream(FilePath, FileMode.Open, FileAccess.Read)
Dim bw As New System.IO.BinaryReader(fs)
Dim byt() As Byte, i As Integer
byt = bw.ReadBytes(CInt(fs.Length))
i = byt.Length()
Response.ContentType = "application/vnd.ms-excel"
Response.OutputStream.Write(byt, 0, i)
Response.OutputStream.Close()
End If
End Sub
</script>
<HTML>
<HEAD>
<title><%=Cache("strFileName")%></title>

</HEAD>
<body >
<form>
</form>
</body>
</HTML>
To use this as straight ASP, just comment out the words

'Try
...
'Catch

and leave out the import line
<%@ Import Namespace="System.IO" %>

Note: If you load the .Net Framework on the server with IIS (IIS 5),
then the above ASPX code should run fine. You can write it straight in
Notepad. This routine uses a byte array and the line

Response.ContentType = "application/vnd.ms-excel"

is where the magic happens. Where Access comes into the picture here is
that you generate the Excel Report from Access. All of my Access
reports operate this way: I generate the report and then copy it to the
web server for viewing. The Response.ContentType line displays the
Excel Sheet in its native format with tabs and all. The only caveat
with this is that if someone tries to edit the sheet from the Web
Browser, the Excel file becomes unusable/uneditable for anyone else -
becomes read-only if edited from the web. Have your users download the
file first and then make edits to it.
Rich

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.