Subject: I see table in browser and client
In Client I see the table and in a Browser I see the table…
With this API ( that I use in Client and write in a File TXT I don’t see the TAG …But
)
This Is the code ( It’s egual to Julian )
If I use the “HtmlConvertNote” on the same document…I see the TAG HTML but with all the other information…
Declaration:
Declare Function OSPathNetConstruct Lib “NNOTES” Alias “OSPathNetConstruct” _
( Byval NullPort As Long, Byval Server As String, Byval FIle As String, _
Byval PathNet As String) As Integer
Declare Function NSFDbOpen Lib “NNOTES” Alias “NSFDbOpen” _
( Byval PathName As String, DbHandle As Long) As Integer
Declare Function NSFDbClose Lib “NNOTES” Alias “NSFDbClose” _
( Byval DbHandle As Long) As Integer
Declare Function HTMLCreateConverter Lib “NNOTES” Alias “HTMLCreateConverter” _
( HtmlHandle As Long) As Integer
Declare Function HTMLDestroyConverter Lib “NNOTES” Alias “HTMLDestroyConverter” _
( Byval HtmlHandle As Long) As Integer
Declare Function HTMLConvertNote Lib “NNOTES” Alias “HTMLConvertNote” _
( Byval HtmlHandle As Long, Byval DbHandle As Long, Byval NoteHandle As Long, _
Byval UrlArgsCount As Long, Byval NullUrlArgs As Long) As Integer
Declare Function HTMLGetPropertyLong Lib “NNOTES” Alias “HTMLGetProperty” _
( Byval HtmlHandle As Long, Byval PropertyType As Long, RetVal As Long) As Integer
Declare Function HTMLGetText Lib “NNOTES” Alias “HTMLGetText” _
( Byval HtmlHandle As Long, Byval StartingOffset As Long, TextLength As Long, _
Byval RetVal As String) As Integer
Declare Function HTMLConvertItem Lib “NNOTES” Alias “HTMLConvertItem”_
( Byval HtmlHandle As Long, Byval DbHandle As Long, Byval NoteHandle As Long, _
Byval FiledItem As String) As Integer
'** Error code masks
Const ERR_MASK = &H3fff
Const PKG_MASK = &H3f00
Const ERRNUM_MASK = &H00ff
Declare Function OSLoadString Lib “nnotes.dll” (Byval hModule As Long, Byval stringCode As Integer, _
Byval retBuffer As String, Byval bufferLength As Integer) As Integer
Function
Function ConvertItemToHtml(doc As NotesDocument, itemname As String) As String
'** create a proper network path name with OSPathNetConstruct
Dim db As NotesDatabase
Dim hDb As Long
Dim pathName As String
Set db = doc.ParentDatabase
pathName = String(256, " ")
Call OSPathNetConstruct(0, db.Server, db.FilePath, pathName)
'** open the database and get a handle with NSFDbOpen (if you're doing this
'** to a lot of documents, you should try to only open the database once)
Dim result As Integer
result = NSFDbOpen(pathName, hDb)
If result <> 0 Then
Messagebox "Cannot open database " & db.FilePath & " on server " & db.Server & _
". Error was " & Cstr(result) & ": " & GetAPIError(result)
Exit Function
End If
'** create an HTML Converter
Dim converter As Long
result = HtmlCreateConverter(converter)
If result <> 0 Then
Messagebox "Cannot create HTML Converter" & _
". Error was " & Cstr(result) & ": " & GetAPIError(result)
Goto closeDb
End If
'** convert the doc to HTML (I'm taking a shortcut with doc.Handle here;
'** you may want to consider using NSFNoteOpen or similar)
result = HTMLConvertItem(converter, hDB, doc.Handle, itemname)
If result <> 0 Then
Messagebox "Cannot convert note " & doc.UniversalID & " to HTML" & _
". Error was " & Cstr(result) & ": " & GetAPIError(result)
Goto destroyConverter
End If
'** figure out how long the resulting HTML is
Dim textLength As Long
result = HtmlGetPropertyLong(converter, 0, textLength)
If result <> 0 Then
Messagebox "Cannot determine HTML Converter text length" & _
". Error was " & Cstr(result) & ": " & GetAPIError(result)
Goto destroyConverter
End If
'** send the converted HTML to a string
Dim finalString As String
Dim chunk As String
Dim chunkSize As Long
Dim startPos As Long
chunkSize = 1024 '** adjust chunkSize to meet your comfort level
Do While (startPos < textLength)
If ((textLength - startPos) < chunkSize) Then
chunkSize = textLength - startPos
End If
chunk = String(chunkSize, " ")
result = HtmlGetText(converter, startPos, chunkSize, chunk)
If result <> 0 Then
Messagebox "Cannot get HTML text between " & startPos & " and " & (startPos + chunkSize) & _
". Error was " & Cstr(result) & ": " & GetAPIError(result)
Goto destroyConverter
End If
finalString = finalString & Left(chunk, chunkSize)
startPos = startPos + chunkSize
Loop
ConvertItemToHtml = finalString
'** this is API work, so make sure you do the appropriate cleanup when you’re done
destroyConverter:
Call HTMLDestroyConverter(converter)
closeDb:
Call NSFDbClose(hDb)
endOfFunction:
Exit Function
End Function