*** i moved to my own blog site so to check on my future posts, please go to www.junblogs.com  ***

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!

2 Responses to Confining cell contents of a table from word to RTF

Leave a Reply

Your email address will not be published. Required fields are marked *