# KOffice filters status: CSV - Comma Separated Values

Import | Export
Up

Import CSV for kword
Last update | 9 jan 2001
Features | - Can import CVS documents
Todo | - Automatically adjust the columns width to their contents. Will be difficult, as we don't know the font used... Solution ? Set a default font _in_ the filter, and use it to compute the width...
History | -
Authors | David Faure Werner Trobin
Links | -
Progress report | ## Design
    The CSV import filter uses a hand-made state machine to parse the CSV file.
    This allows to handle quoted fields (such as those containing the CSV delimiter),
    as well as the double-quote character itself (which then appears twice, and
    always in a quoted field).
    Just to make sure about the vocabulary, I call a quoted field a field
    starting with " and finishing with ".

    Let's try to draw the graph of the state machine using ascii-art.

             DEL or EOL
                /--\
                |  |
                |  v    "
           /--[START]-------->[QUOTED_FIELD] (**)
      other|   ^   ^            |        ^
       (*) |   |   | DEL or     | "      | " (*)
           |   |   | EOL        v        |           other
           |   |   \----[MAYBE_END_OF_QUOTED_FIELD]--------> Error
           |   |
           |   | DEL or
           |   | EOL
           v   |
       [NORMAL_FIELD] (**)

    DEL  : CSV delimiter (depends on locale !). Often comma, sometimes semicolon.
    EOL  : End Of Line.
    (*)  : added to the current field
    (**) : implicit loop on itself, labeled "other (*)"

    Ugly isn't it ? :) One can't be good in drawings AND in hacking :)

    That's all. For the rest, see csvfilter.cc

    David Faure <faure@kde.org>, 1999

Up

Up

Export kword to CSV
Last update | ?
Features | ?
Todo | ?
History | -
Authors | David Faure Werner Trobin
Links | -
Progress report | ---

Up