FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour FullTextSearch in docx
Posts: 6984
Joined: Fri Oct 07, 2005 07:07 PM
FullTextSearch in docx
Posted: Sat Dec 19, 2009 07:54 PM
Today I had the necessity to search for a text inside different docx-files in a folder.
As I didn’t found any tool I wrote a small program to convert docx to xml.
Best regards,
Otto



Code (fw): Select all Collapse
function docx2xml
   local a_dir := directory( "*.docx", "D" )
   local cDirLocal := cFilePath( GetModuleFileName( GetInstance() ) )
   local cFileName := ""
   local I := 0
   local cDst := ""
   local cSrc := ""
   *----------------------------------------------------------

   msginfo("Docx-Dateien in xml umwandeln " + cDirLocal)

   FOR I := 1 to len(a_dir)
      cFileName := left( a_dir[I,F_NAME], (len(a_dir[I,F_NAME]) - 5 ) )
      cDst := ( cDirLocal +  cFileName )

      //temp Verzeichnis anlegen
      lMKDir(cDst)
      cSrc :=  cDirLocal + a_dir[I,F_NAME]       
      filcopyraw( cSrc, cDst + "\temp.zip" )
      DCOM  := '7Z.exe x '  + cDst + "\temp.zip" + " -o" +  cDst  + " *.* -r"

      WAITRUN(DCOM,0)
      SYSREFRESH()

   NEXT   

   msginfo("Ende")

return nil

Continue the discussion