menreeq
asked on
Accessing form.fields in MS Word
This is my first c# program so i think my question is very basic. I wrote the folloing program to open a word document and cycle through each field in the form...
private void button1_Click(object sender, System.EventArgs e)
{
if (this.openFileDialog1.Show Dialog() == DialogResult.OK)
{
object fileName = openFileDialog1.FileName;
object readOnly = false;
object isVisible = true;
object missing = System.Reflection.Missing. Value;
WordApp.Visible = false;
Word.Document aDoc = WordApp.Documents.Open(ref fileName, ref missing, ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible);
aDoc.Activate();
Console.WriteLine(aDoc.For mFields.Co unt);
for(int i=0; i<aDoc.FormFields.Count; i++)
{
}
}
}
I dont know how to cycle through the different fields in the for loop. What should i put in this loop...or am i on the wrong track?
private void button1_Click(object sender, System.EventArgs e)
{
if (this.openFileDialog1.Show
{
object fileName = openFileDialog1.FileName;
object readOnly = false;
object isVisible = true;
object missing = System.Reflection.Missing.
WordApp.Visible = false;
Word.Document aDoc = WordApp.Documents.Open(ref
aDoc.Activate();
Console.WriteLine(aDoc.For
for(int i=0; i<aDoc.FormFields.Count; i++)
{
}
}
}
I dont know how to cycle through the different fields in the for loop. What should i put in this loop...or am i on the wrong track?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER