RE: [docbook-apps] export from MS Excel to DocBook?

From
David Goss <>
Date
2012-08-16T15:31:08+00:00
ID
Thread
RE: [docbook-apps] export from MS Excel to DocBook?
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
<>

-----Original Message-----
From:  [mailto:] 
Sent: Thursday, August 16, 2012 3:24 AM
To: 
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: 
For additional commands, e-mail: