| 1 |
-- Finds text in OpenDocument Text (.odt) |
| 2 |
-- Requires: odt2txt tool |
| 3 |
|
| 4 |
function ContentGetSupportedField(Index) |
| 5 |
if (Index == 0) then |
| 6 |
return 'Text','', 9; -- FieldName,Units,ft_fulltext |
| 7 |
end |
| 8 |
return '','', 0; -- ft_nomorefields |
| 9 |
end |
| 10 |
|
| 11 |
function ContentGetDetectString() |
| 12 |
return '(EXT="ODT")'; -- return detect string |
| 13 |
end |
| 14 |
|
| 15 |
function ContentGetValue(FileName, FieldIndex, UnitIndex, flags) |
| 16 |
|
| 17 |
if (FieldIndex > 0) then |
| 18 |
return nil; |
| 19 |
end |
| 20 |
|
| 21 |
if (UnitIndex == 0) then |
| 22 |
local f = io.popen ("odt2txt " .. FileName, 'r') |
| 23 |
|
| 24 |
if not f then |
| 25 |
return nil; |
| 26 |
end |
| 27 |
|
| 28 |
local ss = f:read("*a") |
| 29 |
f:close() |
| 30 |
|
| 31 |
return ss; |
| 32 |
end; |
| 33 |
|
| 34 |
return nil; |
| 35 |
end |