We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 29319
    • 37 Posts
    Hi all, I have what I feel is a revolutionary idea / question which I am sure has been thought of before (hmm perhaps not so revolutionary then i guess). I am building a website for a client who has lets say less than novice IT experience. Whilst I’m sure that getting them to log on to the manager to edit their sites content would be possible after a sit down and teach session I was wondering if there is an easier way for them to do this!

    The problem is they have at lot of content all currently in PDF / DOC format and whilst I don’t mind copying and pasting, the information in then formatting it correctly inside the manager it is them I am concerned about. I was wondering if it would be possible to create a snippet that a document (word document) and displayed it contents with the correct formating? So when they choose to update the content all they have to do is to upload their new document and overwrite the previous one?

    So what say it modx community? Doable?
      • 3749
      • 24,544 Posts
      Definitely doable, but if you’ve ever looked at the raw content of even a relatively simple Word .doc file, you might run the other way -- and .PDF files are no picnic either. wink
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 29319
        • 37 Posts
        Yeah I understand it won’t be simple, its just I don’t really like the TINY MCE Editor which is another reason i’m looking into this. Anyone point me to the right direction?
          • 3749
          • 24,544 Posts
          For the sake of your sanity, I beg you to reconsider. I’ve written code to read and write Excel files directly, but I wouldn’t touch a .doc file with a ten-foot pole.

          Besides the hoplessly arcane format, you never know what your user will do (e.g. double-spacing, inserting images, using wildly different formats for different pages or paragraphs, using Fonts and type sizes instead of styles for headings, spaces for tabs -- the list is endless) and there are hundreds, if not thousands, of formatting codes you would need to recognize and convert to the relatively sparse entities in HTML.

          In addition, Word is not designed for creating web pages and TinyMCE and FCK are. Word is essentially a poorly designed typesetting program that mixes content and formatting instructions together in an unholy salad -- the opposite of what HTML does.

          If you’re determined to do it, take a look at some of the .doc to HTML conversion programs that are out there, but plan on manually editing most of the HTML files they produce. wink
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 16278
            • 928 Posts
            Up to a certain level of formatting, it is definitely easier and better for your sanity to view this as a Word macro problem.

            I used to have some VBA code that would reduce a Word document to HTML, preserving basic formatting (paragraphs, bold, italic, underlining, specific heading and other styles). That was a few years ago, and specialized for the place I used to work, but I could root about in my old files if you’re interested.

            You can get so far with a basic set of search & replace operations, if all you need to preserve is paragraphs. In macro land, there are some nasties lurking in the woodwork (such as ambiguity between end of document and end of paragraph) that make it not quite the simple job it should be. Working in the VBA editor is actually quite nice, especially using Option Explicit which helps keep your typos from causing trouble!

            smiley KP