Benutzer-Werkzeuge

Webseiten-Werkzeuge


pc:excel2wiki

Exceltabelle ins Wiki- Format

Um mal eben eine Excel- Tabelle ins DokuWiki- Format zu kriegen, eignet sich folgende kleine VBA- Function:

Function formatAsWikiTable(fields As Range, format As String, header As Boolean)
    ' format (like 'llcr' tells the allignment of cells: l=left, r=right, c= center default: left
    ' header: creates headerline if true
    Dim result As String
    colCount = 1
    format = LCase(format)
    For Each i In fields
        f = Mid(format, colCount, 1)
        If f = "r" Then
            lspace = "  "
            rspace = " "
        Else
            If f = "c" Then
                lspace = "  "
                rspace = "  "
            Else
                lspace = " "
                rspace = "  "
            End If
        End If
        If header Then
            sep = "^"
        Else
            sep = "|"
        End If
        result = result & sep & lspace & i.Value & rspace
        colCount = colCount + 1
    Next
    result = result & sep
    formatAsWikiTable = result
End Function
pc/excel2wiki.txt · Zuletzt geändert: 2014/03/23 09:07 von admin