root/trunk/lib/picolena/templates/lib/plain_text_extractors/opendocument.spreadsheet.rb

Revision 178, 511 bytes (checked in by eric.dumin..@gmail.com, 6 months ago)

Filters have been renamed to PlainTextExtractors?.

Filter is a Rails protected name.

  • Property svn:executable set to *
Line 
1 # Open Document Spreadsheet to text conversion
2
3 require 'zip/zip'
4 PlainTextExtractor.new {
5   every :ods
6   as 'application/vnd.oasis.opendocument.spreadsheet'
7   aka "Open Document Format for spreadsheet"
8   with {|source|
9     Zip::ZipFile.open(source){|zipfile|
10       zipfile.read("content.xml").split(/</).grep(/^text:(p|span)/).collect{|l|
11         l.sub(/^[^>]+>/,'')
12       }.join("\n")
13     }
14   }
15   which_should_for_example_extract 'Cessna F-172P G-BIDF, serial number 2045', :from => 'weight_and_balance.ods'
16 }
Note: See TracBrowser for help on using the browser.