How can I create a word-document from the Asp.Net?

  • Thread starter Michael Tkachev
  • Start date
M

Michael Tkachev

Hi Everybody!

I have a problem. When I get a HTML of my page that I'm rendering. I need to
generate a word-document from a html. And than I have to send this
word-document to the users through e-mail. So, how can I create a
word-document if I have a html file? I created componet that allows do it.
But this component doesn't work with Asp.Net. Exception shows error that
Asp.net does't have a permitions for it. But it's a false. Asp.net can't do
the following Item:
DocumentClass d = new DocumentClass();

Below you will find a text of that exception:

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 103: object visible=true;
Line 104:
Line 105: DocumentClass d = new DocumentClass();


Who knows what can I do?

Thanks a lot!
 
M

Mark Rae

I have a problem. When I get a HTML of my page that I'm rendering. I need
to
generate a word-document from a html. And than I have to send this
word-document to the users through e-mail. So, how can I create a
word-document if I have a html file?

Word understands HTML natively so, if you already have an html file, just
change its extension to .doc and then send it to your users. When they try
to open it, the Windows file associations will open it in Word and Word will
understand that it's an HTML document automatically and display it properly.
 
M

Michael Tkachev

Thank you Mark!

I really shocked! It works fine!

Thank you again!!!

Michael
 
M

Mark Rae

Michael,
Thank you Mark!
Welcome.

I really shocked! It works fine!

You can also do something similar with Excel. Just create a standard HTML
file and give it the ".xls" extension. Excel will "understand" HTML tables
and place the invidividual tablecell contents in rows and columns in a
worksheet.

Of course, it is possible to have ASP.NET interface directly with Office,
but this is not recommended because of performance issues.

However, for WinForms (as opposed to WebForms), .NET integrates really well
with Office.

Mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top