Sub aa()
Dim i As Integer
Dim strData, str1, str2, str3, str4, str5, strtmp As String
Dim strcomment As String
startRow = 0
str1 = "@Schema(title = ""$$"")"
str2 = "@Column(name = ""$1"", columnDefinition = ""$2 DEFAULT NULL COMMENT '$3 ' "")"
str3 = "private String eventVersion;"
str4 = "@Column(name = ""$1"", columnDefinition = ""$2 COMMENT '$3 ' "")"
For i = 2 To 1000
If Cells(i, 1) = "カラム名 (?理名)" Then
startRow = i + 1
End If
Next
strData = ""
startRow = 7
If startRow > 0 Then
For i = startRow To 1000
If (Cells(i, 1) = "") Then
Exit For
End If
strData = strData & Chr(13) & Replace(str1, "$$", Cells(i, 1))
If Cells(i, 7) = "○" Then
str5 = str2
Else
str5 = str4
End If
strcomment = Replace(Cells(i, 13), Chr(10), "")
If Cells(i, 3) = "int" Then
strtmp = Replace(str5, "$1", Cells(i, 2))
strtmp = Replace(strtmp, "$2", "Integer")
strtmp = Replace(strtmp, "$3", strcomment)
strData = strData & Chr(13) & strtmp
strData = strData & Chr(13) & "private Integer " & tuoFeng(LCase(Cells(i, 2))) & ";"
ElseIf Cells(i, 3) = "timestamp" Then
strtmp = Replace(str5, "$1", Cells(i, 2))
strtmp = Replace(strtmp, "$2", "datetime")
strtmp = Replace(strtmp, "$3", strcomment)
strData = strData & Chr(13) & strtmp
strData = strData & Chr(13) & "private Date " & tuoFeng(LCase(Cells(i, 2))) & ";"
ElseIf InStr(1, Cells(i, 3), "varchar") > 0 Then
strtmp = Replace(str5, "$1", Cells(i, 2))
strtmp = Replace(strtmp, "$2", "varchar(" & Cells(i, 4) & ")")
strtmp = Replace(strtmp, "$3", strcomment)
strData = strData & Chr(13) & strtmp
strData = strData & Chr(13) & "private String " & tuoFeng(LCase(Cells(i, 2))) & ";"
Else
strData = strData & Chr(13) & "eror line " & Cells(i, 2) & ";"
End If
strData = strData & Chr(13)
Next
End If
Debug.Print strData
'Debug.Print Str(Add1(1, 2))
End Sub
Function Add1(num1 As Integer, num2 As Integer) As Integer
Add1 = num1 + num2
End Function
Function tuoFeng(num1 As String) As String
Dim preValue, finValue As String
preValue = num1
finValue = Replace(preValue, "_", " ")
finValue = StrConv(finValue, vbProperCase)
finValue = Replace(finValue, " ", "")
finValue = LCase(Left(finValue, 1)) & Right(finValue, Len(finValue) - 1)
tuoFeng = finValue
End Function