Any Ideas For Word To Fp2003 - Table Nonsense Stripping

  • Ok we get tons of tables sent in word format that need converted to html.


    If you copy/paste from word to FP you get something like:



    So I have to go through and strip it so it looks like:


    Code
    <table
    	<tr>
    		<td>dg</td>
    		<td>dfgdfg</td>
    	</tr>
    	<tr>
    		<td>fh</td>
    		<td>hgj</td>
    	</tr>
    </table>


    Can anyone think of a clever way of automating this?


    FP2003 will happily run VBA/macros etc - so I've been playing with a script that'd detect some unique character shape or something - but I can't really see how to approach this issue!


    Any pointers/suggestions would be most appreciated!

  • Re: Any Ideas For Word To Fp2003 - Table Nonsense Stripping


    Hi Omnikron - this is not dissimilar to a post I just made on a similar thread...


    http://www.ozgrid.com/forum/showthread.php?t=66207



    Ger

    _______________________________________________
    There are 10 types of people in the world. Those that understand Binary and those that dont. :P


    Why are Halloween and Christmas the same? Because Oct 31 = Dec 25... ;)

    _______________________________________________

  • Re: Any Ideas For Word To Fp2003 - Table Nonsense Stripping


    I just got another idea....


    If you created a FULL list of HTML tags (I'm sure you could get this from the web somewhere).


    Place the list in a column in a sheet...


    You could I suppose theoretically do a lookup for each HTML Tag on every HTML line you had and if found replace it with "".


    However you would also need to do a search for the end marker for that tag in every line for example search for <HTML> and </html>


    A lot of work, but potentially do-able...... but dont have time to... sorry mate.


    Ger

    _______________________________________________
    There are 10 types of people in the world. Those that understand Binary and those that dont. :P


    Why are Halloween and Christmas the same? Because Oct 31 = Dec 25... ;)

    _______________________________________________

  • Re: Any Ideas For Word To Fp2003 - Table Nonsense Stripping


    now that would work?


    So basically you're saying to detect the character string "<td" in a pile of text and cut everything until it comes to the next > - that'd be fairly robust I imagine - though I haven't a clue how to go about it... :(


    If anyone has the time to run up a very quick example of how it could work (just for that tag) I should be able to extend the code to work for all the other tags and tweak as required - I'd be very grateful anyway! ;)

  • Re: Any Ideas For Word To Fp2003 - Table Nonsense Stripping


    OK, when I thought about it a bit more, it didnt seem too bad...


    This assumes that your "<table" element is in Cell A1... Its a fairly basic macro that strips out the garbage after the <TABLE> and <TD> tags... all other tags looked good 'as is'.


    It puts the resulting tags in Column B... so make sure that it its empty cos it is cleared out each time it is run...


    Not sure how it would handle complex HTML... for example... an open and close "<table>" tag embedded between <TD> and </TD> would probably really screw things up.


    This seems to produce the results you want from the sample data you supplied, but clearly you would need to test on a larger sample.



    Let me know if you need help getting this to work.


    Ger

    _______________________________________________
    There are 10 types of people in the world. Those that understand Binary and those that dont. :P


    Why are Halloween and Christmas the same? Because Oct 31 = Dec 25... ;)

    _______________________________________________

  • Re: Any Ideas For Word To Fp2003 - Table Nonsense Stripping


    hmm by cells do you mean excel?!


    I'm trying to go from word to fp2003 - sorry if I'm being stupid! ;)

  • Re: Any Ideas For Word To Fp2003 - Table Nonsense Stripping


    No your fine, thats just me being stupid... didnt realise this was in the "Word" section.... Hmm back to square one I'm afraid.


    Ger

    _______________________________________________
    There are 10 types of people in the world. Those that understand Binary and those that dont. :P


    Why are Halloween and Christmas the same? Because Oct 31 = Dec 25... ;)

    _______________________________________________

  • Re: Any Ideas For Word To Fp2003 - Table Nonsense Stripping


    Well I know this isnt what you wanted, but If you paste your sample data above in Excel... and run the macro I provided, you will get the result you want... in Excel, which you could then paste back into in FP....


    Long shot I know : D


    Ger

    _______________________________________________
    There are 10 types of people in the world. Those that understand Binary and those that dont. :P


    Why are Halloween and Christmas the same? Because Oct 31 = Dec 25... ;)

    _______________________________________________

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!