Welcome to Foxite.COM Community Weblog Sign in | Join | Help



Confining cell contents of a table from word to RTF


I have shown easy ways of importing and exporting from Word to RTF and vice versa in my past few blogs regarding RTF and Automation.  What I have not mentioned is what will happen when a  Word document has a table inside.

What will happen is the RTF control will not respect the boundaries of both cells and the tables itself.  See the image below (standard way):



Mike Gagnon told me yesterday that he is interested to see if I can come up with something regarding that table problem so I said I will try.  And so immediately after I logged out of foxite (plus my prepaid load ran up, darn it is annoying but I have no choice since I love frequenting the forum and sharing some of the newfound tricks I am able to implement on my side), I started on working on it immediately.

I spent a long time with the idea of stripping the tables of boundaries via "Convert Table to Text" method especially in playing with the delimiters but in the end I junked the whole concept as any result from that really does not appeal to me.

Pursuing another line of thoughts is when I came up with this good solution.  However, this is where I got stuck longer as even the macro recordings did not help me.  So I started playing around with combinations of word automation syntax; until my nephew and wife arrived from the field trip past 12 pm so we went to bed.  But some are already there so I said to myself, let's continue this tomorrow.  This morning I got exactly what I wanted.  See the images below:






As you can see, I also have added here the ability to change table appearance prior to importing.  Those are not the complete list, you can add more if you want.  Like with some of the tricks I have shown, you'll be in for a big surprise that we only needed few commands to attain what we need.  Confining cell contents, applying table format, importing into RTF and cleaning up the mess is just 22 lines of codes.  I am a simple man and I like my codes also simple. 

P.S.  Like some of my latest postings, these tricks are done without prolonged testings as I am too darn lazy for things like that.  So if you will find something wrong or has any additional ideas for further enhancements, please post it as comment here.  Thank you!

Get your attachment here.  Attachment should contain 3 files (ssrtf4.scx, ssrtf4.sct and Tables.doc).  Extract to c:\ssrtf4.  Enjoy!



Published Saturday, November 28, 2009 2:41 AM by sandstorm36
Filed Under: ,

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# Manumitted Wp Themes

Monday, February 01, 2010 3:42 PM by WP Themes
Nice fill someone in on and this enter helped me alot in my college assignement. Thanks you for your information.

What do you think?

(required) 
required 
(required)