Uploading MS WORD and extracting Line Count Information

I will be developing a site where I will be uploading MS Word documents and recording their demographics in a mySQL database. MS Word documents contain line counts, number of characters, words, etc… How can I extract that information during the upload and record it into the database.

Thank you in advance.

There is no way of doing this from within Wappler. You will require external libraries to accomplish this. Inserting the parsed information to the database Wappler can do very well, but collating these details to get to this point would be up to you. Maybe other users here can give you ideas of how this could be achieved? Some very talented outside of the box thinkers here!

As @Dave says, you probably won’t be able to do all of this in Wappler. However, Wappler could probably do some of it.

Assuming the file type is .docx, you could change the extension to .zip when you upload. You could then unzip the file. I think Wappler will get you this far.

When you unzip the file, the relevant file is:
\filename\docProps\app.xml

Below is a sample app.xml file. You would have to parse this and insert the relevant data into the database, but I don’t think Wappler will help you here. Hopefully Wappler will have features to read/write text files at some point - I think it’s one of the most important missing features.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties" xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes">
    <Template>Normal.dotm</Template>
    <TotalTime>0</TotalTime>
    <Pages>4</Pages>
    <Words>224</Words>
    <Characters>1280</Characters>
    <Application>Microsoft Office Word</Application>
    <DocSecurity>0</DocSecurity>
    <Lines>10</Lines>
    <Paragraphs>3</Paragraphs>
    <ScaleCrop>false</ScaleCrop>
    <Company></Company>
    <LinksUpToDate>false</LinksUpToDate>
    <CharactersWithSpaces>1501</CharactersWithSpaces>
    <SharedDoc>false</SharedDoc>
    <HyperlinksChanged>false</HyperlinksChanged>
    <AppVersion>16.0000</AppVersion>
</Properties>

That is fantastic! I appreciate the response, Tom.

1 Like