Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi All

 

I am developing a application that needs to create a excel document and e-mails it to the recpeitent all server side.

 

The user will fill in a html form and then submit it, then data is then place in excel and then mailed out.

 

Anybody know any way of doing this on the server so the user is still only sending and receving html to the sever and not using excel on there PC??

 

Thanks

Posted

So you want to generate the XLS file, but not really launch Excel (at least visibly to the user), then email the XLS file you generated to somewhere? All this being done on the server, I have that much right?

 

I'm not sure about your first problem (I've only exported a datagrid to Excel, but it's shown to the user on purpose in those cases).

 

For the second part of your question here's a way in VB.net/ASP.Net:

 

Imports System.Web.Mail

 

Protected Sub CreateAndSendEmail(ByVal fromID As String, ByVal fromName As String, ByVal To_Email As String, ByVal CC_Email As String)

Dim strSubject As String

Dim msgMail As New MailMessage()

Dim stbMessageBody As New System.Text.StringBuilder()

 

Try

'CREATE MESSAGE BODY

stbMessageBody.Append("Hey - you have mail.")

 

'CREATE MESSAGE HEADER

strSubject = "A new QA Feedback Survey is available."

 

msgMail.From = fromID

msgMail.To = To_Email

msgMail.Cc = CC_Email

msgMail.Body = stbMessageBody.ToString

msgMail.Subject = strSubject

SmtpMail.SmtpServer = "mail.yourdomain.com"

SmtpMail.Send(msgMail)

Catch ex As Exception

Throw ex

End Try

msgMail = Nothing

 

End Sub

Posted

The first part is pretty straight forward too.

 

If your data is going straight into a simple spreadsheet with no formatting, you can simply output it is a tab separated text file with an xls extension. Cheating slightly, but its smple and works

Posted

OK

 

I've tried to attach the excel object

Problem: I get an error message when I try and add a COM

reference to Microsoft Excel Object Library

 

Is there any way I can do this as I dont have a lot of time to play with

 

cheers again

ZuBiE

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...