I want to insert a header or footer in a word document using word automation.
_document ocDoc;
Sections DocSections = Sections(ocDoc.GetSections());
section firstSec = DocSections.Item( 1 );
HeaderFooter Hf = firstSec.GetHeaders();
Range MyRange = Hf.GetRange();
MyRange.SetText( L"salam" );
but code in part "Range MyRange = Hf.GetRange();" failed, how can i insert header or footer in word document using c++?
below code in c# work correctly:
_document ocDoc;
oDoc.Sections[1].Headers[WdHeaderFooterIndex.wdHeaderFooterPrimary].Range.Text = "My Header";
Where's your C++ equivalent to
Something like