How can i Export grid to word..
-
I am having one grid..i want to export that grid to word..after doing only two fields r coming ie serial no: and total..product name, quantity and unitcost r not coming into the word...those three r from databasee...How can i bring those three to the word... the code looks like this... object fileName = "C:\\Inetpub\\wwwroot\\eBilling\\jijo.doc"; object readOnly = false; object isVisible = true; object missing = System.Reflection.Missing.Value; object oEndOfDoc = "\\StartOfDoc"; object oCurrentCell="\\Cell" ; Word.ApplicationClass oWordApp = new Word.ApplicationClass(); try { Word.Document oWordDoc = oWordApp.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, ref missing,ref missing,ref missing); oWordDoc.Activate(); oWordApp.Selection.TypeParagraph(); oWordDoc.Content.Delete(ref missing,ref missing); Word.Table oTable; Word.Range wrdRng =oWordDoc.Bookmarks.Item(ref oEndOfDoc).Range; oTable = oWordDoc.Tables.Add(wrdRng, DataGrid1.Items.Count, 5, ref missing, ref missing); oTable.Range.ParagraphFormat.SpaceAfter = 6; int i,j; for(i=0;i
-
I am having one grid..i want to export that grid to word..after doing only two fields r coming ie serial no: and total..product name, quantity and unitcost r not coming into the word...those three r from databasee...How can i bring those three to the word... the code looks like this... object fileName = "C:\\Inetpub\\wwwroot\\eBilling\\jijo.doc"; object readOnly = false; object isVisible = true; object missing = System.Reflection.Missing.Value; object oEndOfDoc = "\\StartOfDoc"; object oCurrentCell="\\Cell" ; Word.ApplicationClass oWordApp = new Word.ApplicationClass(); try { Word.Document oWordDoc = oWordApp.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, ref missing,ref missing,ref missing); oWordDoc.Activate(); oWordApp.Selection.TypeParagraph(); oWordDoc.Content.Delete(ref missing,ref missing); Word.Table oTable; Word.Range wrdRng =oWordDoc.Bookmarks.Item(ref oEndOfDoc).Range; oTable = oWordDoc.Tables.Add(wrdRng, DataGrid1.Items.Count, 5, ref missing, ref missing); oTable.Range.ParagraphFormat.SpaceAfter = 6; int i,j; for(i=0;i
I personally haven't worked with Word automation that much. You might get some luck here, but ms newsgroups are probably a better place for this question. See: http://msdn.microsoft.com/newsgroups/[^] This posting is provided "AS IS" with no warranties, and confers no rights. Alex Korchemniy