Kaydet (Commit) 0358cc51 authored tarafından Jean-Pierre Ledure's avatar Jean-Pierre Ledure

Access2Base - OutputTo binary fields as null fields

Do not skip temanymore

Change-Id: I6a1276959ab940eb44aedeab2f1c9cc7f71a0e1e
üst 5e07e1be
...@@ -1032,8 +1032,8 @@ Private Function _OutputDataToHTML(poTable As Object, piFile As Integer) As Bool ...@@ -1032,8 +1032,8 @@ Private Function _OutputDataToHTML(poTable As Object, piFile As Integer) As Bool
' Exit when error without execution stop (to avoid file remaining open ...) ' Exit when error without execution stop (to avoid file remaining open ...)
Dim oTableRS As Object, vData() As Variant, i As Integer, j As Integer Dim oTableRS As Object, vData() As Variant, i As Integer, j As Integer
Dim vFieldsSkip() As Variant, iDataType As Integer, iNumRows As Integer, iNumFields As Integer, vDataCell As Variant Dim vFieldsBin() As Variant, iDataType As Integer, iNumRows As Integer, iNumFields As Integer, vDataCell As Variant
Dim vTrClass() As Variant, vTdClass As Variant, iCountRows As Integer, iLastRow As Integer, iFirstCol As Integer, iLastCol As Integer Dim vTrClass() As Variant, vTdClass As Variant, iCountRows As Integer, iLastRow As Integer
Const cstMaxRows = 200 Const cstMaxRows = 200
On Local Error GoTo Error_Function On Local Error GoTo Error_Function
...@@ -1041,20 +1041,14 @@ Const cstMaxRows = 200 ...@@ -1041,20 +1041,14 @@ Const cstMaxRows = 200
Print #piFile, " <caption>" & poTable._Name & "</caption>" Print #piFile, " <caption>" & poTable._Name & "</caption>"
Set oTableRS = poTable.OpenRecordset( , , dbReadOnly) Set oTableRS = poTable.OpenRecordset( , , dbReadOnly)
vFieldsSkip() = Array() vFieldsBin() = Array()
iNumFields = oTableRS.Fields.Count iNumFields = oTableRS.Fields.Count
ReDim vFieldsSkip(0 To iNumFields - 1) ReDim vFieldsBin(0 To iNumFields - 1)
With com.sun.star.sdbc.DataType With com.sun.star.sdbc.DataType
iFirstCol = -1
iLastCol = -1
For i = 0 To iNumFields - 1 For i = 0 To iNumFields - 1
iDataType = oTableRS.Fields(i).DataType iDataType = oTableRS.Fields(i).DataType
vFieldsSkip(i) = False vFieldsBin(i) = False
If iDataType = .BINARY Or iDataType = .VARBINARY Or iDataType = .LONGVARBINARY Or iDataType = .BLOB Or iDataType = .CLOB Then vFieldsSkip(i) = True If iDataType = .BINARY Or iDataType = .VARBINARY Or iDataType = .LONGVARBINARY Or iDataType = .BLOB Or iDataType = .CLOB Then vFieldsBin(i) = True
If Not vFieldsSkip(i) Then
If iFirstCol < 0 Then iFirstCol = i
iLastCol = i
End If
Next i Next i
End With End With
...@@ -1062,9 +1056,7 @@ Const cstMaxRows = 200 ...@@ -1062,9 +1056,7 @@ Const cstMaxRows = 200
Print #piFile, " <thead>" Print #piFile, " <thead>"
Print #piFile, " <tr>" Print #piFile, " <tr>"
For i = 0 To iNumFields - 1 For i = 0 To iNumFields - 1
If Not vFieldsSkip(i) Then Print #piFile, " <th scope=""col"">" & .Fields(i)._Name & "</th>"
Print #piFile, " <th scope=""col"">" & .Fields(i)._Name & "</th>"
End If
Next i Next i
Print #piFile, " </tr>" Print #piFile, " </tr>"
Print #piFile, " </thead>" Print #piFile, " </thead>"
...@@ -1088,9 +1080,9 @@ Const cstMaxRows = 200 ...@@ -1088,9 +1080,9 @@ Const cstMaxRows = 200
Print #piFile, " <tr" & _OutputClassToHTML(vTrClass) & ">" Print #piFile, " <tr" & _OutputClassToHTML(vTrClass) & ">"
For i = 0 To iNumFields - 1 For i = 0 To iNumFields - 1
vTdClass() = Array() vTdClass() = Array()
If i = iFirstCol Then vTdClass() = _AddArray(vTdClass, "firstcol") If i = 0 Then vTdClass() = _AddArray(vTdClass, "firstcol")
If i = iLastCol Then vTdClass() = _AddArray(vTdClass, "lastcol") If i = iNumFields - 1 Then vTdClass() = _AddArray(vTdClass, "lastcol")
If Not vFieldsSkip(i) Then If Not vFieldsBin(i) Then
vDataCell = vData(i, j) vDataCell = vData(i, j)
Select Case VarType(vDataCell) Select Case VarType(vDataCell)
Case vbEmpty, vbNull Case vbEmpty, vbNull
...@@ -1112,6 +1104,8 @@ Const cstMaxRows = 200 ...@@ -1112,6 +1104,8 @@ Const cstMaxRows = 200
Case Else Case Else
Print #piFile, " <td" & _OutputClassToHTML(vTdClass) & ">" & _CStr(vDataCell) & "</td>" Print #piFile, " <td" & _OutputClassToHTML(vTdClass) & ">" & _CStr(vDataCell) & "</td>"
End Select End Select
Else ' Binary fields
Print #piFile, " <td" & _OutputClassToHTML(vTdClass) & ">" & _OutputBinaryToHTML() & "</td>"
End If End If
Next i Next i
Print #piFile, " </tr>" Print #piFile, " </tr>"
...@@ -1132,7 +1126,15 @@ Error_Function: ...@@ -1132,7 +1126,15 @@ Error_Function:
TraceError(TRACEWARNING, Err, "_OutputDataToHTML", Erl) TraceError(TRACEWARNING, Err, "_OutputDataToHTML", Erl)
_OutputDataToHTML = False _OutputDataToHTML = False
Resume Exit_Function Resume Exit_Function
End Function ' _OutputDataToHTML End Function ' _OutputDataToHTML V1.4.0
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _OutputBinaryToHTML() As String
' Converts Binary value to HTML compatible string
_OutputBinaryToHTML = " "
End Function ' _OutputBinaryToHTML V1.4.0
REM ----------------------------------------------------------------------------------------------------------------------- REM -----------------------------------------------------------------------------------------------------------------------
Private Function _OutputDateToHTML(ByVal psDate As Date) As String Private Function _OutputDateToHTML(ByVal psDate As Date) As String
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment