C
confused
Hello;
Can someone please tell me how to write the code I need to use word
wrap.
I have a vb 2005 app that exports the data into excel and I want the
data in each row to use word wrap for every text columm. The code
below only sets the column heading, I thought it would set all column
per row
(example cloumn a1 is name so all rows for a1 should be set with word
wrap)
SetColumnsFormat(oExcel)
Private Function SetColumnsFormat(ByVal oExcel As Object) As Boolean
For i As Integer = 0 To lstColumnsSelected.Items.Count - 1
Application.DoEvents()
Dim myExcel As Excel_ = oExcel
Dim col As dcColumn
col = lstColumnsSelected.Items.Item(i)
Dim nmLwr As String = col.Name.ToLower()
Select Case col.Type
Case 1
' Text Type R,Col Width
myExcel.WrapText(1, i + 1, True)
Continue For
Case 2 ' Date Type
myExcel.FormatWidth(1, i + 1, col.Width)
Continue For
Case 3 ' Hours Col Format
myExcel.FormatNum(i + 1, "###0")
myExcel.FormatWidth(1, i + 1, col.Width)
Continue For
Case 4 ' Money
myExcel.FormatNum(i + 1, "###,##0.00")
myExcel.FormatWidth(1, i + 1, col.Width)
Continue For
Case 5 ' Months
myExcel.FormatNum(i + 1, "##0.0")
myExcel.FormatWidth(1, i + 1, col.Width)
Continue For
Case Else
myExcel.FormatWidth(1, i + 1, col.Width)
End Select
Next i
End Function
What am I doing wrong?
Can someone please tell me how to write the code I need to use word
wrap.
I have a vb 2005 app that exports the data into excel and I want the
data in each row to use word wrap for every text columm. The code
below only sets the column heading, I thought it would set all column
per row
(example cloumn a1 is name so all rows for a1 should be set with word
wrap)
SetColumnsFormat(oExcel)
Private Function SetColumnsFormat(ByVal oExcel As Object) As Boolean
For i As Integer = 0 To lstColumnsSelected.Items.Count - 1
Application.DoEvents()
Dim myExcel As Excel_ = oExcel
Dim col As dcColumn
col = lstColumnsSelected.Items.Item(i)
Dim nmLwr As String = col.Name.ToLower()
Select Case col.Type
Case 1
' Text Type R,Col Width
myExcel.WrapText(1, i + 1, True)
Continue For
Case 2 ' Date Type
myExcel.FormatWidth(1, i + 1, col.Width)
Continue For
Case 3 ' Hours Col Format
myExcel.FormatNum(i + 1, "###0")
myExcel.FormatWidth(1, i + 1, col.Width)
Continue For
Case 4 ' Money
myExcel.FormatNum(i + 1, "###,##0.00")
myExcel.FormatWidth(1, i + 1, col.Width)
Continue For
Case 5 ' Months
myExcel.FormatNum(i + 1, "##0.0")
myExcel.FormatWidth(1, i + 1, col.Width)
Continue For
Case Else
myExcel.FormatWidth(1, i + 1, col.Width)
End Select
Next i
End Function
What am I doing wrong?