D
Dan Drew
I'm writing a C# app that allows exporting to a Word doc. I figured out how
to create the paragraphs and tables, and setting styles works from the code
perspective. However, when I open the document none of the styles are
applied. For instance, instead of a paragraph being "Heading 1", it will be
"Normal + 16pt" and similar for everything else. The strange thing is that
if
I do exactly the same operations from JScript then it works fine. Does
anyone
know what's going on here?!?
JScript (works)
par = doc.Content.Paragraphs.Add();
par.Range.Text = "Heading";
par.Style = doc.Styles("Heading 1");
par.Range.InsertParagraphAfter();
C# (doesn't work)
par = this.doc.Content.Paragraphs.Add(ref OptionalParam);
par.set_Style(ref style);
par.Range.Text = text;
par.Range.InsertParagraphAfter();
to create the paragraphs and tables, and setting styles works from the code
perspective. However, when I open the document none of the styles are
applied. For instance, instead of a paragraph being "Heading 1", it will be
"Normal + 16pt" and similar for everything else. The strange thing is that
if
I do exactly the same operations from JScript then it works fine. Does
anyone
know what's going on here?!?
JScript (works)
par = doc.Content.Paragraphs.Add();
par.Range.Text = "Heading";
par.Style = doc.Styles("Heading 1");
par.Range.InsertParagraphAfter();
C# (doesn't work)
par = this.doc.Content.Paragraphs.Add(ref OptionalParam);
par.set_Style(ref style);
par.Range.Text = text;
par.Range.InsertParagraphAfter();