Cell Formatting

D

De Vo

can some one advise me the best way of controlling format of cells for
this particular application

I have a routine which add an new row to table which is made of columns.

There are 7 columns and I wish to ensure the correct format is applied
to the cells.

The 1st cell will be left aligned
The 2nd cell will be right aligned
The 3rd cell will be right aligned
The 4th cell will be centered
The 5th cell will be right aligned
The 6th cell will be right aligned
The 7th cell will be left aligned.

By formatting at row creation will this effect any dynamic data that is
placed in the cell ? or should i be doing this at data creation point

your views are welcomed and command syntax is appreciated..

regards

De Vo (always learning!!!)
 
P

Peter Hewett

Hi De Vo

The easiest way is to have the table in your document/template to start with.
Then you can format the first row (or second if you are using a header row)
manually to the format you want. When you add a new row to the table then the
previous rows cell formatting will be carried into the new row.

If you have to create the table from scratch (could be a lot of work
formatting it) if it's always the same initially you could insert it via an
AutText entry. Failing that create the initial table, do the formatting then
add any extra rows (if you can't determine how many you need in the first
place, as you go).

HTH + Cheers - Peter
 
J

Jay Freedman

Hi, De Vo,

You should create your document based on a template that contains the
table -- at least one row of it -- with the alignments already set
properly. Then all you need to do is add more rows as you get the
data, using

oTable.Rows.Add

and insert the data into the cells.

If the table can't be in the body of the template because it will be
in different places in different documents, then store it as an
AutoText entry and insert that entry when you need to start the table.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top