Quantcast
Viewing latest article 9
Browse Latest Browse All 2257

Producing Word document with windows form doesn't work for all PCs

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. Actually I don't get any error, just no document produced and it tries to open word by displaying it even if I set visible=false.

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;

This code is inside a function named "makeTestReport" to which I pass as an argument the word application I use to open the doc. tab is a word table extracted from another document in a makeTestReport embedded function. All the rest of the code is the same.


The environment settings on my Dev pc are:

  • Windows 10 Pro, 64 bit, version 1809

  • Office version 1908 (built 11929.20966)

  • Visual Studio Community 2019 Version 16.7.3

  • .NET framework 4.7.2

  • Microsoft.Office.Interop.Word to manage the task



Can you suggest me a troubleshooting?


Viewing latest article 9
Browse Latest Browse All 2257

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>