Pagesettings and XML

C

Christof Nordiek

Hi,

i'm working with the XML-Property and InsertXML to get the content from a
worddoc and later put it in a new doc.
Now i notice, that the pagesettings aren't 'saved' inside the XML.
This happens only for the first section. For following sections all works
well.
Is there a way to get the Page-Settings with in the XML?

Thanks
 
C

Cindy M -WordMVP-

Hi Christof,
i'm working with the XML-Property and InsertXML to get the content from a
worddoc and later put it in a new doc.
Now i notice, that the pagesettings aren't 'saved' inside the XML.
This happens only for the first section. For following sections all works
well.
Is there a way to get the Page-Settings with in the XML?
I'm not certain I understand exactly which page settings you're concerned
about. Margins, for example?

If we're talking about margins, headers, footers, then these settings are
section specific and the information is saved in a Section property
hierarchy (SectPr I think) at the END of each section. If you're not seeing
this, could you give me some repro steps for setting up a document with the
problem?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
C

Christof Nordiek

Hi Cindy.

Mainly it's about margins, but also other section-specific settings.

To reproduce behavior:

Prepare a document with margin-settings.
then in automation do following:
wordApp = New Word.Application
document1 = wordApp.Open(DocumentName)
xml = document1.Content.XML(false)
document1.Close()

document2 = wordApp.Documents.Add
document2.Content.InsertXML(xml)

Then document2 will not contain the marginsettings in the first section.

Christof
 
C

Cindy M -WordMVP-

Hi Christof,
Mainly it's about margins, but also other section-specific settings.

To reproduce behavior:

Prepare a document with margin-settings.
then in automation do following:
wordApp = New Word.Application
document1 = wordApp.Open(DocumentName)
xml = document1.Content.XML(false)
document1.Close()

document2 = wordApp.Documents.Add
document2.Content.InsertXML(xml)

Then document2 will not contain the marginsettings in the first section.
Ah, OK. This is because, when you access the range of the current
document, you're only picking up the "text". It leaves out the last
paragraph mark, where this information is stored. "Expected behavior", but
annoying for the programmer.

Try this - no guarantees, but I think there's a chance - before picking up
the XML, insert a section break at the very end of the document. That
should pick up the exact same section settings as the section before which
it's being inserted. Pick up the XML, then UNDO.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 

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