void CreateWordDocument(Client client)
        {
            string fileQrPath = string.Format(@"{0}\{1}", Environment.CurrentDirectory, filenameQrCode);

            Word.Application wApp = new Word.Application();
            Word.Document    wDoc = wApp.Documents.Add(patternCardPath);

            foreach (Word.Bookmark b in wDoc.Bookmarks)
            {
                if (b.Name == "clientInfo")
                {
                    Word.Range range = b.Range;
                    range.Text = client.ToString();
                }

                if (b.Name == "qrCode")
                {
                    Word.Range      rangeB = b.Range;
                    object          f      = false;
                    object          t      = true;
                    object          left   = Type.Missing;
                    object          top    = Type.Missing;
                    object          width  = 93;
                    object          height = 93;
                    object          range  = rangeB;
                    Word.WdWrapType wrap   = Word.WdWrapType.wdWrapSquare;

                    wDoc.Shapes.AddPicture(fileQrPath, ref f, ref t, ref left, ref top, ref width, ref height, ref range).WrapFormat.Type = wrap;
                }
            }

            wDoc.SaveAs(string.Format(@"{0}\ClientCards\{1}",
                                      Environment.CurrentDirectory,
                                      client + ".docx"
                                      ));

            wApp.Visible = true;
            wApp.Activate();
        }
Ejemplo n.º 2
0
 public void TextWrapping(Word.WdWrapType wdWrapType)
 {
     SelectedShapeIterator(sh => sh.WrapFormat.Type = wdWrapType);
 }