'--------------------------------------------------- ' mm2html Is free software; you can redistribute it And/Or ' modify it under the terms of the GNU General Public License ' As published by the Free Software Foundation. ' ' This software Is distributed In the hope that it will be useful, ' but WITHOUT Any WARRANTY; without even the implied warranty of ' MERCHANTABILITY Or FITNESS For A PARTICULAR PURPOSE. ' ' Author: Clemens Kraus (c@clemens-kraus.de) ' Description: export MindManager to HTML '--------------------------------------------------- Dim headertext As String Dim bodyheadertext As String Dim bodyfootertext As String Dim zusammenfassung As String Dim title As String Dim CLPtr As Integer 'Current (Menu-)Level Pointer Sub Main Dim MindDoc As Document Dim aBranch As Branch Dim FileName As String Dim NewName As String Dim fileId As Integer headertext = "" bodyheadertext = "" bodyfootertext = "" zusammenfassung = "" title = "" fileId = FreeFile CLPtr = 1 'Determine if there is a document open in MindManager If Documents.Count > 0 Then 'Assign the active document to our "MindDoc-object variable" Set MindDoc = ActiveDocument Else MsgBox("Kann nicht weitermachen, kein Dokument ist geöffnet.", vbCritical) End ' End script execution since no document is open End If FileName = ActiveDocument.FullName NewName = Left$(FileName, Len(FileName)-4) FileName = GetFilePath$( NewName, "html", , "Exportieren als", 3) If Len(FileName) < 1 Then FileName = "F:\temp\testfile.txt" End If Set aBranch = ActiveDocument.MapTitle() aBranch.Select ' Merke Titel title = aBranch.Text ' Merke Zusammenfassung zusammenfassung = aBranch.TextNotes.Text ' Schreibe HTML Open FileName For Output As #fileId Print #fileId, " Print #fileId, "" Print #fileId, "" ' Los gehts !! Call ConvertBranch(MindDoc, aBranch, fileId) Print #fileId, bodyfootertext Print #fileId, "" Print #fileId, "" Close #fileId Set aBranch = ActiveDocument.MapTitle() End Sub ' Konvertiere alle MindManager Aeste Function ConvertBranch(ByVal doc As Document, ByVal aBranch As Branch, fileId As Integer) Dim NextBranch As Branch Dim AstNr As Integer For AstNr = 1 To aBranch.Count Set NextBranch = aBranch.Item(AstNr) NextBranch.Select CLPtr = CLPtr + 1 'Debug.Print "CLPtr: ";CLPtr ConvertBranchToTopic( NextBranch, fileId) Call ConvertBranch( doc, NextBranch, fileId ) '<-- Recursivity CLPtr = CLPtr - 1 Next AstNr End Function ' Konvertiere einen MindManager Ast Function ConvertBranchToTopic(ByVal aBranch As Branch, fileId As Integer) Dim topicId As String Dim smalltopicId As String topicId = aBranch.Text smalltopicId = LCase(topicId) If (smalltopicId="body" And bodyheadertext<>"") Then ' Tue nichts! ElseIf (smalltopicId="header" And LCase(aBranch.ParentBranch.Text)<>"body") Then ' Schreibe Header headertext = aBranch.TextNotes.Text Print #fileId, "" Print #fileId, headertext Print #fileId, "" ElseIf (smalltopicId="header" And LCase(aBranch.ParentBranch.Text)="body") Then ' Schreibe Bodyheader bodyheadertext = aBranch.TextNotes.Text Print #fileId, "" Print #fileId, bodyheadertext Print #fileId, "

"+title+"

" ' Schreibe Zusammenfassung Print #fileId, "
" Print #fileId, "Zusammenfassung:
" Print #fileId, zusammenfassung Print #fileId, "

" Print #fileId, "" ElseIf (smalltopicId="footer" And LCase(aBranch.ParentBranch.Text)="body") Then ' Merke Bodyfooter bodyfootertext = aBranch.TextNotes.Text ElseIf (smalltopicId="notes" Or smalltopicId="body") Then ' Tue nichts! Else Dim baseNameString As String baseNameString = aBranch.Text ' Titel übernehmen If Len(aBranch.Hyperlink) > 0 Then ' Ist es ein Hyperlink ? Print #fileId, "

"+baseNameString+"" ElseIf Len(aBranch.Bookmark) > 0 Then ' oder ein Bookmark ? Print #fileId, "" Print #fileId, ""+baseNameString+"" Else ' ist ganz normal Print #fileId, ""+baseNameString+"" End If ' Textnotizen vorhanden ? If Len(aBranch.TextNotes.Text) > 0 Then Dim buf As String buf = aBranch.TextNotes.Text buf = Replace$(buf, Chr$(13), "") 'LF Print #fileId, Replace$(buf, Chr$(10), vbCrLf+"

"+vbCrLf) 'CR End If End If End Function