1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
private void BTEditerCarte_Click(object sender, EventArgs e)
{
object missing = System.Reflection.Missing.Value;
object finDoc = "\\endofdoc";
//Creation du fichier Word
Word._Application oWord;
Word._Document oDoc;
oWord = new Word.Application();
oWord.Visible = true;
oDoc = oWord.Documents.Add(ref missing, ref missing, ref missing, ref missing);
string[] informations = new string[15];
informations = Requete.rechercheParNumero(TBNumeroCarteWord.Text);
Word.Table oTable;
Word.Range wrdRng = oDoc.Bookmarks.get_Item(ref finDoc).Range;
oTable = oDoc.Tables.Add(wrdRng, 4, 1, ref missing, ref missing);
oTable.Range.ParagraphFormat.SpaceAfter = 0;
oTable.Borders.OutsideLineStyle = Word.WdLineStyle.wdLineStyleSingle;
oTable.Cell(1, 1).Range.Application.Selection.InlineShapes.AddPicture(ma1ereimage);
oTable.Cell(1, 1).Range.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphLeft;
oTable.Cell(2, 1).Range.Text = "Carte N° " + informations[0] + Environment.NewLine + "CARTE D'ACCES AUX DECHETERIES";
oTable.Cell(3, 1).Range.Text = "Nom : " + informations[2].ToUpper() + " " + informations[3] + " " + informations[4] + Environment.NewLine + "Commune : " + informations[8].ToUpper() + Environment.NewLine + "Véhicule : " + informations[10];
oTable.Cell(2, 1).Range.Font.Size = 14;
oTable.Cell(2, 1).Range.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphCenter;
oTable.Cell(3, 1).Range.Font.Size = 14;
oTable.Cell(4, 1).Range.Application.Selection.InlineShapes.AddPicture(ma2eimage);
oTable.Cell(4, 1).Range.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphRight; |
Partager