Click here to Skip to main content
15,887,214 members
Home / Discussions / C#
   

C#

 
Questioninsert datetime to database Pin
Erdinc2728-Dec-09 1:48
Erdinc2728-Dec-09 1:48 
AnswerRe: insert datetime to database Pin
OriginalGriff28-Dec-09 2:14
mveOriginalGriff28-Dec-09 2:14 
GeneralRe: insert datetime to database Pin
Erdinc2728-Dec-09 2:53
Erdinc2728-Dec-09 2:53 
GeneralRe: insert datetime to database Pin
Blue_Boy28-Dec-09 3:12
Blue_Boy28-Dec-09 3:12 
GeneralRe: insert datetime to database Pin
Luc Pattyn28-Dec-09 3:26
sitebuilderLuc Pattyn28-Dec-09 3:26 
GeneralRe: insert datetime to database Pin
OriginalGriff28-Dec-09 4:13
mveOriginalGriff28-Dec-09 4:13 
Questionfetch distinct record from the custom data type in ado.net entity framework Pin
Pankaj Saha27-Dec-09 22:29
Pankaj Saha27-Dec-09 22:29 
Questionhow do i differentiate between the two tables Pin
@nisha 2n27-Dec-09 22:24
@nisha 2n27-Dec-09 22:24 
I am trying to create 2 separate tables and print them in word, however I end up with two tables which are attached to each other..how do i differentiate between the two tables?or how do i seperate the two tables?is there a way in which i can insert a paragraph/break between the tables..can anyone please help?

1st of all im adding word files to listview.....with diff pname n date...i need to display in different tables...those files im adding/....

plzz see my code then u ll get idea...

private void btnsave_Click(object sender, EventArgs e)
{
List<string> DoctorNames = new List<string>();
List<string> dte = new List<string>();
List<string> pname = new List<string>();

foreach (ListViewItem litem in listView1.Items)
{
if (DoctorNames.Contains(litem.SubItems[4].Text) == false)
DoctorNames.Add(litem.SubItems[4].Text);

}
List<string> list1 = new List<string>();
List<string> list2 = new List<string>();
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);

foreach (string name in DoctorNames)
{

Microsoft.Office.Interop.Word.Paragraph oPara1;
oPara1 = oDoc.Content.Paragraphs.Add(ref oMissing);
oPara1.Range.Text = name.ToString();
oPara1.Range.Font.Bold = 1;
oPara1.Format.SpaceAfter = 24; //24 pt spacing after paragraph.
oPara1.Range.InsertParagraphAfter();


Microsoft.Office.Interop.Word.Paragraph oPara2;
oPara2 = oDoc.Content.Paragraphs.Add(ref oMissing);
oPara2.Range.Text = "Date:" + dte.ToString();
oPara2.Range.Font.Bold = 1;
oPara2.Format.SpaceAfter = 24; //24 pt spacing after paragraph.
oPara2.Range.InsertParagraphAfter();

string query = "Select FileName,LineCount from tbl where PName='" + name + "'";
OleDbDataAdapter da = new OleDbDataAdapter(query, oldb);
DataSet ds = new DataSet();


int a = listView1.Items.Count + 1;
Microsoft.Office.Interop.Word.Table oTable;

Microsoft.Office.Interop.Word.Range wrdRng = oDoc.Bookmarks.get_Item(ref oEndOfDoc).Range;
oTable = oDoc.Tables.Add(wrdRng, a, 3, ref oMissing, ref oMissing);
oTable.Range.ParagraphFormat.SpaceAfter = 6;

oTable.Cell(1, 1).Range.Text = "SNO";
oTable.Cell(1, 2).Range.Text = "FileName";
oTable.Cell(1, 3).Range.Text = "Total Count";


for (int r = 1; r < a; r++)
{

oTable.Cell(r + 1, 1).Range.Text = r.ToString();

oTable.Cell(r + 1, 2).Range.Text = listView1.Items[r - 1].SubItems[2].Text;

oTable.Cell(r + 1, 3).Range.Text = listView1.Items[r - 1].SubItems[7].Text;



oTable.Rows[r].Height = oWord.InchesToPoints(0);
}

oTable.Columns[1].Width = oWord.InchesToPoints(0); //Change width of columns 1 & 2
oTable.Columns[2].Width = oWord.InchesToPoints(0);
oTable.Columns[3].Width = oWord.InchesToPoints(0);


oTable.Rows[1].Range.Font.Bold = 1;
}
}
AnswerRe: how do i differentiate between the two tables Pin
ProtoBytes28-Dec-09 10:52
ProtoBytes28-Dec-09 10:52 
GeneralRe: how do i differentiate between the two tables Pin
@nisha 2n28-Dec-09 21:24
@nisha 2n28-Dec-09 21:24 
QuestionHow to extract image content from a tif/jpeg/bmp images Pin
RameshwerE27-Dec-09 22:15
RameshwerE27-Dec-09 22:15 
AnswerRe: How to extract image content from a tif/jpeg/bmp images Pin
0x3c027-Dec-09 22:22
0x3c027-Dec-09 22:22 
QuestionWhy Dns.Resolve Method in C# is obsolete ? Workaround? Pin
ksaw12327-Dec-09 21:23
ksaw12327-Dec-09 21:23 
AnswerRe: Why Dns.Resolve Method in C# is obsolete ? Workaround? Pin
Mirko198027-Dec-09 21:52
Mirko198027-Dec-09 21:52 
GeneralRe: Why Dns.Resolve Method in C# is obsolete ? Workaround? Pin
ksaw12328-Dec-09 0:33
ksaw12328-Dec-09 0:33 
GeneralRe: Why Dns.Resolve Method in C# is obsolete ? Workaround? Pin
OriginalGriff28-Dec-09 2:23
mveOriginalGriff28-Dec-09 2:23 
QuestionHow to implement multicoulumn combobox in datagridviewcombobox? Pin
arj_agt27-Dec-09 19:02
arj_agt27-Dec-09 19:02 
AnswerRe: How to implement multicoulumn combobox in datagridviewcombobox? Pin
Ben Fair28-Dec-09 2:39
Ben Fair28-Dec-09 2:39 
Questionhow to make web based multipoint sdk application Pin
krunal2527-Dec-09 18:59
krunal2527-Dec-09 18:59 
AnswerRe: how to make web based multipoint sdk application Pin
nagendrathecoder27-Dec-09 19:58
nagendrathecoder27-Dec-09 19:58 
QuestionHow to check Internet Connection on different gateway Pin
Mayur27-Dec-09 18:42
professionalMayur27-Dec-09 18:42 
AnswerRe: How to check Internet Connection on different gateway Pin
Dimitri Witkowski28-Dec-09 4:51
Dimitri Witkowski28-Dec-09 4:51 
QuestionFractal Index Pin
self similar idiot27-Dec-09 11:32
self similar idiot27-Dec-09 11:32 
QuestionDo you know any ListViewItem samples ? Pin
Mohammad Dayyan27-Dec-09 9:21
Mohammad Dayyan27-Dec-09 9:21 
AnswerRe: Do you know any ListViewItem samples ? Pin
ProtoBytes28-Dec-09 12:20
ProtoBytes28-Dec-09 12:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.