Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How can i Export grid to word..

How can i Export grid to word..

Scheduled Pinned Locked Moved C#
cssquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    john kuruvila
    wrote on last edited by
    #1

    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

    A 1 Reply Last reply
    0
    • J john kuruvila

      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

      A Offline
      A Offline
      Alex Korchemniy
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups