Click here to Skip to main content
16,013,548 members
Home / Discussions / C#
   

C#

 
GeneralRe: Calling functions and methods in a child form Pin
DaveyM696-Aug-09 21:54
professionalDaveyM696-Aug-09 21:54 
AnswerRe: Calling functions and methods in a child form [modified] Pin
nelsonpaixao6-Aug-09 13:58
nelsonpaixao6-Aug-09 13:58 
QuestionUsing a Session variable in an UpdateCommand Pin
JohnQuar16-Aug-09 9:17
JohnQuar16-Aug-09 9:17 
AnswerRe: Using a Session variable in an UpdateCommand [ Posted on Wrong Forum ] Pin
Abhijit Jana6-Aug-09 9:24
professionalAbhijit Jana6-Aug-09 9:24 
QuestionMS word tables using C# Pin
Member 41540746-Aug-09 9:00
Member 41540746-Aug-09 9:00 
AnswerRe: MS word tables using C# Pin
toby316-Aug-09 12:01
toby316-Aug-09 12:01 
GeneralRe: MS word tables using C# Pin
Member 41540746-Aug-09 21:51
Member 41540746-Aug-09 21:51 
GeneralRe: MS word tables using C# Pin
toby316-Aug-09 22:09
toby316-Aug-09 22:09 
i'll paste you some of my code and hope it will help you
public void insertTable(Word.Document oDoc, int nr, int nrMoment)
     {

       strct.bla ++;
         object oMissing = System.Reflection.Missing.Value;
         object oEndOfDoc = "\\endofdoc"; /* \endofdoc is a predefined bookmark */
         //object myBook = "clasa";
         Word.Table oTable;
         Word.Table oTable1;
         Object style = "Table Grid v2";
         Word.Range rngC;

         Object defaultTableBehavior = Type.Missing;
         Object autoFitBehavior = Type.Missing;


         object rng = oDoc.Bookmarks.get_Item(ref oEndOfDoc).Range;
         object oPageBreak = Word.WdBreakType.wdPageBreak;
         Word.Paragraph oPara = oDoc.Paragraphs.Add(ref rng);
         oPara.Range.InsertBreak(ref oPageBreak);
         oPara.Range.Font.Bold = 1;
         oPara.Range.Font.Size = 14;
         oPara.Range.Font.Name = "Book Antiqua";
         oPara.Range.set_Style(ref styleHeading2);
         oPara.Range.Text ="M" + strct.nr[1].ToString() +" "+ strct.titluCadru[strct.bla].ToString();
         oPara.Range.InsertParagraphAfter();
         //
         Word.Range wrdRng = oDoc.Bookmarks.get_Item(ref oEndOfDoc).Range;
        // .object.object brk = wdPageBreak


         oTable = oDoc.Tables.Add(wrdRng, 1, 1, ref defaultTableBehavior, ref autoFitBehavior);
         oTable.set_Style(ref style);
         oTable.ApplyStyleLastColumn = false;
         oTable.Range.ParagraphFormat.SpaceAfter = 5;
         rngC = oTable.Cell(1, 1).Range;
         rngC.Font.Name = "Book Antiqua";
         rngC.Font.Bold = 0;
         rngC.Text = "Obiectivele educaţionale  acoperite de moment, submoment şi itemul de învăţare \r\n Obiective operaţionale";
         rngC.ParagraphFormat.SpaceAfter = 3;

         //rngC.InsertAfter(Environment.NewLine);

         rng = oDoc.Bookmarks.get_Item(ref oEndOfDoc).Range;
         //wrdRng = oDoc.Bookmarks.get_Item(ref oEndOfDoc).Range;
         Word.Paragraph oPara1;
         oPara1 = oDoc.Paragraphs.Add(ref rng);
         oPara1.Range.Font.Bold = 1;
         oPara1.Range.Font.Name = "Book Antiqua";
         oPara1.Range.Text = "O1";// + nrMoment.ToString();
         oPara1.Format.SpaceAfter = 2;


         wrdRng = oDoc.Bookmarks.get_Item(ref oEndOfDoc).Range;
         oTable1 = oDoc.Tables.Add(wrdRng, nr + 11, 2, ref defaultTableBehavior, ref autoFitBehavior);
         oTable1.set_Style(ref style);
         oTable1.ApplyStyleLastColumn = false;
         oTable1.Range.ParagraphFormat.Alignment = Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphLeft;
         oTable1.Range.ParagraphFormat.SpaceAfter = 6;

         rngC = oTable1.Cell(1, 1).Range;
         rngC.Font.Bold = 1;
         rngC.Font.Name = "Book Antiqua";
         rngC.Text = "Descriere";


     }
 }




to use a certain table you can use a bookmark, create it from scratch, or put it in an array (haven't used this last one). Hope this helps
GeneralRe: MS word tables using C# Pin
Member 41540747-Aug-09 7:58
Member 41540747-Aug-09 7:58 
QuestionProblem Calling CheckListBox Pin
Member 28652716-Aug-09 7:31
Member 28652716-Aug-09 7:31 
AnswerRe: Problem Calling CheckListBox Pin
Andrew Rissing6-Aug-09 7:56
Andrew Rissing6-Aug-09 7:56 
AnswerRe: Problem Calling CheckListBox Pin
Luc Pattyn6-Aug-09 7:56
sitebuilderLuc Pattyn6-Aug-09 7:56 
GeneralRe: Problem Calling CheckListBox Pin
Member 28652716-Aug-09 11:48
Member 28652716-Aug-09 11:48 
AnswerRe: Problem Calling CheckListBox Pin
DaveyM696-Aug-09 11:14
professionalDaveyM696-Aug-09 11:14 
GeneralRe: Problem Calling CheckListBox Pin
Member 28652716-Aug-09 15:01
Member 28652716-Aug-09 15:01 
Questionread Sql DataBase Error Pin
toby316-Aug-09 7:28
toby316-Aug-09 7:28 
AnswerRe: read Sql DataBase Error Pin
musefan6-Aug-09 7:32
musefan6-Aug-09 7:32 
GeneralRe: read Sql DataBase Error Pin
toby316-Aug-09 7:34
toby316-Aug-09 7:34 
GeneralRe: read Sql DataBase Error Pin
Ashfield6-Aug-09 8:51
Ashfield6-Aug-09 8:51 
AnswerRe: read Sql DataBase Error Pin
dan!sh 6-Aug-09 8:52
professional dan!sh 6-Aug-09 8:52 
AnswerRe: read Sql DataBase Error Pin
toby317-Aug-09 0:33
toby317-Aug-09 0:33 
QuestionC# PDB symbols Pin
nachiket076-Aug-09 7:23
nachiket076-Aug-09 7:23 
AnswerRe: C# PDB symbols Pin
Eddy Vluggen6-Aug-09 8:19
professionalEddy Vluggen6-Aug-09 8:19 
GeneralRe: C# PDB symbols Pin
nachiket076-Aug-09 8:24
nachiket076-Aug-09 8:24 
GeneralRe: C# PDB symbols Pin
Eddy Vluggen6-Aug-09 8:46
professionalEddy Vluggen6-Aug-09 8:46 

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.