Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / December 2004

Tip: Looking for answers? Try searching our database.

Combining document with disparate styles

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Peter Bernhardt - 07 Dec 2004 16:36 GMT
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

Signature

Peter Bernhardt
SharpSense Software LLC
peter@SharpBASSense.netURA

Peter - 07 Dec 2004 17:40 GMT
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
   
   Select Case para.Style
   
     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
   
 Next para

hth,

-Peter

> 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
[quoted text clipped - 15 lines]
>
> TIA
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.