I want to read header from word document
I want to read the word document header and get the specific string in a label, Kindly help me
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Bharath PeggemPosted Nov 4, 2015, 11:44 PM
oWord = new Microsoft.Office.Interop.Word.Application();
oWord.Visible = false; //to avoid displaying the Word Application
object strDocName = @"d:\test.doc";
object objBool = false;
object objNull = System.Reflection.Missing.Value;
Document oMyDoc = oWord.Documents.Open(ref strDocName, ref objBool, ref objBool, ref objBool, ref objNull,
ref objNull, ref objNull, ref objNull, ref objNull, ref objNull, ref objNull, ref objNull, ref objNull, ref objNull, ref objNull, ref objNull);
object objReference = System.Reflection.Missing.Value;
object objFoot = "this is footer";
object objStart = 0;
object objEnd = oMyDoc.Words.Count;
if (oMyDoc.Sections.Count > 0)
{
oMyDoc.Sections[1].Headers[WdHeaderFooterIndex.wdHeaderFooterPrimary].Range.Text = "My Header";
oMyDoc.Sections[1].Footers[WdHeaderFooterIndex.wdHeaderFooterPrimary].Range.Text = "My Footer";
}
praveen kumarPosted Nov 11, 2015, 10:24 PM
Bharath PeggemPosted Nov 5, 2015, 12:34 AM
praveen kumarPosted Nov 4, 2015, 11:58 PM
praveen kumarPosted Nov 4, 2015, 11:54 PM
praveen kumarPosted Nov 2, 2015, 4:35 AM
Bharath PeggemPosted Nov 2, 2015, 1:45 AM
praveen kumarPosted Nov 2, 2015, 1:08 AM
Bharath PeggemPosted Nov 1, 2015, 11:48 PM
praveen kumarPosted Nov 1, 2015, 10:35 PM
Bharath PeggemPosted Oct 31, 2015, 7:56 AM