Link to home
Start Free TrialLog in
Avatar of Starr Duskk
Starr DuskkFlag for United States of America

asked on

Lumenworks CSV Writer

I have been looking for an example of how to use Lumenworks to CREATE a CSV file. I've only see how to read one.

Can someone please send me to an example or show me how to use Lumenworks to create a CSV file?

I then need to send the CSV file to the screen for the user to download.

thanks!
ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Starr Duskk

ASKER

That's what I thought, but the project lead told me to use it to write a file, so I wanted to make sure. Yes, I know how to write a csv file, I was just trying to comply with the project lead who said it was "very easy to do with Lumenworks" as though he knew it was possible. Thanks!
Why use something that you don't need to?

Public Sub ExportDataTableToCsv(target As DataTable, outputFile As String)
    Dim writer As New System.IO.StreamWriter(outputFile, False)
    For rowIndex As Integer = 0 To target.Rows.Count - 1
        For columnIndex As Integer = 0 To target.Columns.Count - 1
            Dim fieldValue As Object = target.Rows(rowIndex).Item(columnIndex)
            If Not IsDBNull(fieldValue) Then
                Dim output As String = fieldValue.ToString
                If output.Contains(","c) Then
                    writer.Write(ControlChars.Quote)
                    writer.Write(output)
                    writer.Write(ControlChars.Quote)
                Else
                    writer.Write(output)
                End If
            End If
            If columnIndex < target.Columns.Count - 1 Then
                writer.Write(",")
            End If
        Next
        If rowIndex < target.Rows.Count - 1 Then
            writer.WriteLine()
        End If
    Next
    writer.Close()
End Sub

Open in new window


http://social.msdn.microsoft.com/Forums/en-US/vblanguage/thread/d8a2ffc2-3782-46dc-bc97-e0b5cdf9ad29/
Avatar of Sony vv
Sony vv

test