using this code i get "access denied" when i try to delete the docment file.
IO.File.Delete(out)
i added code to create and delete a file in the \temp folder to show it's no a permission problem. it seems like aspsose hold the doc/object open. i want to delete the output afer creatation.
Thanks, Tack
Dim tmp As String = IO.Path.GetTempFileName
Dim out As String
out = IO.Path.Combine(settings.tmpFolder, settings.SessionID & ".doc")
IO.File.Copy(settings.LienSettlementForm, out)
Dim license As Aspose.Words.License = New Aspose.Words.License()
license.SetLicense("Aspose.Words.lic")
Dim settleDoc As Aspose.Words.Document = New Aspose.Words.Document(out)
settleDoc.Range.Bookmarks("Date").Text = dated.ToShortDateString
settleDoc.Range.Bookmarks("Attn").Text = name
settleDoc.Range.Bookmarks("CoName").Text = caseRecs.CusNameFirm
settleDoc.Range.Bookmarks("Fax").Text = caseRecs.Customer.Fax
settleDoc.Range.Bookmarks("phone").Text = caseRecs.Customer.Phone
settleDoc.Range.Bookmarks("AppName").Text = caseRecs.Order.Name
settleDoc.Range.Bookmarks("Defendant").Text = caseRecs.Order.Defendant
settleDoc.Range.Bookmarks("ClaimNum").Text = caseRecs.Order.ClaimNum
settleDoc.Range.Bookmarks("OrderNum").Text = caseRecs.OrderNum.ToString
settleDoc.Range.Bookmarks("Dear").Text = name
settleDoc.Range.Bookmarks("Totaling").Text = caseRecs.Ledger.TotalInvoices.ToString("$#,##0.00")
settleDoc.Range.Bookmarks("Amount").Text = amount.ToString("$#,##0.00")
settleDoc.Range.Bookmarks("Today").Text = DateTime.Today.ToShortDateString
settleDoc.Save(out, Aspose.Words.SaveFormat.Doc)
Dim smtp As Net.Mail.SmtpClient = Nothing
Dim mmsg As Net.Mail.MailMessage = Nothing
mmsg = New Net.Mail.MailMessage
mmsg.From = New Net.Mail.MailAddress(_From)
Dim tos() As String = _to.Split(New Char() {","c, ";"c})
For Each [to] As String In tos
mmsg.To.Add(New Net.Mail.MailAddress([to]))
Next
If _cc IsNot Nothing Then
Dim ccs() As String = _cc.Split(New Char() {","c, ";"c})
For Each [cc] As String In ccs
mmsg.CC.Add(New Net.Mail.MailAddress([cc]))
Next
End If
If _bcc IsNot Nothing Then
Dim bccs() As String = _bcc.Split(New Char() {","c, ";"c})
For Each [bcc] As String In bccs
mmsg.Bcc.Add(New Net.Mail.MailAddress([bcc]))
Next
End If
mmsg.Subject = String.Format("Zing Settlement for {0}", caseRecs.OrderNum.ToString)
mmsg.Body = "see attached"
mmsg.IsBodyHtml = True
mmsg.Attachments.Add(New Net.Mail.Attachment(out))
smtp = New Net.Mail.SmtpClient(settings.SMTPServer)
smtp.Send(mmsg)
settleDoc = Nothing
If IO.File.Exists(tmp) Then
IO.File.Delete(tmp)
End If
If IO.File.Exists(out) Then
IO.File.Delete(out)
End If