English
Source / code snippets

DOCX Files read

 

Sven
Bader
for a Full text search have I these function written, with adjustments functions it too with XLSX, PPTX, ODT, ODP, ODS and PAGES. one must letztendlich The File entzippen and the korrekte XML therein identify. with XLSX is it something verzweigter.

Profan compatibility:
The Unzip functions ex X4, before it must one itself a DLL for search
Utf8_Decode goes ex X3, before it can itself something with Translate$() zusammenbauen, the at least frequent characters How Umlaute supplant.


Proc ReadDocx

    Parameters inputFile$
    Declare content$, filesize&, tempFile$, B#
    tempFile$ =  $TempDir + "docxopener" + "\\word\\document.xml"
    'Entpacken

    ifnot (FileExists(inputFile$))

        Print inputFile$;" not found!"
        Return

    endif

    UnZip  inputFile$, ($TempDir + "docxopener") ,"word\document.xml"
    filesize& = FileSize(tempFile$)

    if (filesize& < 0)

        Print "Error at Entpacken!"
        Return

    endif

    'reading
    Dim B#, filesize& + 1
    Assign #1, tempFile$
    OpenRW #1
    BlockRead(#1, B#, 0, filesize&)
    Erase #1
    Close #1
    content$ = String $(B#,0)
    'Beautiful make
    content$ = Utf8Decode(content$)
    content$ = Translate$(content$,"<w:p","\n<w:p")'Paragraph Start DOCX
    content$ = Translate$(content$,":p>",":p>\n\n")'Paragraph end
    content$ = Translate$(content$,":tab/>",":tab/> ")'tab
    content$ = Translate$(content$,":br/>",":br/>\n")'Break
    content$ = Translate$(content$,":line-break/>",":line-break/>\n")'Break
    content$ = Translate$(content$,"  "," ")
    Set("RegEx", 1)
    content$ = Translate$(content$,"<[^>]*>","")'Strip Tags
    Set("RegEx", 0)
    content$ = Trim $(content$)
    Return content$

ENDPROC

Cls
messagebox ReadDocx("test.docx") ,"",0
Waitinput
End

193 kB
Bezeichnung:Screenshot docx
Hochgeladen:07/11/21
Downloadcounter74
Download
11 kB
Bezeichnung:Quelltext und test.docx
Version:1.0
Hochgeladen:07/11/21
Downloadcounter61
Download
 
07/11/21  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

1.524 Views

Untitledvor 0 min.
Sven Bader12/22/22
Torsten Boo06/09/22
p.specht11/18/21
RudiB.11/18/21
More...

Themeninformationen

this Topic has 1 subscriber:

Sven Bader (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie