Hello,
I developed a windows form app to produce Word reports. At the beginning it worked fine on all the PCs producing well done documents, after I added the following chunk of code it stopped to produce the reports when executed on some PCs.
object end = 0;
object start = 0;
string title = Regex.Replace(tab.Cell(1, 1).Range.Text, pattern, dati[7]);
Range rng = doc.Range(ref start, ref end);
rng.Text = title;
Object styleHeading2 = "Heading 2";
rng.set_Style(ref styleHeading2);
rng.Paragraphs.OutlineLevel = Word.WdOutlineLevel.wdOutlineLevel2;
rng.Paragraphs.SpaceAfter = 10;
I found that, on the PCs where it doesn' work, the code throws the following exception:
System.Runtime.InteropServices.COMException (0x800A16CA): the item with the specified name does not exist.
in Microsoft.office.Interop.Word.Range.set_style(Object& prop)
Do you have any idea to solve it??
thank you