J
Jonathan Greensted [MVP]
Hi
I’m struggling to find the best way to update XMLNodes contained within a
Word document header (or footer).
I would have expected "document.SelectNodes(...)" to include nodes from the
headers and footers but it doesnt.
The only answer(ish) I've found is:
foreach (Section sect in _doc.Sections)
{
foreach (HeaderFooter headfoot in sect.Headers)
{
if (headfoot.Range.XMLNodes.Count>0)
{
// headfoot.Range.XMLNodes.SelectNodes(...)
}
}
foreach (HeaderFooter headfoot in sect.Footers)
{
if (headfoot.Range.XMLNodes.Count>0)
{
// headfoot.Range.XMLNodes.SelectNodes(...)
}
}
}
But (a) this seems a bit pants and (b) it doesnt seem to work anyway!
Does anyone know how to do this the "official" way?
Many thanks
Jonathan
I’m struggling to find the best way to update XMLNodes contained within a
Word document header (or footer).
I would have expected "document.SelectNodes(...)" to include nodes from the
headers and footers but it doesnt.
The only answer(ish) I've found is:
foreach (Section sect in _doc.Sections)
{
foreach (HeaderFooter headfoot in sect.Headers)
{
if (headfoot.Range.XMLNodes.Count>0)
{
// headfoot.Range.XMLNodes.SelectNodes(...)
}
}
foreach (HeaderFooter headfoot in sect.Footers)
{
if (headfoot.Range.XMLNodes.Count>0)
{
// headfoot.Range.XMLNodes.SelectNodes(...)
}
}
}
But (a) this seems a bit pants and (b) it doesnt seem to work anyway!
Does anyone know how to do this the "official" way?
Many thanks
Jonathan