hi andrew, wpd.devel,

Andrew Ziem <[EMAIL PROTECTED]> writes:

> Fridrich Strba wrote:
> > Even the most ugly code that has some desired functionality is worth
> > showing. IMHO, technical discussions around an existing, though
> > imperfect, code are really useful for one's growth  And I know what I
> > am saying when I speak about imperfect code from my own hacking
> > experience 
> >   
> Then here's the proposed ugly code.  So far, not much to look at.  This 
> code was just an experiment.
> 
> Andrew
> 
> Attachment (wps_test.cpp): text/x-c++src, 12 KiB
> 
> 
> all: wps_test
> 
> wps_test: wps_test.cpp
>       g++ -o wps_test wps_test.cpp `pkg-config glib-2.0 --cflags`
-I/usr/include/libgsf-1 -L/usrlib -g
> -Wall -lgsf-1 

Andrew: thanks for writing and distributing this package!! :)

After spending a half-day trying to use updated versions of ooffice and 
abiword and googling (even installing wine in order to try the "chapter 14
of the userguide" hack recommended by ooffice people - which involves
downloading two m$ zero-cost .exe files and trying to install them,
but i failed anyway), i eventually found this discussion thread 
(gmane.comp.lib.wpd.devel).

My (single) test of the wps_test package came out fine. :)

i had to install libgsf-1-dev - i'm on debian sarge so it took just a 
moment. Then  make  compiled with no errors and   
  wps_test [filename].wps 

created the text file.  The first part (and scrolling through) suggests 
that wps_test at least works OK on what seems to be "works" v8.


debug: opening [filename].wps
Works version 8 (Suite 2005) format
vers ? = aeh (174)
header = TEXT
header = TEXT
text length = 1855364 (1c4f84h)
outbytesleft starts = 3710728
result =  [filename]


Incidentally, i initially didn't find the wps_test package online, 
and so wrote a one line sed script.

In case someone needs something really quick and dirty and/or doesn't
have a c++ compiler and/or can't install the libgsf-1-dev library, 
here's my one line script which cleaned the file up enough that 
with emacs i could then just remove the stuff which was clearly
non-text: 


sed -e 's/\x00//g' filename | sed -e 's/\x0d/\x0a/g' | sed -e "s/\cy/'/g" 


The first part is the most important - removing the zero bytes between 
letters. AFAIR, msword (6 and 7?) can be largely cleaned up by the same
sed -e 's/\x00//g'.  The second part is ^M to ^J, the final bit is ^Y
to apostrophes.

Of course, this sed ignores all the formatting, but for anyone just wanting
to read a text, this should be enough.  A bit of cleaning up using
M-x query-replace-regexp  in emacs then is enough to convert non-ISO
characters to ISO.

i'm not sure if any licence is needed on the above code fragment - 
if any licence is needed, consider it licenced GPL or email me if an
alternative free licence is needed.

cheers and long live free (libre) software :)
boud





-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Libwpd-devel mailing list
Libwpd-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libwpd-devel

Reply via email to