slicing and dicing documents

S

spasmoid

I'm a newbie to word programming, but I was wondering if I could use
Word's COM interface to select arbitary pages from multiple documents
and recombine them into a single document, allowing the user to
arrange the order of the pages.

I'll be using PHPs COM_DOTNET module to achieve this.

I checked out the documentation online, but nothing stood out as being
an obvious method.
http://msdn2.microsoft.com/en-us/library/aa192451(office.10).aspx
 
M

macropod

Hi spasmoid,

Although you can indeed identify and copy the contents of a particular page in a Word document, what you get depends on a host of
factors including page size & margins and the printer driver used at the time. Change printer drivers, and you can change what fits
on the page.

Also, when merging multiple documents, if the same styles exist in both the source and target documents, whatever is pasted into the
target document tends to adopt whatever formatting applies to the style definitions in that document. This too can result in changes
to what fits on a given page - plus what it looks like (plain text might become bold-italic, paragraphs may gain/lose numbering, and
so on).

The other thing you'll have to deal with is pages where the top paragraph is a continuation from the previous page and, likewise,
the bottom paragraph continues to the next page.

In summary, a page-based paradigm doesn't work particularly well in this context.

Cheers
 
J

Jonathan West

I'm a newbie to word programming, but I was wondering if I could use
Word's COM interface to select arbitary pages from multiple documents
and recombine them into a single document, allowing the user to
arrange the order of the pages.

I'll be using PHPs COM_DOTNET module to achieve this.

I checked out the documentation online, but nothing stood out as being
an obvious method.
http://msdn2.microsoft.com/en-us/library/aa192451(office.10).aspx

I agree with macropod's views on this. Therefore, Word probably isn't going
to be a good application for your purposes. That means you may want to think
of alternatives. Here are a couple of possibilities.

1. PowerPoint.
Yes, it might seem a bit odd to suggest it, but PowerPoint is in fact a
page-based application in a way that Word is not. If the various pages have
fairly consistent layouts suitable for implementation in a PowerPoint design
template, then this could be a fruitful approach. There is nothing that
requires PowerPoint files to be landscape format and have lots of pretty
colors. It is fairly straightforward using the PPT object model to copy a
slide from one presentation and insert it in another.

2. Acrobat
If you author in Word and convert your files to PDF format having made sure
that the page breaks are happening where you want them to, then there are
APIs in Acrobat (the full commercial version, not the free reader) that
allow you to shuffle pages. With this approach, the resulting assembly of
pages isn't editable (or at least, not easily editable) but that might be an
advantage rather than a drawback.


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
 

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