oafc0000 Posted November 11, 2003 Posted November 11, 2003 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 Quote
mocella Posted November 11, 2003 Posted November 11, 2003 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 Quote
AndieHarper Posted November 12, 2003 Posted November 12, 2003 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 Quote
Voca Posted November 12, 2003 Posted November 12, 2003 There is also q quite good aritcle on using Excell fom vb.net on this link: http://support.microsoft.com/default.aspx?scid=kb;en-us;301982 Voca:) Quote
zubie Posted November 19, 2003 Posted November 19, 2003 Hi How would I attach the excel file to the outgoing mail? cheers ZuBiE Quote
mocella Posted November 19, 2003 Posted November 19, 2003 Try: msgMail.Attachments.Add(yourExcelObjectHere) Quote
zubie Posted November 19, 2003 Posted November 19, 2003 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 Quote
Recommended Posts