Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
 

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: Suggestion for MSWord-viewer< Next Oldest | Next Newest >
reidar Offline





Group: Members
Posts: 92
Joined: Sep. 2004
Posted: Mar. 09 2005,09:24 QUOTE

I have made some suggestions for the DSL MSDoc converter/viewer, which includes a button for 'Edit'. This button converts the word-document into pure text and opens it up in the beaver text-editor. There you can edit the text, rewrite it and save it as a new document. Now, I would like to use Scite instead of Beaver here, because Scite can export text to RTF and HTML (the latter can be opened in FlWriter, the former in any wordprocessor), but I guess that is hard since Scite only exists as an extension now... (For which I am very sad by the way. I think Scite is far better than Beaver, although Beaver has a nice look.)

Here is my suggestion for new coding of wordview.lua (please bear with me, since this is my first attempt at working with lua. There might be errors in my coding, but it worked fine for me, so...):

Quote

#!/bin/flua
-- © 2005 Robert Shingledecker
-- GUI front end to Word viewer

function data_check()
 if input.value == "" then return nil end
 local file_check = openfile(input.value,"r")
 if not file_check then return nil end
 return ""
end

function convertFile()
 convertWin = Window{140,50,"Convert"}
 convertBox = Box{4,8,140,1; label=[[Pdf or Postscript?]]}
 pdfBtn = Button{0,25,70,25,"P&df"}
 function pdfBtn:callback()
   execute('/usr/bin/antiword -p a4 ' .. input.value .. ' > '.. input.value .. ".ps")
   execute('/usr/local/bin/ps2pdf ' .. input.value .. ".ps")
   remove(input.value .. ".ps")
   exit(0)
 end
 psBtn = Button{70,25,70,25,"&Ps"}
 function psBtn:callback()
   execute('/usr/bin/antiword -p letter ' .. input.value .. ' > '.. input.value .. ".ps")
   exit(0)
 end
 convertWin:end_layout()
 convertWin:show()
end


w = Window{400,75,"MSDoc Convert/Viewer"}
input = Input{100,10,210,25,"File:"}

help = Button{60,40,70,25,"&Help"}
function help:callback()
 w = Window{300,85,"Help"}
 box = Box{3,3,298,83,[[ DSL Word doc file Convert Viewer Utility.
It can directly view a doc file
or convert to Postscript.]]}
 box.box = Boxtype.up
 box.labelfont = Font.bold
 w:show()
end

convert = Button{130,40,70,25,"&Convert"}
function convert:callback()
 if data_check() then
   convertFile()
 else
   write(strchar(7)) flush()
 end
end

edit = Button{200,40,70,25,"&View"}
function edit:callback()
 if data_check() then
   workfile = tmpname()
   execute('/usr/bin/antiword -p a4 ' .. input.value .. ' > ' .. workfile)
   execute('/usr/local/bin/gvu -geometry 800x600 ' .. workfile)
   remove(workfile)
   exit(0)
 else
   write(strchar(7)) flush()
 end
end

view = Button{270,40,70,25,"&Edit"}
function view:callback()
 if data_check() then
   workfile = tmpname()
   execute('/usr/bin/antiword ' .. input.value .. ' > ' .. workfile)
   execute('/usr/bin/beaver ' .. workfile)
   remove(workfile)
   exit(0)
 else
   write(strchar(7)) flush()
 end
end

w:end_layout()
w:show()


As you can also see I couldn't resist changing the format of ps/pdf to a4 over letter, but that is just because I am Norwegian and a4 is our standard format...

-r
Back to top
Profile PM 
reidar Offline





Group: Members
Posts: 92
Joined: Sep. 2004
Posted: Mar. 09 2005,09:49 QUOTE

Sorry, there were a few minor misprints in the above codings. Here are the corrections, and I included a line that opens a pdf-file in xpdf once converted to pdf format:

Quote

#!/bin/flua
-- © 2005 Robert Shingledecker
-- GUI front end to Word viewer

function data_check()
 if input.value == "" then return nil end
 local file_check = openfile(input.value,"r")
 if not file_check then return nil end
 return ""
end

function convertFile()
 convertWin = Window{140,50,"Convert"}
 convertBox = Box{4,8,140,1; label=[[Pdf or Postscript?]]}
 pdfBtn = Button{0,25,70,25,"P&df"}
 function pdfBtn:callback()
   execute('/usr/bin/antiword -p a4 ' .. input.value .. ' > '.. input.value .. ".ps")
   execute('/usr/local/bin/ps2pdf ' .. input.value .. ".ps")
   execute('/usr/bin/xpdf ' .. input.value .. ".pdf")
   remove(input.value .. ".ps")
   exit(0)
 end
 psBtn = Button{70,25,70,25,"&Ps"}
 function psBtn:callback()
   execute('/usr/bin/antiword -p letter ' .. input.value .. ' > '.. input.value .. ".ps")
   exit(0)
 end
 convertWin:end_layout()
 convertWin:show()
end


w = Window{400,75,"MSDoc Convert/Viewer"}
input = Input{100,10,210,25,"File:"}

help = Button{60,40,70,25,"&Help"}
function help:callback()
 w = Window{300,85,"Help"}
 box = Box{3,3,298,83,[[ DSL Word doc file Convert Viewer Utility.
It can directly view a doc file
or convert to Postscript.]]}
 box.box = Boxtype.up
 box.labelfont = Font.bold
 w:show()
end

convert = Button{130,40,70,25,"&Convert"}
function convert:callback()
 if data_check() then
   convertFile()
 else
   write(strchar(7)) flush()
 end
end

view = Button{200,40,70,25,"&View"}
function view:callback()
 if data_check() then
   workfile = tmpname()
   execute('/usr/bin/antiword -p a4 ' .. input.value .. ' > ' .. workfile)
   execute('/usr/local/bin/gvu -geometry 800x600 ' .. workfile)
   remove(workfile)
   exit(0)
 else
   write(strchar(7)) flush()
 end
end

edit = Button{270,40,70,25,"&Edit"}
function edit:callback()
 if data_check() then
   workfile = tmpname()
   execute('/usr/bin/antiword ' .. input.value .. ' > ' .. workfile)
   execute('/usr/bin/beaver ' .. workfile)
   remove(workfile)
   exit(0)
 else
   write(strchar(7)) flush()
 end
end

w:end_layout()
w:show()


Hope this can be useful...

-r
Back to top
Profile PM 
cbagger01 Offline





Group: Members
Posts: 4264
Joined: Oct. 2003
Posted: Mar. 09 2005,22:59 QUOTE

I'm sure that there must be a command-line text to html converter program out there.

But I would expect that you could opern the raw text file in flwriter, but I have not tried this yet.
Back to top
Profile PM 
reidar Offline





Group: Members
Posts: 92
Joined: Sep. 2004
Posted: Mar. 10 2005,07:22 QUOTE

There is at least one text to html converter around. It is called 'txt2html' and is available through apt-get. But I find it strange that it is not possible to open pure text files in flwriter (if it isn't...).

If this really is not possible, which I find somewhat hard to believe, I would vote for bringing back scite, which has export filters for RTF and HTML (and a few more in later versions)!

-r
Back to top
Profile PM 
3 replies since Mar. 09 2005,09:24 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

 
reply to topic new topic new poll
Quick Reply: Suggestion for MSWord-viewer

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code