S
sanchezpepe
Guest
Hello everyone,
I am currently using the code below to write a StringBuilder to a csv file and it works fine because I only has text data.
But as part of an enhancement the resulting files must also have images and text.
Csv files do not allow to add images, so I would like to know how I can create a fie that can be opened by a user when receiving this file as an attachment and contains text and images.
Thanks
Sub ExportCSV(strHeader As String, ReportData As StringBuilder, strProjectID As String)
Dim strRelFilename As String
strRelFilename = "C:\Workspace\scratchfolder\" + strProjectID + ".csv"
Try
If File.Exists(strRelFilename) Then
File.Delete(strRelFilename)
End If
Dim sw As New StreamWriter(strRelFilename)
Dim s As String = String.Empty
sw.Write(strHeader)
sw.Write(vbNewLine)
sw.Write(ReportData.ToString)
sw.Close()
Catch ex As Exception
errorMsgs = "ExportCSV " & vbNewLine _
& "Error Message: " & ex.Message _
& "Date" & DateTime.Now.ToShortDateString
Console.WriteLine(ex.Message)
End Try
End Sub
Continue reading...
I am currently using the code below to write a StringBuilder to a csv file and it works fine because I only has text data.
But as part of an enhancement the resulting files must also have images and text.
Csv files do not allow to add images, so I would like to know how I can create a fie that can be opened by a user when receiving this file as an attachment and contains text and images.
Thanks
Sub ExportCSV(strHeader As String, ReportData As StringBuilder, strProjectID As String)
Dim strRelFilename As String
strRelFilename = "C:\Workspace\scratchfolder\" + strProjectID + ".csv"
Try
If File.Exists(strRelFilename) Then
File.Delete(strRelFilename)
End If
Dim sw As New StreamWriter(strRelFilename)
Dim s As String = String.Empty
sw.Write(strHeader)
sw.Write(vbNewLine)
sw.Write(ReportData.ToString)
sw.Close()
Catch ex As Exception
errorMsgs = "ExportCSV " & vbNewLine _
& "Error Message: " & ex.Message _
& "Date" & DateTime.Now.ToShortDateString
Console.WriteLine(ex.Message)
End Try
End Sub
Continue reading...