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 to separate word tables for differnet files

How to separate word tables for differnet files

Scheduled Pinned Locked Moved C#
comtutorial
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.
  • N Offline
    N Offline
    nisha 2n
    wrote on last edited by
    #1

    hi....now im doing work on Line count for word documents...1st i hav 2 select Dr name n date n then add files in listview and then if i go for save those files will save in ms word table as separately as Different DR name n Date wise in seperate tables... ....BUT iam getting repeating in one table lik... Dr.Name:Dr.Jhon Date:20/12/2009 Sno FileName Count 1 Hobbs.doc 36.31 2 Horn.doc 45.72 3 McMillan.doc 41.49 4 Smith.doc 10.72 Dr.Name:Dr.king Date:22/12/2009 Sno FileName Count 1 Hobbs.doc 36.31 2 Horn.doc 45.72 3 McMillan.doc 41.49 4 Smith.doc 10.72 .......................................................................... this is actully i want 2 get.... Dr.Name:Dr.Jhon Date:20/12/2009 Sno FileName Count 1 Hobbs.doc 36.31 2 Horn.doc 45.72 Dr.Name:Dr.king Date:22/12/2009 Sno FileName Count 1 McMillan.doc 41.49 2 Smith.doc 10.72 Here is my code... private void btnsave_Click(object sender, EventArgs e) { for (int k = 1; k < listView1.Items.Count; k++) { if (listView1.Items[k - 1].Text != listView1.Items[k].Text) { dte.Add(listView1.Items[k - 1].Text); dte.Add(listView1.Items[k].Text); } if (listView1.Items[k - 1].SubItems[3].Text != listView1.Items[k].SubItems[3].Text) { pname.Add(listView1.Items[k - 1].SubItems[3].Text); pname.Add(listView1.Items[k].SubItems[3].Text); } } object oMissing = System.Reflection.Missing.Value; object oEndOfDoc = "\\endofdoc"; /* \endofdoc is a predefined bookmark */ Microsoft.Office.Interop.Word._Application oWord; Microsoft.Office.Interop.Word._Document oDoc; oWord = new Microsoft.Office.Interop.Word.Application(); oWord.Visible = true; oDoc = oWord.Documents.Add(ref oMissing, ref oMissing, ref oMissing, ref oMissing); for (int k = 0; k < dte.Count; k++) { Microsoft.Office.Interop.Word.Paragraph oPara1; oPara1 = oDoc.Content.Paragraphs.Add(ref oMissing); oPara1.Range.Text = pname[k].ToString(); oPara1.Range.Font.Bold = 1; oPara1.Format.SpaceAfter = 24; //24 pt spacing after paragraph. oPara1.Range.InsertParagraphAfter(); Microsoft.Of

    A 1 Reply Last reply
    0
    • N nisha 2n

      hi....now im doing work on Line count for word documents...1st i hav 2 select Dr name n date n then add files in listview and then if i go for save those files will save in ms word table as separately as Different DR name n Date wise in seperate tables... ....BUT iam getting repeating in one table lik... Dr.Name:Dr.Jhon Date:20/12/2009 Sno FileName Count 1 Hobbs.doc 36.31 2 Horn.doc 45.72 3 McMillan.doc 41.49 4 Smith.doc 10.72 Dr.Name:Dr.king Date:22/12/2009 Sno FileName Count 1 Hobbs.doc 36.31 2 Horn.doc 45.72 3 McMillan.doc 41.49 4 Smith.doc 10.72 .......................................................................... this is actully i want 2 get.... Dr.Name:Dr.Jhon Date:20/12/2009 Sno FileName Count 1 Hobbs.doc 36.31 2 Horn.doc 45.72 Dr.Name:Dr.king Date:22/12/2009 Sno FileName Count 1 McMillan.doc 41.49 2 Smith.doc 10.72 Here is my code... private void btnsave_Click(object sender, EventArgs e) { for (int k = 1; k < listView1.Items.Count; k++) { if (listView1.Items[k - 1].Text != listView1.Items[k].Text) { dte.Add(listView1.Items[k - 1].Text); dte.Add(listView1.Items[k].Text); } if (listView1.Items[k - 1].SubItems[3].Text != listView1.Items[k].SubItems[3].Text) { pname.Add(listView1.Items[k - 1].SubItems[3].Text); pname.Add(listView1.Items[k].SubItems[3].Text); } } object oMissing = System.Reflection.Missing.Value; object oEndOfDoc = "\\endofdoc"; /* \endofdoc is a predefined bookmark */ Microsoft.Office.Interop.Word._Application oWord; Microsoft.Office.Interop.Word._Document oDoc; oWord = new Microsoft.Office.Interop.Word.Application(); oWord.Visible = true; oDoc = oWord.Documents.Add(ref oMissing, ref oMissing, ref oMissing, ref oMissing); for (int k = 0; k < dte.Count; k++) { Microsoft.Office.Interop.Word.Paragraph oPara1; oPara1 = oDoc.Content.Paragraphs.Add(ref oMissing); oPara1.Range.Text = pname[k].ToString(); oPara1.Range.Font.Bold = 1; oPara1.Format.SpaceAfter = 24; //24 pt spacing after paragraph. oPara1.Range.InsertParagraphAfter(); Microsoft.Of

      A Offline
      A Offline
      Abhinav S
      wrote on last edited by
      #2

      Looks like you've got some homework to do.

      There's nothing left in my right brain and nothing right in my left brain.

      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