I'm working on a project where I'm automatically combining two or more
documents and I need to apply a consistent font throught the combined
document. The problem is that doc A may have a style named X that uses a
Helvetica font while doc B will have a style named Y that uses a Times Roman
font. I have to apply a common style, but first I need to determine if these
styles should be the same or if one is a heading style and the other a body
text style. And I also won't know at runtime what styles to expect from the
various documents I'll be assembling.

Is the only solution to this problem to iterate through all the styles in a
given document and do some basic heuristics on the discovered styles? For
example, look at the properties of style X and decide if it is a heading
style and then change the style a more generic style that is the best fit.
Or would it be simpler to just update the font of all styles to use a
pre-determined font family?

Any ideas would be greatly appreciated.

TIA

--
Peter Bernhardt
SharpSense Software LLC
peter@SharpBASSense.netURA

Re: Combining document with disparate styles by Peter

Peter
Tue Dec 07 11:40:37 CST 2004

I think what you might want to do is iterate through the paragraphs of =
the applicable documents, examining the paragraph styles and converting =
appropriately:

Dim para As Paragraph
For Each para In ActiveDocument.Paragraphs
=20
Select Case para.Style
=20
Case wdStyleNormal
' copy and convert to some normalized style
Case wdStyleHeading1
' copy and convert to some normalized style
Case wdStyleHeading2
' copy and convert to some normalized style
Case wdStyleHeading3
' copy and convert to some normalized style
Case Else
' ...
End Select
=20
Next para

hth,

-Peter

"Peter Bernhardt" <peter@spammenot.com> wrote in message =
news:uQvserH3EHA.1300@TK2MSFTNGP14.phx.gbl...
> I'm working on a project where I'm automatically combining two or more =

> documents and I need to apply a consistent font throught the combined=20
> document. The problem is that doc A may have a style named X that uses =
a=20
> Helvetica font while doc B will have a style named Y that uses a Times =
Roman=20
> font. I have to apply a common style, but first I need to determine if =
these=20
> styles should be the same or if one is a heading style and the other a =
body=20
> text style. And I also won't know at runtime what styles to expect =
from the=20
> various documents I'll be assembling.
>=20
> Is the only solution to this problem to iterate through all the styles =
in a=20
> given document and do some basic heuristics on the discovered styles? =
For=20
> example, look at the properties of style X and decide if it is a =
heading=20
> style and then change the style a more generic style that is the best =
fit.=20
> Or would it be simpler to just update the font of all styles to use a=20
> pre-determined font family?
>=20
> Any ideas would be greatly appreciated.
>=20
> TIA
>=20
> --=20
> Peter Bernhardt
> SharpSense Software LLC
> peter@SharpBASSense.netURA=20
>=20
>