I did something like this recently to take some spreadsheets (or rather 
tab-delimited data from them) and format it in LaTeX. I'm not a programmer, so 
my skills doing something like this are pretty crude. I used this bit of Lua 
code to pull data from a tab-delimited text file produced by Excel and read it 
into a Lua table. In your case, you could use the LuaXML library to write data 
from the table to a Docbook file as you see fit.

        function string:split( inSplitPattern, outResults )
                if not outResults then
                        outResults = { }
                end
                local theStart = 1
                local theSplitStart, theSplitEnd = string.find( self, 
inSplitPattern, theStart )
                while theSplitStart do
                        table.insert( outResults, string.sub( self, theStart, 
theSplitStart-1 ) )
                        theStart = theSplitEnd + 1
                        theSplitStart, theSplitEnd = string.find( self, 
inSplitPattern, theStart )
                end
                table.insert( outResults, string.sub( self, theStart ) )
                return outResults
        end
        
        -- table to hold data
        local data = {}
        
        local file = assert(io.open(arg[2], "r"), "Error error reading file")
        line = file:read("*line")
        
        repeat
                table.insert(data, line:split("\t"))
                line = file:read("*line")
        until line==nil
        file:flush()
        file:close()

Again, not elegant, but it worked out for me.

-David
<[email protected]>

-----Original Message-----
From: [email protected] [mailto:[email protected]] 
Sent: Thursday, August 16, 2012 3:24 AM
To: [email protected]
Subject: [docbook-apps] export from MS Excel to DocBook?

Hi all,

I've got a large number of text paragraphs in a Excel spreadsheet.

I think about to convert the entries of the spreadsheet cells to a docbook file 
using the XML capabilities of the newer Excel versions.

My Excel looks like this:

Heading 1       |               |               |               |
                | Text a        |               |               |
                | Text b        |               |               |
                |               | Heading 2     |               |       
                |               |               | Text c        |
                |               |               | Text d        |
                
This should go in something like this:


<section>
 <title>Heading 1</title>
 <para> Text a</para>
 <para> Text b</para>
 <section>
  <title>Heading 2</title>
  <para> Text a</para>
  <para> Text b</para>
 </section>
</section>

Has anybody any experience with this? Any pointers?

Best regards

Robert Bürgel

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to