SDK has methods for exporting to .csv. We would like to change the delimiter character to a comma, which is not one of the options. Has anyone written code to support this?
Please find some code I wrote a long time agoo to do that kind of thing. I'm sure you will modify it to fit your needs but I think it could be a good start!
I hope it will help.
Cheers,
Sub Main()
Dim i As Integer
Dim j As Integer
Dim k As Integer
Dim L As Integer
Dim Doc As Document
Dim DP As DataProvider
Dim str As String
Dim File
Dim Sep2 As String
Set Doc = ActiveDocument
For i = 1 To Doc.DataProviders.Count
Sep = InputBox("Please specify your separator for the dataprovider " & Doc.DataProviders.Item(i).Name)
File = InputBox("Please specify a file location for the dataprovider " & Doc.DataProviders.Item(i).Name)
Open File For Output As #1
Set DP = Doc.DataProviders.Item(i)
str = ""
For j = 1 To DP.Columns.Count
'DP.Columns.Item(i).Name
If j = DP.Columns.Count Then Sep2 = "" Else Sep2 = Sep
str = str & DP.Columns.Item(j).Name & Sep2
Next j
'Write the columns name in the text file
Print #1, str
str = ""
For k = 1 To DP.Columns.Item(i).Count
str = ""
For L = 1 To DP.Columns.Count
If DP.Columns.Item(L).Item(k) = "#EMPTY" Then Chain = " " Else Chain = DP.Columns.Item(L).Item(k)
If L = DP.Columns.Count Then Sep2 = "" Else Sep2 = Sep
str = str & Chain & Sep2
Next L
'Write the column contents
Print #1, str
Next k
Close #1
Next i
End Sub
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.