I have a DataTable with data now I want to export those data to a MS Word document(Report) in a table.I figure out the following code....but can't able to add data to the word table.Is there anyone who can help me?
Word.ApplicationClass wa =
new Word.ApplicationClass();
wa.Visible=
true;
Word.DocumentClass wd =
new Word.DocumentClass();
wd.Activate();
Object start = Type.Missing;
Object end = Type.Missing;
Word.Range rng = wd.Range(
ref start, ref end);
Object defaultTableBehavior = Type.Missing;
Object autoFitBehavior = Type.Missing;
wd.Tables.Add(rng, 1, 3,
ref defaultTableBehavior,
ref autoFitBehavior);
The above code only create a word table I how can I insert data from a datatable in this word table?
Thanks in advance
Please remark that Microsoft does not recoment to use ActiveX/OLE controls of Word /Excel/e.t.c. on servers.
cioina
Contributor
3728 Points
878 Posts
Re: Export DataTable To MS Word in C#
Jun 05, 2008 04:20 PM|LINK
Please remark that Microsoft does not recoment to use ActiveX/OLE controls of Word /Excel/e.t.c. on servers.
Alexei Cioina.
http://www.californiadreamhomesandland.com