Troubles with StyleRef field

T

Tim Tucker

I'm trying to figure out how to place text in a header based on a
StyleRef, but I can't seem to come up with a way to get the results that
I want.

I managed to find a post from over a year ago that came close to what I
wanted, however the solution given doesn't work quite as well as I'd like:
http://groups.google.com/[email protected]&rnum=2&prev=/&frame=on

I have data that looks like the following:

Item A (Style 1)
Description for Item A (Style 2)

Type X (Style 3)
----- | -----
----- | ----- (two column table)
----- | -----

Type Y (Style 3)
----- | -----
----- | ----- (two column table)
----- | -----

Type Z (Style 3)
----- | -----
----- | ----- (two column table)
----- | -----

Item B (Style 1)
Description for Item B (Style 2)

Type X (Style 3)
----- | -----
----- | ----- (two column table)
----- | -----

Type Y (Style 3)
----- | -----
----- | ----- (two column table)
----- | -----


As an example, if the header for Item A, Type Z is split across two
pages, I need the following to appear at the top of page 2:
Item A (Style 1)
Description for Item A (Style 2)

Type Z (Style 3)


If I use a StyleRef, however, and Item B begins on the same page as the
end of Item A, the header will be based on Item B.

The second issue here is that if an Item or Type starts at the beginning
of the page, the information for it is shown twice -- once in the body
and once in the header. I need it to only display once.

To make things slighly more confusing, I'm trying to do all this using
WordML and XML transformations on a 10,000 item Filemaker database (with
about 100 different types of Items, each of which has anywhere from 1-5
different types).

Does anyone have any suggestions? Or am I going in completely the wrong
direction here to be trying to generate a complex catalog in Word?

(I'd try Publisher, but I couldn't seem to figure out how to deal with a
hierarchy of items rather than just displaying all the records from a
file -- I could probably do it if I were to generate a separate csv file
for each combination of item and type and then manually do a catalog
merge for each of those, but it doesn't seem like generating several
hundred files and importing them one at a time is the solution)

Tim Tucker
(e-mail address removed)
 
P

Peter Jamieson

You could try this, which I think works logically but may grind to a halt in
a large document. I may have made the wrong assumptions about what you want,
particularly at the detailed level, e.g. what happens if the table is split
across pages (that could be pretty difficult to deal with even if the
following is close to what you need, you could always try repeating the
appropriate Type-level SEQ in every row in the table, but you might end up
with an awful lot of fields).

At the beginning of the document, put the following fields:

{ SET Name0 "" }{ SET Desc0 "" }


Wherever you have a Style 1/Style 2 combination, use the following instead

{ SEQ Item }{ SET "Name{ SEQ Item \c }" "the item name, e.g. Item A" }{ REF
"Name{ SEQ Item \c }"}
{ SET "Desc{ SEQ Item \c }" "the item description" }{ REF "Desc{ SEQ Item
\c }"}

At the beginning of the first Style 3 within each Item, use

{ SEQ "Type{ SEQ "P{ PAGE }" }" \r0 }

At the beginning of each subsequent Style 3 within each Item, use

{ SEQ "Type{ SEQ "P{ PAGE }" }" \r{ SEQ Item \c } }

In the header, put

{ REF "Name{ SEQ Type1 \c }" }
{ REF "Desc{ SEQ Type1 \c }" }

Select the body of the document and press F9, then ditto for the header.

The general idea is that you need something that can remember
a. whether or not the first "type" on a page is the first type within an
item. If it is, you do not want the item name and description as I am
assuming that they will already be immediately above the type line. If it is
not, you want the name and description in the header
b. what the current item name and description are.

Using a SEQ field called P{ PAGE } makes it easy to set up a sequence that
restarts at the top of a page, so it's easy to set up a value that records
something about the first "Type" paragraph on the page. Experience suggests
that using SEQ fields to capture this info. works more reliably than SET
(and IF) when you want to re-use the value in a header.

NB, if you start attempting variations on this technique, it's useful to
know that if you have multiple instances of a field such as { SEQ abc } on a
page, when you use { SEQ abc \c }in a header, Word always seems to use the
/last/ value on the page.

Whenever I do these things I always look at them and wonder whether there
isn't some obvious simplification. Then I decide that there probably isn't
:)
 
C

Charles Kenyon

Wow!!!

Charles Kenyon

Peter Jamieson said:
You could try this, which I think works logically but may grind to a halt in
a large document. I may have made the wrong assumptions about what you want,
particularly at the detailed level, e.g. what happens if the table is split
across pages (that could be pretty difficult to deal with even if the
following is close to what you need, you could always try repeating the
appropriate Type-level SEQ in every row in the table, but you might end up
with an awful lot of fields).

At the beginning of the document, put the following fields:

{ SET Name0 "" }{ SET Desc0 "" }


Wherever you have a Style 1/Style 2 combination, use the following instead

{ SEQ Item }{ SET "Name{ SEQ Item \c }" "the item name, e.g. Item A" }{ REF
"Name{ SEQ Item \c }"}
{ SET "Desc{ SEQ Item \c }" "the item description" }{ REF "Desc{ SEQ Item
\c }"}

At the beginning of the first Style 3 within each Item, use

{ SEQ "Type{ SEQ "P{ PAGE }" }" \r0 }

At the beginning of each subsequent Style 3 within each Item, use

{ SEQ "Type{ SEQ "P{ PAGE }" }" \r{ SEQ Item \c } }

In the header, put

{ REF "Name{ SEQ Type1 \c }" }
{ REF "Desc{ SEQ Type1 \c }" }

Select the body of the document and press F9, then ditto for the header.

The general idea is that you need something that can remember
a. whether or not the first "type" on a page is the first type within an
item. If it is, you do not want the item name and description as I am
assuming that they will already be immediately above the type line. If it is
not, you want the name and description in the header
b. what the current item name and description are.

Using a SEQ field called P{ PAGE } makes it easy to set up a sequence that
restarts at the top of a page, so it's easy to set up a value that records
something about the first "Type" paragraph on the page. Experience suggests
that using SEQ fields to capture this info. works more reliably than SET
(and IF) when you want to re-use the value in a header.

NB, if you start attempting variations on this technique, it's useful to
know that if you have multiple instances of a field such as { SEQ abc } on a
page, when you use { SEQ abc \c }in a header, Word always seems to use the
/last/ value on the page.

Whenever I do these things I always look at them and wonder whether there
isn't some obvious simplification. Then I decide that there probably isn't
:)

--
Peter Jamieson


http://groups.google.com/[email protected]&rnum=2&prev=/&frame=on
 

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