PDA

View Full Version : Tabular format



doubtfire
08-26-2012, 11:00 AM
I am doing a project which I have to transfer Excel data into Word.
Data includes lines and tabular format like

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxx

201X 201X
Category I 2,000 100
Category II 3,000 1,100
Category III 4,000 500
------ ------
9,000 1,700


xxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

xxxxxxxxxxxxx xxxxxxxxxxx xxxxxxxxx xxxxxxxxx
xxxxxxxxxxxxx xxxxxxxxxxx xxxxxxxxx xxxxxxxxx
xxxxxxxxxxxxx xxxxxxxxxxx xxxxxxxxx xxxxxxxxx
xxxxxxxxxxxxx xxxxxxxxxxx xxxxxxxxx xxxxxxxxx

The tabular data can be 3 columns to 7 columns.
Is there anyone have this experience of same kind?
Please give some ideas.
Thanks.:hi:

fumei
08-26-2012, 04:05 PM
Ummm, and what are you looking for? Can you do a before and after? I do not understand what you want?

doubtfire
08-26-2012, 04:59 PM
I have some Excel reports which I have to transfer to Word.
And based on the format some are paragraphs and some are in tabular form.
They are like the followings

'*****This is a paragraph
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxx


'*******This is a tabular format comparing 2 years data
201X 201X
Category I 2,000 100
Category II 3,000 1,100
Category III 4,000 500
------ ------
9,000 1,700

'*******This is line/paragraph
xxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

'*******This is tabular format
xxxxxxxxxxxxx xxxxxxxxxxx xxxxxxxxx xxxxxxxxx
xxxxxxxxxxxxx xxxxxxxxxxx xxxxxxxxx xxxxxxxxx
xxxxxxxxxxxxx xxxxxxxxxxx xxxxxxxxx xxxxxxxxx
xxxxxxxxxxxxx xxxxxxxxxxx xxxxxxxxx xxxxxxxxx

I would like to write VBA script to scan whether they are lines, paragraphs or tabular data before transferring to Word format. And based on the content of tabular cells decide the Word table column width.
The Excel tables are multiple columns.
I am asking whether anyone has this experience before doing similar thing.
Thanks.:friends:

fumei
08-27-2012, 12:42 PM
Word does not deal with tabular data. It does not really recognize tabular data. Word has paragraphs. Even what you may think of a cell content in a Word table are not really tabular data. They are still paragraphs.

Further lines and paragraphs are essentially the same thing in Word. Sort of.

It seems to me you are better off just using Excel.

That being said, if you need some sort of formatting in Word, you need to carefully and precisely determine what your rules are. You are still being very vague.

And based on the content of tabular cells decide the Word table column width.Why? Why not use Word automatic column fitting feature?

Further, if this is coming from Excel then essentially ALL your data is "tabular" data, in that in Excel everything is in cells (real cells). Even your text paragraphs are cell data. They are as much tabular data as anything else.

doubtfire
08-27-2012, 01:53 PM
Thanks for the long explanation.
In regards to the
"Word automatic column fitting feature"
Do you have any examples in VBA I could refer to?
Thank you.:yes

fumei
08-27-2012, 08:03 PM
Try recording a macro. Are putting the Excel data into an existing table? Making a new one? Do you have existing code to put the Excel call data into specific cells in your table? You could try importing the part of Excel you want to keep as tabular - essentially an Excel table. If so, are you going to link it?

try googling these things. There are lots of examples of this, both out there in the wild, as well as examples on this site.

doubtfire
08-28-2012, 06:35 AM
Thanks.