Problem: Repeat as header row - automated

J

JOHNV

Hi all,
I have a problem that I hope someone can help with. I am using c# to create
a report in Word , which consists of many individual tables of various sizes.
Sometimes the tables are so small that 2 or 3 fit on each Word document
page. Before running the report, I have no idea how many rows will be in
each table.

Anyway, I have set "repeat as header row", so that the column headers appear
on both pages when a table gets broken up between pages. Works OK, except
for one issue. When table starts at bottom of a document page, I might see
only the first row of a report, which consists only of the column header row.
At the top of next page, a repeated column header row appears, as expected,
along with the data rows.

It looks really goofy, and I can't publish a report like this. I would
rather not break the page before every table, because then many report pages
would be almost empty, due to lots of small tables.

Can anyone out there help with this??

Thanks,
John
 
P

Peter A

Hi all,
I have a problem that I hope someone can help with. I am using c# to create
a report in Word , which consists of many individual tables of various sizes.
Sometimes the tables are so small that 2 or 3 fit on each Word document
page. Before running the report, I have no idea how many rows will be in
each table.

Anyway, I have set "repeat as header row", so that the column headers appear
on both pages when a table gets broken up between pages. Works OK, except
for one issue. When table starts at bottom of a document page, I might see
only the first row of a report, which consists only of the column header row.
At the top of next page, a repeated column header row appears, as expected,
along with the data rows.

It looks really goofy, and I can't publish a report like this. I would
rather not break the page before every table, because then many report pages
would be almost empty, due to lots of small tables.

Can anyone out there help with this??

Thanks,
John

You might experiment with the Keep With Next paragraph format option.
 
S

Suzanne S. Barnhill

Format the heading row as "Keep with next" (Format | Paragraph | Line and
Page Breaks).
 
J

johnvt

Format the heading row as "Keep with next" (Format | Paragraph | Line and
Page Breaks).

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA










- Show quoted text -

Thanks for the responses.
I usually can figure out these things, given enough time. But this
one is a head-scratcher. I can't figure out how to specify "keep with
next", on the first table row, using c#. However, when I select the
first row in the completed table in Word, Keep with Next is already
checked. I think it should be working correctly, but it's not. Still
has lone heading row (titles only, no data) at the bottom of document
page 1, then repeated heading row plus data rows at the top of
document page 2. Like this:
(sorry for the visuals, but I am not sure I am expressing it correctly
in words.)

__________________________
page 1

(other stuff)..
...
...
...

(start new table):
table row 1 (column headers)
(end of page)
_________________________________


page 2

repeat table row 1 ( column headers)
table row 2: data
table row 3: data
etc.
...
...
__________________________________

Thanks much,
John
 
S

Suzanne S. Barnhill

I'm wondering if some (all) of the table rows are also formatted as "Keep
with next." That might have this result.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Format the heading row as "Keep with next" (Format | Paragraph | Line and
Page Breaks).

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA










- Show quoted text -

Thanks for the responses.
I usually can figure out these things, given enough time. But this
one is a head-scratcher. I can't figure out how to specify "keep with
next", on the first table row, using c#. However, when I select the
first row in the completed table in Word, Keep with Next is already
checked. I think it should be working correctly, but it's not. Still
has lone heading row (titles only, no data) at the bottom of document
page 1, then repeated heading row plus data rows at the top of
document page 2. Like this:
(sorry for the visuals, but I am not sure I am expressing it correctly
in words.)

__________________________
page 1

(other stuff)..
....
....
....

(start new table):
table row 1 (column headers)
(end of page)
_________________________________


page 2

repeat table row 1 ( column headers)
table row 2: data
table row 3: data
etc.
....
....
__________________________________

Thanks much,
John
 
J

johnvt

Thanks for the responses.
I usually can figure out these things, given enough time.  But this
one is a head-scratcher.  I can't figure out how to specify "keep with
next", on the first table row, using c#.  However, when I select the
first row in the completed table in Word, Keep with Next is already
checked.  I think it should be working correctly, but it's not.  Still
has lone heading row (titles only, no data) at the bottom of document
page 1, then repeated heading row plus data rows at the top of
document page 2.   Like this:
(sorry for the visuals, but I am not sure I am expressing it correctly
in words.)

__________________________
page 1

(other stuff)..
...
...
...

(start new table):
table row 1 (column headers)
(end of page)
_________________________________

page 2

repeat table row 1 ( column headers)
table row 2: data
table row 3: data
etc.
...
...
__________________________________

Thanks much,
John- Hide quoted text -

- Show quoted text -

Hi all,
Thank you for the posts. I was completely lost between paragraphs,
rows, ranges,cells,keep lines together, keep with next, repeat as
header, etc, etc.
I tried different suggestions you had, and finally got it working (I
think).

What I finally did in C# was:
As I added the first table row, I turned on "keep with next" for that
row.
For every other row in the table, as I was adding the row, I turned
off "keep with next".
I did not do anything at the table level or wait until the rows had
been populated.

So, now I can get back to productive things!

Thanks,
John
 

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