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

generating MS-Excel report through ASP.Net without installing MS-E

P: n/a
hi,
I want to send the data from dataset information to Excel through ASP.Net.
there will be no XL installed on web server. web server is win 2000 server
machine. I am using visual basic code in asp.net.
The Xl sheet should not be opened in the browser. All the information from
dataset(datatable,datarows) should be sent to XL and the file name should be
given dynamically through program and the xl file should be saved dynamically
through program. it should not ask for file name and it should not ask to
save.
Kindly let me know if any body has done this or any body knows how to do.
pls send me the code to vh***********@rediffmail.com

regards,
Hari,
vh***********@rediffmail.com.
Nov 18 '05 #1
Share this Question
Share on Google+
9 Replies


P: n/a
hi hari,
Please go thru this article before getting into coding.
http://support.microsoft.com/default.aspx?kbid=257757
MS does not recommend server side automation of office.
And for writing to Excel the following link helps :)
http://www.eggheadcafe.com/articles/20021012.asp

the best
srini

"hari krishna" wrote:
hi,
I want to send the data from dataset information to Excel through ASP.Net.
there will be no XL installed on web server. web server is win 2000 server
machine. I am using visual basic code in asp.net.
The Xl sheet should not be opened in the browser. All the information from
dataset(datatable,datarows) should be sent to XL and the file name should be
given dynamically through program and the xl file should be saved dynamically
through program. it should not ask for file name and it should not ask to
save.
Kindly let me know if any body has done this or any body knows how to do.
pls send me the code to vh***********@rediffmail.com

regards,
Hari,
vh***********@rediffmail.com.

Nov 18 '05 #2

P: n/a
hi srini thanks,
But i want a code in vb code.
And also i gave permissions through dcomconfig to launch permissions ,
access permissions to excel application. but it did not work through asp.net.
it still gave permissions denied.
and more over i know that excel is not recommended for automation through
server side. that is why i don't want to install xl, and create reports with
..xls extension and when i open it on a machine where xl is installed it
should open in xl.
Is there any code using response object sending to xl like that.
pls reply.

"srini" wrote:
hi hari,
Please go thru this article before getting into coding.
http://support.microsoft.com/default.aspx?kbid=257757
MS does not recommend server side automation of office.
And for writing to Excel the following link helps :)
http://www.eggheadcafe.com/articles/20021012.asp

the best
srini

"hari krishna" wrote:
hi,
I want to send the data from dataset information to Excel through ASP.Net.
there will be no XL installed on web server. web server is win 2000 server
machine. I am using visual basic code in asp.net.
The Xl sheet should not be opened in the browser. All the information from
dataset(datatable,datarows) should be sent to XL and the file name should be
given dynamically through program and the xl file should be saved dynamically
through program. it should not ask for file name and it should not ask to
save.
Kindly let me know if any body has done this or any body knows how to do.
pls send me the code to vh***********@rediffmail.com

regards,
Hari,
vh***********@rediffmail.com.

Nov 18 '05 #3

P: n/a
There is also a number of alternatives that may suit your purpose.

If there is no specific reason about writing in MS Excel format, I'll
suggest you to output the data in
XML format.

..NET framework have come with good support in handling XML files, and MS
Excel can read XML
data elegantly as through it were Excel file.

If you are using MS Office 2003, you may also generate a web page and let
the Excel's import wizard
to update the data each time the file is open.

"hari krishna" <ha*********@discussions.microsoft.com> 在郵件
news:CF**********************************@microsof t.com 中撰寫...
hi srini thanks,
But i want a code in vb code.
And also i gave permissions through dcomconfig to launch permissions ,
access permissions to excel application. but it did not work through asp.net. it still gave permissions denied.
and more over i know that excel is not recommended for automation through
server side. that is why i don't want to install xl, and create reports with .xls extension and when i open it on a machine where xl is installed it
should open in xl.
Is there any code using response object sending to xl like that.
pls reply.

"srini" wrote:
hi hari,
Please go thru this article before getting into coding.
http://support.microsoft.com/default.aspx?kbid=257757
MS does not recommend server side automation of office.
And for writing to Excel the following link helps :)
http://www.eggheadcafe.com/articles/20021012.asp

the best
srini

"hari krishna" wrote:
hi,
I want to send the data from dataset information to Excel through ASP.Net. there will be no XL installed on web server. web server is win 2000 server machine. I am using visual basic code in asp.net.
The Xl sheet should not be opened in the browser. All the information from dataset(datatable,datarows) should be sent to XL and the file name should be given dynamically through program and the xl file should be saved dynamically through program. it should not ask for file name and it should not ask to save.
Kindly let me know if any body has done this or any body knows how to do. pls send me the code to vh***********@rediffmail.com

regards,
Hari,
vh***********@rediffmail.com.

Nov 18 '05 #4

P: n/a
If u don't install Excel library on ur Server how ur vb code will create
object for Excel files? I had done this on IIS 5.0 with office installed on
server and I code that all upon users request from website. It does
automatically and make attachment and send email to waterver user input
email address. It makes a temp folder and create .xls file and attach for
email and delete it. That is not a good practice but we do for users
request.
I also want to conevert it for PDF, any one has idea how to make dynamic PDF
upon users given criteria on web and send that report as email attachment in
PDF format?
Let's discuss more if any one had done. Hari if u need any furhter
assistance let me know.
Shamshad Ali.
"hari krishna" <ha*********@discussions.microsoft.com> wrote in message
news:CF**********************************@microsof t.com...
hi srini thanks,
But i want a code in vb code.
And also i gave permissions through dcomconfig to launch permissions ,
access permissions to excel application. but it did not work through asp.net. it still gave permissions denied.
and more over i know that excel is not recommended for automation through
server side. that is why i don't want to install xl, and create reports with .xls extension and when i open it on a machine where xl is installed it
should open in xl.
Is there any code using response object sending to xl like that.
pls reply.

"srini" wrote:
hi hari,
Please go thru this article before getting into coding.
http://support.microsoft.com/default.aspx?kbid=257757
MS does not recommend server side automation of office.
And for writing to Excel the following link helps :)
http://www.eggheadcafe.com/articles/20021012.asp

the best
srini

"hari krishna" wrote:
hi,
I want to send the data from dataset information to Excel through ASP.Net. there will be no XL installed on web server. web server is win 2000 server machine. I am using visual basic code in asp.net.
The Xl sheet should not be opened in the browser. All the information from dataset(datatable,datarows) should be sent to XL and the file name should be given dynamically through program and the xl file should be saved dynamically through program. it should not ask for file name and it should not ask to save.
Kindly let me know if any body has done this or any body knows how to do. pls send me the code to vh***********@rediffmail.com

regards,
Hari,
vh***********@rediffmail.com.

Nov 18 '05 #5

P: n/a
I've heard that new version of CrystalReport(10?) have this
function(generate PDF format report), but not verified yet.

Maybe you can take a look on that...

"Shamshad" <sh************@hotmail.com> 在郵件
news:OI**************@TK2MSFTNGP15.phx.gbl 中撰寫...
If u don't install Excel library on ur Server how ur vb code will create
object for Excel files? I had done this on IIS 5.0 with office installed on server and I code that all upon users request from website. It does
automatically and make attachment and send email to waterver user input
email address. It makes a temp folder and create .xls file and attach for
email and delete it. That is not a good practice but we do for users
request.
I also want to conevert it for PDF, any one has idea how to make dynamic PDF upon users given criteria on web and send that report as email attachment in PDF format?
Let's discuss more if any one had done. Hari if u need any furhter
assistance let me know.
Shamshad Ali.
"hari krishna" <ha*********@discussions.microsoft.com> wrote in message
news:CF**********************************@microsof t.com...
hi srini thanks,
But i want a code in vb code.
And also i gave permissions through dcomconfig to launch permissions ,
access permissions to excel application. but it did not work through asp.net.
it still gave permissions denied.
and more over i know that excel is not recommended for automation through
server side. that is why i don't want to install xl, and create reports

with
.xls extension and when i open it on a machine where xl is installed it
should open in xl.
Is there any code using response object sending to xl like that.
pls reply.

"srini" wrote:
hi hari,
Please go thru this article before getting into coding.
http://support.microsoft.com/default.aspx?kbid=257757
MS does not recommend server side automation of office.
And for writing to Excel the following link helps :)
http://www.eggheadcafe.com/articles/20021012.asp

the best
srini

"hari krishna" wrote:

> hi,
> I want to send the data from dataset information to Excel through

ASP.Net. > there will be no XL installed on web server. web server is win 2000 server > machine. I am using visual basic code in asp.net.
> The Xl sheet should not be opened in the browser. All the
information from > dataset(datatable,datarows) should be sent to XL and the file name should be > given dynamically through program and the xl file should be saved dynamically > through program. it should not ask for file name and it should not
ask
to > save.
> Kindly let me know if any body has done this or any body knows how
to
do. > pls send me the code to vh***********@rediffmail.com
>
> regards,
> Hari,
> vh***********@rediffmail.com.
>
>


Nov 18 '05 #6

P: n/a
HI Shamshad,
Thanks for the advise.
I need ur help in this regard.
I don't want to open the xl in browser, and it should not ask for the name
of the file to save?open etc.. it should automatically generate the xl file
and store it to the physical folder dynamically. This is our users request.
my web server is on Win 2000 server machine and IIS 5.0, ASP.NET 1.1
installed.
the code i wrote is giving permissions problem. I did give Launch and Access
permissions through DCOMCNFG for MSExcel application. But still it denied the
permissions. At the line "Dim oExcel As Excel.Application = New
Excel.Application", it gave the following error. pls help me how to do this.
Access is denied.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.

Exception Details: System.UnauthorizedAccessException: Access is denied.

ASP.NET is not authorized to access the requested resource. Consider
granting access rights to the resource to the ASP.NET request identity.
ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or
Network Service on IIS 6) that is used if the application is not
impersonating. If the application is impersonating via <identity
impersonate="true"/>, the identity will be the anonymous user (typically
IUSR_MACHINENAME) or the authenticated request user.

To grant ASP.NET write access to a file, right-click the file in Explorer,
choose "Properties" and select the Security tab. Click "Add" to add the
appropriate user or group. Highlight the ASP.NET account, and check the boxes
for the desired access.

Source Error:

Line 28: Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Line 29:
Line 30: Dim oExcel As Excel.Application = New Excel.Application
Line 31:
Line 32: Dim oBooks As Excel.Workbooks, oBook As Excel.Workbook
Source File: E:\Inetpub\wwwroot\WebApplication1\WebForm3.aspx.v b Line: 30

Stack Trace:
[UnauthorizedAccessException: Access is denied.]
WebApplication1.WebForm3.Page_Load(Object sender, EventArgs e) in
E:\Inetpub\wwwroot\WebApplication1\WebForm3.aspx.v b:30
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()


"Lau Lei Cheong" wrote:
I've heard that new version of CrystalReport(10?) have this
function(generate PDF format report), but not verified yet.

Maybe you can take a look on that...

"Shamshad" <sh************@hotmail.com> 礎b繞l瞼籀
news:OI**************@TK2MSFTNGP15.phx.gbl 瞻瞻翹繞翹g...
If u don't install Excel library on ur Server how ur vb code will create
object for Excel files? I had done this on IIS 5.0 with office installed

on
server and I code that all upon users request from website. It does
automatically and make attachment and send email to waterver user input
email address. It makes a temp folder and create .xls file and attach for
email and delete it. That is not a good practice but we do for users
request.
I also want to conevert it for PDF, any one has idea how to make dynamic

PDF
upon users given criteria on web and send that report as email attachment

in
PDF format?
Let's discuss more if any one had done. Hari if u need any furhter
assistance let me know.
Shamshad Ali.
"hari krishna" <ha*********@discussions.microsoft.com> wrote in message
news:CF**********************************@microsof t.com...
hi srini thanks,
But i want a code in vb code.
And also i gave permissions through dcomconfig to launch permissions ,
access permissions to excel application. but it did not work through

asp.net.
it still gave permissions denied.
and more over i know that excel is not recommended for automation through server side. that is why i don't want to install xl, and create reports

with
.xls extension and when i open it on a machine where xl is installed it
should open in xl.
Is there any code using response object sending to xl like that.
pls reply.

"srini" wrote:

> hi hari,
> Please go thru this article before getting into coding.
> http://support.microsoft.com/default.aspx?kbid=257757
> MS does not recommend server side automation of office.
> And for writing to Excel the following link helps :)
> http://www.eggheadcafe.com/articles/20021012.asp
>
> the best
> srini
>
> "hari krishna" wrote:
>
> > hi,
> > I want to send the data from dataset information to Excel through

ASP.Net.
> > there will be no XL installed on web server. web server is win 2000

server
> > machine. I am using visual basic code in asp.net.
> > The Xl sheet should not be opened in the browser. All the

information
from
> > dataset(datatable,datarows) should be sent to XL and the file name

should be
> > given dynamically through program and the xl file should be saved

dynamically
> > through program. it should not ask for file name and it should not

ask
to
> > save.
> > Kindly let me know if any body has done this or any body knows how

to
do.
> > pls send me the code to vh***********@rediffmail.com
> >
> > regards,
> > Hari,
> > vh***********@rediffmail.com.
> >
> >



Nov 18 '05 #7

P: n/a
hi ,
actually due to security and volnurable issues we decided not to install
excel in web server machine. that is why i want to create xl through asp.net
without installing xl.
is there any method using response object and writing it and after that
saving it to .xls extension into a phylical folder.

rgds,
hari.

"Shamshad" wrote:
If u don't install Excel library on ur Server how ur vb code will create
object for Excel files? I had done this on IIS 5.0 with office installed on
server and I code that all upon users request from website. It does
automatically and make attachment and send email to waterver user input
email address. It makes a temp folder and create .xls file and attach for
email and delete it. That is not a good practice but we do for users
request.
I also want to conevert it for PDF, any one has idea how to make dynamic PDF
upon users given criteria on web and send that report as email attachment in
PDF format?
Let's discuss more if any one had done. Hari if u need any furhter
assistance let me know.
Shamshad Ali.
"hari krishna" <ha*********@discussions.microsoft.com> wrote in message
news:CF**********************************@microsof t.com...
hi srini thanks,
But i want a code in vb code.
And also i gave permissions through dcomconfig to launch permissions ,
access permissions to excel application. but it did not work through

asp.net.
it still gave permissions denied.
and more over i know that excel is not recommended for automation through
server side. that is why i don't want to install xl, and create reports

with
.xls extension and when i open it on a machine where xl is installed it
should open in xl.
Is there any code using response object sending to xl like that.
pls reply.

"srini" wrote:
hi hari,
Please go thru this article before getting into coding.
http://support.microsoft.com/default.aspx?kbid=257757
MS does not recommend server side automation of office.
And for writing to Excel the following link helps :)
http://www.eggheadcafe.com/articles/20021012.asp

the best
srini

"hari krishna" wrote:

> hi,
> I want to send the data from dataset information to Excel through ASP.Net. > there will be no XL installed on web server. web server is win 2000 server > machine. I am using visual basic code in asp.net.
> The Xl sheet should not be opened in the browser. All the information from > dataset(datatable,datarows) should be sent to XL and the file name should be > given dynamically through program and the xl file should be saved dynamically > through program. it should not ask for file name and it should not ask to > save.
> Kindly let me know if any body has done this or any body knows how to do. > pls send me the code to vh***********@rediffmail.com
>
> regards,
> Hari,
> vh***********@rediffmail.com.
>
>


Nov 18 '05 #8

P: n/a
I don't know, but adding "MACHINENAME\ASPNET" account to the MS Office
directory with
execute permission may help.

Users can't create process from files in a directory if they do not have
execute permission of the
directory.

"hari krishna" <ha*********@discussions.microsoft.com> 在郵件
news:1E**********************************@microsof t.com 中撰寫...
HI Shamshad,
Thanks for the advise.
I need ur help in this regard.
I don't want to open the xl in browser, and it should not ask for the name of the file to save?open etc.. it should automatically generate the xl file and store it to the physical folder dynamically. This is our users request. my web server is on Win 2000 server machine and IIS 5.0, ASP.NET 1.1
installed.
the code i wrote is giving permissions problem. I did give Launch and Access permissions through DCOMCNFG for MSExcel application. But still it denied the permissions. At the line "Dim oExcel As Excel.Application = New
Excel.Application", it gave the following error. pls help me how to do this. Access is denied.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.UnauthorizedAccessException: Access is denied.

ASP.NET is not authorized to access the requested resource. Consider
granting access rights to the resource to the ASP.NET request identity.
ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not
impersonating. If the application is impersonating via <identity
impersonate="true"/>, the identity will be the anonymous user (typically
IUSR_MACHINENAME) or the authenticated request user.

To grant ASP.NET write access to a file, right-click the file in Explorer,
choose "Properties" and select the Security tab. Click "Add" to add the
appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.

Source Error:

Line 28: Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Line 29:
Line 30: Dim oExcel As Excel.Application = New Excel.Application
Line 31:
Line 32: Dim oBooks As Excel.Workbooks, oBook As Excel.Workbook
Source File: E:\Inetpub\wwwroot\WebApplication1\WebForm3.aspx.v b Line: 30
Stack Trace:
[UnauthorizedAccessException: Access is denied.]
WebApplication1.WebForm3.Page_Load(Object sender, EventArgs e) in
E:\Inetpub\wwwroot\WebApplication1\WebForm3.aspx.v b:30
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()


"Lau Lei Cheong" wrote:
I've heard that new version of CrystalReport(10?) have this
function(generate PDF format report), but not verified yet.

Maybe you can take a look on that...

"Shamshad" <sh************@hotmail.com> |b?l¥o
news:OI**************@TK2MSFTNGP15.phx.gbl ?????g...
If u don't install Excel library on ur Server how ur vb code will create object for Excel files? I had done this on IIS 5.0 with office installed
on
server and I code that all upon users request from website. It does
automatically and make attachment and send email to waterver user
input email address. It makes a temp folder and create .xls file and attach for email and delete it. That is not a good practice but we do for users
request.
I also want to conevert it for PDF, any one has idea how to make dynamic PDF
upon users given criteria on web and send that report as email
attachment in
PDF format?
Let's discuss more if any one had done. Hari if u need any furhter
assistance let me know.
Shamshad Ali.
"hari krishna" <ha*********@discussions.microsoft.com> wrote in
message news:CF**********************************@microsof t.com...
> hi srini thanks,
> But i want a code in vb code.
> And also i gave permissions through dcomconfig to launch permissions , > access permissions to excel application. but it did not work through
asp.net.
> it still gave permissions denied.
> and more over i know that excel is not recommended for automation

through
> server side. that is why i don't want to install xl, and create reports with
> .xls extension and when i open it on a machine where xl is installed it > should open in xl.
> Is there any code using response object sending to xl like that.
> pls reply.
>
> "srini" wrote:
>
> > hi hari,
> > Please go thru this article before getting into coding.
> > http://support.microsoft.com/default.aspx?kbid=257757
> > MS does not recommend server side automation of office.
> > And for writing to Excel the following link helps :)
> > http://www.eggheadcafe.com/articles/20021012.asp
> >
> > the best
> > srini
> >
> > "hari krishna" wrote:
> >
> > > hi,
> > > I want to send the data from dataset information to Excel through ASP.Net.
> > > there will be no XL installed on web server. web server is win 2000 server
> > > machine. I am using visual basic code in asp.net.
> > > The Xl sheet should not be opened in the browser. All the

information
from
> > > dataset(datatable,datarows) should be sent to XL and the file name should be
> > > given dynamically through program and the xl file should be saved dynamically
> > > through program. it should not ask for file name and it should

not ask
to
> > > save.
> > > Kindly let me know if any body has done this or any body knows
how to
do.
> > > pls send me the code to vh***********@rediffmail.com
> > >
> > > regards,
> > > Hari,
> > > vh***********@rediffmail.com.
> > >
> > >


Nov 18 '05 #9

P: n/a
Since .xls is a closed format, I don't think you can generate one without
using MS Excel. (Although you
may be able to create compatiable one after studying the code of
OpenOffice.org etc.)

For this reason, you can see that I always suggest you to create the file in
another format that can be
opened by MS Excel. By saving the file as xml, all you need to do is save
some data with the structure
you'll use in XML format by Excel and study the tags it used. The time will
need to study is relatively
much shorter.

"hari krishna" <ha*********@discussions.microsoft.com> 在郵件
news:FA**********************************@microsof t.com 中撰寫...
hi ,
actually due to security and volnurable issues we decided not to install
excel in web server machine. that is why i want to create xl through asp.net without installing xl.
is there any method using response object and writing it and after that
saving it to .xls extension into a phylical folder.

rgds,
hari.

"Shamshad" wrote:
If u don't install Excel library on ur Server how ur vb code will create
object for Excel files? I had done this on IIS 5.0 with office installed on server and I code that all upon users request from website. It does
automatically and make attachment and send email to waterver user input
email address. It makes a temp folder and create .xls file and attach for email and delete it. That is not a good practice but we do for users
request.
I also want to conevert it for PDF, any one has idea how to make dynamic PDF upon users given criteria on web and send that report as email attachment in PDF format?
Let's discuss more if any one had done. Hari if u need any furhter
assistance let me know.
Shamshad Ali.
"hari krishna" <ha*********@discussions.microsoft.com> wrote in message
news:CF**********************************@microsof t.com...
hi srini thanks,
But i want a code in vb code.
And also i gave permissions through dcomconfig to launch permissions , access permissions to excel application. but it did not work through

asp.net.
it still gave permissions denied.
and more over i know that excel is not recommended for automation through server side. that is why i don't want to install xl, and create reports
with
.xls extension and when i open it on a machine where xl is installed
it should open in xl.
Is there any code using response object sending to xl like that.
pls reply.

"srini" wrote:

> hi hari,
> Please go thru this article before getting into coding.
> http://support.microsoft.com/default.aspx?kbid=257757
> MS does not recommend server side automation of office.
> And for writing to Excel the following link helps :)
> http://www.eggheadcafe.com/articles/20021012.asp
>
> the best
> srini
>
> "hari krishna" wrote:
>
> > hi,
> > I want to send the data from dataset information to Excel

through ASP.Net.
> > there will be no XL installed on web server. web server is win
2000 server
> > machine. I am using visual basic code in asp.net.
> > The Xl sheet should not be opened in the browser. All the
information from
> > dataset(datatable,datarows) should be sent to XL and the file name

should be
> > given dynamically through program and the xl file should be saved

dynamically
> > through program. it should not ask for file name and it should not
ask to
> > save.
> > Kindly let me know if any body has done this or any body knows how
to do.
> > pls send me the code to vh***********@rediffmail.com
> >
> > regards,
> > Hari,
> > vh***********@rediffmail.com.
> >
> >


Nov 18 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.